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-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 
170  virtual const void *getFontTable(LETag tableTag) const = 0;
171 
192  /* Changed for ABI compatibility reasons */
193  const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }
194 
211  virtual le_bool canDisplay(LEUnicode32 ch) const;
212 
221  virtual le_int32 getUnitsPerEM() const = 0;
222 
246  virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
247 
263  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
264 
279  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
280 
293  virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
294 
295  //
296  // Metrics
297  //
298 
307  virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
308 
321  virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
322 
331  virtual float getXPixelsPerEm() const = 0;
332 
341  virtual float getYPixelsPerEm() const = 0;
342 
353  virtual float xUnitsToPoints(float xUnits) const;
354 
365  virtual float yUnitsToPoints(float yUnits) const;
366 
375  virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
376 
387  virtual float xPixelsToUnits(float xPixels) const;
388 
399  virtual float yPixelsToUnits(float yPixels) const;
400 
409  virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
410 
422  virtual float getScaleFactorX() const = 0;
423 
434  virtual float getScaleFactorY() const = 0;
435 
451  virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
452 
463  static inline float fixedToFloat(le_int32 fixed);
464 
475  static inline le_int32 floatToFixed(float theFloat);
476 
477  //
478  // These methods won't ever be called by the LayoutEngine,
479  // but are useful for clients of <code>LEFontInstance</code> who
480  // need to render text.
481  //
482 
491  virtual le_int32 getAscent() const = 0;
492 
501  virtual le_int32 getDescent() const = 0;
502 
511  virtual le_int32 getLeading() const = 0;
512 
523  virtual le_int32 getLineHeight() const;
524 
530  virtual UClassID getDynamicClassID() const;
531 
537  static UClassID getStaticClassID();
538 
539 };
540 
542 {
543  return (float) (fixed / 65536.0);
544 }
545 
547 {
548  return (le_int32) (theFloat * 65536.0);
549 }
550 
552 #endif
553 
554