ICU 49.1.1  49.1.1
LEFontInstance.h
Go to the documentation of this file.
1 
2 /*
3  *
4  * (C) Copyright IBM Corp. 1998-2012 - 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 
185  virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); } /* -1 = unknown length */
186 
203  virtual le_bool canDisplay(LEUnicode32 ch) const;
204 
213  virtual le_int32 getUnitsPerEM() const = 0;
214 
238  virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
239 
255  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
256 
271  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
272 
285  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
286 
287  //
288  // Metrics
289  //
290 
299  virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
300 
313  virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
314 
323  virtual float getXPixelsPerEm() const = 0;
324 
333  virtual float getYPixelsPerEm() const = 0;
334 
345  virtual float xUnitsToPoints(float xUnits) const;
346 
357  virtual float yUnitsToPoints(float yUnits) const;
358 
367  virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
368 
379  virtual float xPixelsToUnits(float xPixels) const;
380 
391  virtual float yPixelsToUnits(float yPixels) const;
392 
401  virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
402 
414  virtual float getScaleFactorX() const = 0;
415 
426  virtual float getScaleFactorY() const = 0;
427 
443  virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
444 
455  static inline float fixedToFloat(le_int32 fixed);
456 
467  static inline le_int32 floatToFixed(float theFloat);
468 
469  //
470  // These methods won't ever be called by the LayoutEngine,
471  // but are useful for clients of <code>LEFontInstance</code> who
472  // need to render text.
473  //
474 
483  virtual le_int32 getAscent() const = 0;
484 
493  virtual le_int32 getDescent() const = 0;
494 
503  virtual le_int32 getLeading() const = 0;
504 
515  virtual le_int32 getLineHeight() const;
516 
522  virtual UClassID getDynamicClassID() const;
523 
529  static UClassID getStaticClassID();
530 
531 };
532 
534 {
535  return (float) (fixed / 65536.0);
536 }
537 
539 {
540  return (le_int32) (theFloat * 65536.0);
541 }
542 
544 #endif
545 
546