3 *******************************************************************************
5 * Copyright (C) 1999-2008, International Business Machines
6 * Corporation and others. All Rights Reserved.
8 *******************************************************************************
9 * file name: PortableFontInstance.h
11 * created on: 11/12/1999
12 * created by: Eric R. Mader
15 #ifndef __PORTABLEFONTINSTANCE_H
16 #define __PORTABLEFONTINSTANCE_H
22 #include "layout/LETypes.h"
23 #include "layout/LEFontInstance.h"
26 #include "FontTableCache.h"
32 class PortableFontInstance : public LEFontInstance, protected FontTableCache
44 const NAMETable *fNAMETable;
46 le_uint16 fNameStringOffset;
48 CMAPMapper *fCMAPMapper;
50 const HMTXTable *fHMTXTable;
52 le_uint16 fNumLongHorMetrics;
56 CMAPMapper *findUnicodeMapper();
59 hb_blob_t *readFontTable(LETag tableTag) const;
62 PortableFontInstance(hb_face_t *face, float xScale, float yScale, LEErrorCode &status);
64 virtual ~PortableFontInstance();
66 virtual const void *getFontTable(LETag tableTag) const;
68 virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
70 virtual const LEUnicode16 *getUnicodeNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
72 virtual void deleteNameString(const char *name) const;
74 virtual void deleteNameString(const LEUnicode16 *name) const;
76 virtual le_int32 getUnitsPerEM() const;
78 virtual le_uint32 getFontChecksum() const;
80 virtual le_int32 getAscent() const;
82 virtual le_int32 getDescent() const;
84 virtual le_int32 getLeading() const;
86 // We really want to inherit this method from the superclass, but some compilers
87 // issue a warning if we don't implement it...
88 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
90 // We really want to inherit this method from the superclass, but some compilers
91 // issue a warning if we don't implement it...
92 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
94 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
96 virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
98 virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
100 virtual float getXPixelsPerEm() const;
102 virtual float getYPixelsPerEm() const;
104 virtual float getScaleFactorX() const;
106 virtual float getScaleFactorY() const;