- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# LEFontInstance.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  *
    00004  * (C) Copyright IBM Corp. 1998-2007 - 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
    00252     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
    00253
    00266     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
    00267
    00268     //
    00269     // Metrics
    00270     //
    00271
    00280     virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
    00281
    00294     virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
    00295
    00304     virtual float getXPixelsPerEm() const = 0;
    00305
    00314     virtual float getYPixelsPerEm() const = 0;
    00315
    00326     virtual float xUnitsToPoints(float xUnits) const;
    00327
    00338     virtual float yUnitsToPoints(float yUnits) const;
    00339
    00348     virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
    00349
    00360     virtual float xPixelsToUnits(float xPixels) const;
    00361
    00372     virtual float yPixelsToUnits(float yPixels) const;
    00373
    00382     virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
    00383
    00395     virtual float getScaleFactorX() const = 0;
    00396
    00407     virtual float getScaleFactorY() const = 0;
    00408
    00424     virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
    00425
    00436     static inline float fixedToFloat(le_int32 fixed);
    00437
    00448     static inline le_int32 floatToFixed(float theFloat);
    00449
    00450     //
    00451     // These methods won't ever be called by the LayoutEngine,
    00452     // but are useful for clients of <code>LEFontInstance</code> who
    00453     // need to render text.
    00454     //
    00455
    00464     virtual le_int32 getAscent() const = 0;
    00465
    00474     virtual le_int32 getDescent() const = 0;
    00475
    00484     virtual le_int32 getLeading() const = 0;
    00485
    00496     virtual le_int32 getLineHeight() const;
    00497
    00503     virtual UClassID getDynamicClassID() const;
    00504
    00510     static UClassID getStaticClassID();
    00511
    00512 };
    00513
    00514 inline float LEFontInstance::fixedToFloat(le_int32 fixed)
    00515 {
    00516     return (float) (fixed / 65536.0);
    00517 }
    00518
    00519 inline le_int32 LEFontInstance::floatToFixed(float theFloat)
    00520 {
    00521     return (le_int32) (theFloat * 65536.0);
    00522 }
    00523
    00524 U_NAMESPACE_END
    00525 #endif
    00526
    00527