]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f A |
3 | |
4 | /* | |
5 | ******************************************************************************* | |
6 | * | |
b331163b | 7 | * Copyright (C) 1999-2015, International Business Machines |
b75a7d8f A |
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 | ||
73c04bcf A |
35 | float fPointSize; |
36 | le_int32 fUnitsPerEM; | |
37 | le_uint32 fFontChecksum; | |
38 | le_int32 fAscent; | |
39 | le_int32 fDescent; | |
40 | le_int32 fLeading; | |
b75a7d8f A |
41 | |
42 | const SFNTDirectory *fDirectory; | |
43 | le_uint16 fDirPower; | |
44 | le_uint16 fDirExtra; | |
45 | ||
46 | float fDeviceScaleX; | |
47 | float fDeviceScaleY; | |
48 | ||
73c04bcf A |
49 | const NAMETable *fNAMETable; |
50 | le_uint16 fNameCount; | |
51 | le_uint16 fNameStringOffset; | |
52 | ||
b75a7d8f A |
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; | |
b75a7d8f A |
63 | void getMetrics(); |
64 | ||
65 | CMAPMapper *findUnicodeMapper(); | |
66 | ||
67 | protected: | |
57a6839d A |
68 | const void *readFontTable(LETag tableTag) const { size_t ignored; return readFontTable(tableTag, ignored); } |
69 | const void *readFontTable(LETag tableTag, size_t &length) const; | |
b75a7d8f A |
70 | |
71 | public: | |
73c04bcf | 72 | PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status); |
b75a7d8f A |
73 | |
74 | virtual ~PortableFontInstance(); | |
75 | ||
57a6839d | 76 | virtual const void *getFontTable(LETag tableTag, size_t &length) const; |
b75a7d8f | 77 | |
73c04bcf A |
78 | virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const; |
79 | ||
46f4442e A |
80 | virtual const LEUnicode16 *getUnicodeNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const; |
81 | ||
73c04bcf A |
82 | virtual void deleteNameString(const char *name) const; |
83 | ||
46f4442e A |
84 | virtual void deleteNameString(const LEUnicode16 *name) const; |
85 | ||
73c04bcf A |
86 | virtual le_int32 getUnitsPerEM() const; |
87 | ||
88 | virtual le_uint32 getFontChecksum() const; | |
b75a7d8f | 89 | |
57a6839d A |
90 | virtual le_uint32 getRawChecksum() const; |
91 | ||
73c04bcf | 92 | virtual le_int32 getAscent() const; |
b75a7d8f | 93 | |
73c04bcf | 94 | virtual le_int32 getDescent() const; |
b75a7d8f | 95 | |
73c04bcf | 96 | virtual le_int32 getLeading() const; |
b75a7d8f | 97 | |
73c04bcf A |
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; | |
b75a7d8f A |
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 | ||
73c04bcf A |
112 | float getXPixelsPerEm() const; |
113 | ||
114 | float getYPixelsPerEm() const; | |
115 | ||
116 | float getScaleFactorX() const; | |
117 | ||
118 | float getScaleFactorY() const; | |
b75a7d8f A |
119 | |
120 | }; | |
121 | ||
122 | #endif |