LEFontInstance.h

Go to the documentation of this file.
00001 
00002 /*
00003  *
00004  * (C) Copyright IBM Corp. 1998-2012 - 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 
00185     virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }  /* -1 = unknown length */
00186 
00203     virtual le_bool canDisplay(LEUnicode32 ch) const;
00204 
00213     virtual le_int32 getUnitsPerEM() const = 0;
00214 
00238     virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
00239 
00255     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
00256 
00271     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
00272 
00285     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
00286 
00287     //
00288     // Metrics
00289     //
00290 
00299     virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
00300 
00313     virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
00314 
00323     virtual float getXPixelsPerEm() const = 0;
00324 
00333     virtual float getYPixelsPerEm() const = 0;
00334 
00345     virtual float xUnitsToPoints(float xUnits) const;
00346 
00357     virtual float yUnitsToPoints(float yUnits) const;
00358 
00367     virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
00368 
00379     virtual float xPixelsToUnits(float xPixels) const;
00380 
00391     virtual float yPixelsToUnits(float yPixels) const;
00392 
00401     virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
00402 
00414     virtual float getScaleFactorX() const = 0;
00415 
00426     virtual float getScaleFactorY() const = 0;
00427 
00443     virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
00444 
00455     static inline float fixedToFloat(le_int32 fixed);
00456 
00467     static inline le_int32 floatToFixed(float theFloat);
00468 
00469     //
00470     // These methods won't ever be called by the LayoutEngine,
00471     // but are useful for clients of <code>LEFontInstance</code> who
00472     // need to render text.
00473     //
00474 
00483     virtual le_int32 getAscent() const = 0;
00484 
00493     virtual le_int32 getDescent() const = 0;
00494 
00503     virtual le_int32 getLeading() const = 0;
00504 
00515     virtual le_int32 getLineHeight() const;
00516 
00522     virtual UClassID getDynamicClassID() const;
00523 
00529     static UClassID getStaticClassID();
00530 
00531 };
00532 
00533 inline float LEFontInstance::fixedToFloat(le_int32 fixed)
00534 {
00535     return (float) (fixed / 65536.0);
00536 }
00537 
00538 inline le_int32 LEFontInstance::floatToFixed(float theFloat)
00539 {
00540     return (le_int32) (theFloat * 65536.0);
00541 }
00542 
00543 U_NAMESPACE_END
00544 #endif
00545 
00546 

Generated on 27 Oct 2013 for ICU 50.1.2 by  doxygen 1.4.7