LEFontInstance.h

Go to the documentation of this file.
00001 
00002 /*
00003  *
00004  * (C) Copyright IBM Corp. 1998-2006 - All Rights Reserved
00005  *
00006  */
00007 
00008 #ifndef __LEFONTINSTANCE_H
00009 #define __LEFONTINSTANCE_H
00010 
00011 #include "LETypes.h"
00017 U_NAMESPACE_BEGIN
00018 
00028 class LECharMapper /* not : public UObject because this is an interface/mixin class */
00029 {
00030 public:
00035     virtual ~LECharMapper();
00036 
00046     virtual LEUnicode32 mapChar(LEUnicode32 ch) const = 0;
00047 };
00048 
00055 class LEGlyphStorage;
00056 
00081 class U_LAYOUT_API LEFontInstance : public UObject
00082 {
00083 public:
00084 
00091     virtual ~LEFontInstance();
00092 
00144     virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
00145 
00146     //
00147     // Font file access
00148     //
00149 
00166     virtual const void *getFontTable(LETag tableTag) const = 0;
00167 
00184     virtual le_bool canDisplay(LEUnicode32 ch) const;
00185 
00194     virtual le_int32 getUnitsPerEM() const = 0;
00195 
00219     virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
00220 
00236     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
00237 
00238 
00253     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
00254 
00267     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
00268 
00269     //
00270     // Metrics
00271     //
00272 
00281     virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
00282 
00295     virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
00296 
00305     virtual float getXPixelsPerEm() const = 0;
00306 
00315     virtual float getYPixelsPerEm() const = 0;
00316 
00327     virtual float xUnitsToPoints(float xUnits) const;
00328 
00339     virtual float yUnitsToPoints(float yUnits) const;
00340 
00349     virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
00350 
00361     virtual float xPixelsToUnits(float xPixels) const;
00362 
00373     virtual float yPixelsToUnits(float yPixels) const;
00374 
00383     virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
00384 
00396     virtual float getScaleFactorX() const = 0;
00397 
00408     virtual float getScaleFactorY() const = 0;
00409 
00425     virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
00426 
00437     static inline float fixedToFloat(le_int32 fixed);
00438 
00449     static inline le_int32 floatToFixed(float theFloat);
00450 
00451     //
00452     // These methods won't ever be called by the LayoutEngine,
00453     // but are useful for clients of <code>LEFontInstance</code> who
00454     // need to render text.
00455     //
00456 
00465     virtual le_int32 getAscent() const = 0;
00466 
00475     virtual le_int32 getDescent() const = 0;
00476 
00485     virtual le_int32 getLeading() const = 0;
00486 
00497     virtual le_int32 getLineHeight() const;
00498 
00504     virtual UClassID getDynamicClassID() const;
00505 
00511     static UClassID getStaticClassID();
00512 
00513 };
00514 
00515 inline float LEFontInstance::fixedToFloat(le_int32 fixed)
00516 {
00517     return (float) (fixed / 65536.0);
00518 }
00519 
00520 inline le_int32 LEFontInstance::floatToFixed(float theFloat)
00521 {
00522     return (le_int32) (theFloat * 65536.0);
00523 }
00524 
00525 U_NAMESPACE_END
00526 #endif
00527 
00528 

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2