]>
Commit | Line | Data |
---|---|---|
1 | // © 2016 and later: Unicode, Inc. and others. | |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
3 | ||
4 | /* | |
5 | ******************************************************************************* | |
6 | * | |
7 | * Copyright (C) 1999-2015, International Business Machines | |
8 | * Corporation and others. All Rights Reserved. | |
9 | * | |
10 | ******************************************************************************* | |
11 | * file name: PortableFontInstance.h | |
12 | * | |
13 | * created on: 11/12/1999 | |
14 | * created by: Eric R. Mader | |
15 | */ | |
16 | ||
17 | #ifndef __PORTABLEFONTINSTANCE_H | |
18 | #define __PORTABLEFONTINSTANCE_H | |
19 | ||
20 | #include <stdio.h> | |
21 | ||
22 | #include "layout/LETypes.h" | |
23 | #include "layout/LEFontInstance.h" | |
24 | ||
25 | #include "FontTableCache.h" | |
26 | ||
27 | #include "sfnt.h" | |
28 | #include "cmaps.h" | |
29 | ||
30 | class PortableFontInstance : public LEFontInstance, protected FontTableCache | |
31 | { | |
32 | private: | |
33 | FILE *fFile; | |
34 | ||
35 | float fPointSize; | |
36 | le_int32 fUnitsPerEM; | |
37 | le_uint32 fFontChecksum; | |
38 | le_int32 fAscent; | |
39 | le_int32 fDescent; | |
40 | le_int32 fLeading; | |
41 | ||
42 | const SFNTDirectory *fDirectory; | |
43 | le_uint16 fDirPower; | |
44 | le_uint16 fDirExtra; | |
45 | ||
46 | float fDeviceScaleX; | |
47 | float fDeviceScaleY; | |
48 | ||
49 | const NAMETable *fNAMETable; | |
50 | le_uint16 fNameCount; | |
51 | le_uint16 fNameStringOffset; | |
52 | ||
53 | CMAPMapper *fCMAPMapper; | |
54 | ||
55 | const HMTXTable *fHMTXTable; | |
56 | le_uint16 fNumGlyphs; | |
57 | le_uint16 fNumLongHorMetrics; | |
58 | ||
59 | static le_int8 highBit(le_int32 value); | |
60 | ||
61 | const DirectoryEntry *findTable(LETag tag) const; | |
62 | const void *readTable(LETag tag, le_uint32 *length) const; | |
63 | void getMetrics(); | |
64 | ||
65 | CMAPMapper *findUnicodeMapper(); | |
66 | ||
67 | protected: | |
68 | const void *readFontTable(LETag tableTag) const { size_t ignored; return readFontTable(tableTag, ignored); } | |
69 | const void *readFontTable(LETag tableTag, size_t &length) const; | |
70 | ||
71 | public: | |
72 | PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status); | |
73 | ||
74 | virtual ~PortableFontInstance(); | |
75 | ||
76 | virtual const void *getFontTable(LETag tableTag, size_t &length) const; | |
77 | ||
78 | virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const; | |
79 | ||
80 | virtual const LEUnicode16 *getUnicodeNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const; | |
81 | ||
82 | virtual void deleteNameString(const char *name) const; | |
83 | ||
84 | virtual void deleteNameString(const LEUnicode16 *name) const; | |
85 | ||
86 | virtual le_int32 getUnitsPerEM() const; | |
87 | ||
88 | virtual le_uint32 getFontChecksum() const; | |
89 | ||
90 | virtual le_uint32 getRawChecksum() const; | |
91 | ||
92 | virtual le_int32 getAscent() const; | |
93 | ||
94 | virtual le_int32 getDescent() const; | |
95 | ||
96 | virtual le_int32 getLeading() const; | |
97 | ||
98 | // We really want to inherit this method from the superclass, but some compilers | |
99 | // issue a warning if we don't implement it... | |
100 | virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const; | |
101 | ||
102 | // We really want to inherit this method from the superclass, but some compilers | |
103 | // issue a warning if we don't implement it... | |
104 | virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const; | |
105 | ||
106 | virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const; | |
107 | ||
108 | virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const; | |
109 | ||
110 | virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const; | |
111 | ||
112 | float getXPixelsPerEm() const; | |
113 | ||
114 | float getYPixelsPerEm() const; | |
115 | ||
116 | float getScaleFactorX() const; | |
117 | ||
118 | float getScaleFactorY() const; | |
119 | ||
120 | }; | |
121 | ||
122 | #endif |