ICU 4.8.1.1  4.8.1.1
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 
00170     virtual const void *getFontTable(LETag tableTag) const = 0;
00171 
00192     /* Changed for ABI compatibility reasons */
00193     const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }
00194 
00211     virtual le_bool canDisplay(LEUnicode32 ch) const;
00212 
00221     virtual le_int32 getUnitsPerEM() const = 0;
00222 
00246     virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
00247 
00263     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
00264 
00279     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
00280 
00293     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
00294 
00295     //
00296     // Metrics
00297     //
00298 
00307     virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
00308 
00321     virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
00322 
00331     virtual float getXPixelsPerEm() const = 0;
00332 
00341     virtual float getYPixelsPerEm() const = 0;
00342 
00353     virtual float xUnitsToPoints(float xUnits) const;
00354 
00365     virtual float yUnitsToPoints(float yUnits) const;
00366 
00375     virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
00376 
00387     virtual float xPixelsToUnits(float xPixels) const;
00388 
00399     virtual float yPixelsToUnits(float yPixels) const;
00400 
00409     virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
00410 
00422     virtual float getScaleFactorX() const = 0;
00423 
00434     virtual float getScaleFactorY() const = 0;
00435 
00451     virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
00452 
00463     static inline float fixedToFloat(le_int32 fixed);
00464 
00475     static inline le_int32 floatToFixed(float theFloat);
00476 
00477     //
00478     // These methods won't ever be called by the LayoutEngine,
00479     // but are useful for clients of <code>LEFontInstance</code> who
00480     // need to render text.
00481     //
00482 
00491     virtual le_int32 getAscent() const = 0;
00492 
00501     virtual le_int32 getDescent() const = 0;
00502 
00511     virtual le_int32 getLeading() const = 0;
00512 
00523     virtual le_int32 getLineHeight() const;
00524 
00530     virtual UClassID getDynamicClassID() const;
00531 
00537     static UClassID getStaticClassID();
00538 
00539 };
00540 
00541 inline float LEFontInstance::fixedToFloat(le_int32 fixed)
00542 {
00543     return (float) (fixed / 65536.0);
00544 }
00545 
00546 inline le_int32 LEFontInstance::floatToFixed(float theFloat)
00547 {
00548     return (le_int32) (theFloat * 65536.0);
00549 }
00550 
00551 U_NAMESPACE_END
00552 #endif
00553 
00554 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines