ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces 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-2014 - All Rights Reserved
5 *
6 */
7
8 #ifndef __LEFONTINSTANCE_H
9 #define __LEFONTINSTANCE_H
10
11 #include "LETypes.h"
17 U_NAMESPACE_BEGIN
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
81 class U_LAYOUT_API LEFontInstance : public UObject
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
191 virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); } /* -1 = unknown length */
192
209 virtual le_bool canDisplay(LEUnicode32 ch) const;
210
219 virtual le_int32 getUnitsPerEM() const = 0;
220
244 virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
245
261 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
262
277 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
278
291 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const = 0;
292
293 //
294 // Metrics
295 //
296
305 virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const = 0;
306
319 virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const = 0;
320
329 virtual float getXPixelsPerEm() const = 0;
330
339 virtual float getYPixelsPerEm() const = 0;
340
351 virtual float xUnitsToPoints(float xUnits) const;
352
363 virtual float yUnitsToPoints(float yUnits) const;
364
373 virtual void unitsToPoints(LEPoint &units, LEPoint &points) const;
374
385 virtual float xPixelsToUnits(float xPixels) const;
386
397 virtual float yPixelsToUnits(float yPixels) const;
398
407 virtual void pixelsToUnits(LEPoint &pixels, LEPoint &units) const;
408
420 virtual float getScaleFactorX() const = 0;
421
432 virtual float getScaleFactorY() const = 0;
433
449 virtual void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const;
450
461 static inline float fixedToFloat(le_int32 fixed);
462
473 static inline le_int32 floatToFixed(float theFloat);
474
475 //
476 // These methods won't ever be called by the LayoutEngine,
477 // but are useful for clients of <code>LEFontInstance</code> who
478 // need to render text.
479 //
480
489 virtual le_int32 getAscent() const = 0;
490
499 virtual le_int32 getDescent() const = 0;
500
509 virtual le_int32 getLeading() const = 0;
510
521 virtual le_int32 getLineHeight() const;
522
528 virtual UClassID getDynamicClassID() const;
529
535 static UClassID getStaticClassID();
536
537 };
538
539 inline float LEFontInstance::fixedToFloat(le_int32 fixed)
540 {
541 return (float) (fixed / 65536.0);
542 }
543
544 inline le_int32 LEFontInstance::floatToFixed(float theFloat)
545 {
546 return (le_int32) (theFloat * 65536.0);
547 }
548
549 U_NAMESPACE_END
550 #endif