ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LEFontInstance.h
Go to the documentation of this file.
1 
2 /*
3  *
4  * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
5  *
6  */
7 
8 #ifndef __LEFONTINSTANCE_H
9 #define __LEFONTINSTANCE_H
10 
11 #include "LETypes.h"
18 
28 class LECharMapper /* not : public UObject because this is an interface/mixin class */
29 {
30 public:
35  virtual ~LECharMapper();
36 
46  virtual LEUnicode32 mapChar(LEUnicode32 ch) const = 0;
47 };
48 
55 class LEGlyphStorage;
56 
82 {
83 public:
84 
91  virtual ~LEFontInstance();
92 
144  virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
145 
146  //
147  // Font file access
148  //
149 
166  virtual const void *getFontTable(LETag tableTag) const = 0;
167 
184  virtual le_bool canDisplay(LEUnicode32 ch) const;
185 
194  virtual le_int32 getUnitsPerEM() const = 0;
195 
219  virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
220 
236  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
237 
252  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
253 
266  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
267 
268  //
269  // Metrics
270  //
271 
280  virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
281 
294  virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
295 
304  virtual float getXPixelsPerEm() const = 0;
305 
314  virtual float getYPixelsPerEm() const = 0;
315 
326  virtual float xUnitsToPoints(float xUnits) const;
327 
338  virtual float yUnitsToPoints(float yUnits) const;
339 
348  virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
349 
360  virtual float xPixelsToUnits(float xPixels) const;
361 
372  virtual float yPixelsToUnits(float yPixels) const;
373 
382  virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
383 
395  virtual float getScaleFactorX() const = 0;
396 
407  virtual float getScaleFactorY() const = 0;
408 
424  virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
425 
436  static inline float fixedToFloat(le_int32 fixed);
437 
448  static inline le_int32 floatToFixed(float theFloat);
449 
450  //
451  // These methods won't ever be called by the LayoutEngine,
452  // but are useful for clients of <code>LEFontInstance</code> who
453  // need to render text.
454  //
455 
464  virtual le_int32 getAscent() const = 0;
465 
474  virtual le_int32 getDescent() const = 0;
475 
484  virtual le_int32 getLeading() const = 0;
485 
496  virtual le_int32 getLineHeight() const;
497 
503  virtual UClassID getDynamicClassID() const;
504 
510  static UClassID getStaticClassID();
511 
512 };
513 
515 {
516  return (float) (fixed / 65536.0);
517 }
518 
520 {
521  return (le_int32) (theFloat * 65536.0);
522 }
523 
525 #endif
526 
527 
UChar32 LEUnicode32
Used to represent 32-bit Unicode code points.
Definition: LETypes.h:230
le_uint32 LETag
Used for four character tags.
Definition: LETypes.h:93
virtual ~LECharMapper()
Destructor.
This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
#define U_LAYOUT_API
Set to export library symbols from inside the layout engine library, and to import them from outside...
Definition: utypes.h:522
static le_int32 floatToFixed(float theFloat)
This is a convenience method used to convert floating point values to 16.16 fixed point format...
C API: Basic definitions for the ICU LayoutEngine.
int32_t le_int32
A type used for signed, 32-bit integers.
Definition: LETypes.h:34
UBool le_bool
A type used for boolean values.
Definition: LETypes.h:77
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
This is a virtual base class that serves as the interface between a LayoutEngine and the platform fon...
Instances of this class are used by LEFontInstance::mapCharsToGlyphs and LEFontInstance::mapCharToGly...
LEErrorCode
Error codes returned by the LayoutEngine.
Definition: LETypes.h:528
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UObject is the common ICU &quot;boilerplate&quot; class.
Definition: uobject.h:215
virtual LEUnicode32 mapChar(LEUnicode32 ch) const =0
This method does the adjustments.
void * UClassID
UClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ c...
Definition: utypes.h:385
static float fixedToFloat(le_int32 fixed)
This is a convenience method used to convert values in a 16.16 fixed point format to floating point...
UChar LEUnicode
Used to represent 16-bit Unicode code points.
Definition: LETypes.h:237
le_uint32 LEGlyphID
Used for glyph indices.
Definition: LETypes.h:112
virtual UClassID getDynamicClassID() const =0
ICU4C &quot;poor man&#39;s RTTI&quot;, returns a UClassID for the actual ICU class.
Used to hold a pair of (x, y) values which represent a point.
Definition: LETypes.h:244