]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | |
2 | /* | |
3 | ******************************************************************************* | |
4 | * | |
5 | * Copyright (C) 1999-2003, International Business Machines | |
6 | * Corporation and others. All Rights Reserved. | |
7 | * | |
8 | ******************************************************************************* | |
9 | * file name: PortableFontInstance.h | |
10 | * | |
11 | * created on: 11/12/1999 | |
12 | * created by: Eric R. Mader | |
13 | */ | |
14 | ||
15 | #ifndef __PORTABLEFONTINSTANCE_H | |
16 | #define __PORTABLEFONTINSTANCE_H | |
17 | ||
18 | #include <stdio.h> | |
19 | ||
20 | #include "layout/LETypes.h" | |
21 | #include "layout/LEFontInstance.h" | |
22 | ||
23 | #include "FontTableCache.h" | |
24 | ||
25 | #include "sfnt.h" | |
26 | #include "cmaps.h" | |
27 | ||
28 | class PortableFontInstance : public LEFontInstance, protected FontTableCache | |
29 | { | |
30 | private: | |
31 | FILE *fFile; | |
32 | ||
33 | float fPointSize; | |
34 | le_int32 fUnitsPerEM; | |
35 | le_int32 fAscent; | |
36 | le_int32 fDescent; | |
37 | le_int32 fLeading; | |
38 | ||
39 | const SFNTDirectory *fDirectory; | |
40 | le_uint16 fDirPower; | |
41 | le_uint16 fDirExtra; | |
42 | ||
43 | float fDeviceScaleX; | |
44 | float fDeviceScaleY; | |
45 | ||
46 | CMAPMapper *fCMAPMapper; | |
47 | ||
48 | const HMTXTable *fHMTXTable; | |
49 | le_uint16 fNumGlyphs; | |
50 | le_uint16 fNumLongHorMetrics; | |
51 | ||
52 | static le_int8 highBit(le_int32 value); | |
53 | ||
54 | const DirectoryEntry *findTable(LETag tag) const; | |
55 | const void *readTable(LETag tag, le_uint32 *length) const; | |
56 | void deleteTable(const void *table) const; | |
57 | void getMetrics(); | |
58 | ||
59 | CMAPMapper *findUnicodeMapper(); | |
60 | ||
61 | protected: | |
62 | const void *readFontTable(LETag tableTag) const; | |
63 | ||
64 | public: | |
65 | PortableFontInstance(char *fileName, float pointSize, LEErrorCode &status); | |
66 | ||
67 | virtual ~PortableFontInstance(); | |
68 | ||
69 | virtual const void *getFontTable(LETag tableTag) const; | |
70 | ||
71 | virtual le_int32 getUnitsPerEM() const | |
72 | { | |
73 | return fUnitsPerEM; | |
74 | }; | |
75 | ||
76 | virtual le_int32 getAscent() const | |
77 | { | |
78 | return fAscent; | |
79 | } | |
80 | ||
81 | virtual le_int32 getDescent() const | |
82 | { | |
83 | return fDescent; | |
84 | } | |
85 | ||
86 | virtual le_int32 getLeading() const | |
87 | { | |
88 | return fLeading; | |
89 | } | |
90 | ||
91 | virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const | |
92 | { | |
93 | return fCMAPMapper->unicodeToGlyph(ch); | |
94 | } | |
95 | ||
96 | virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const; | |
97 | ||
98 | virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const; | |
99 | ||
100 | float getXPixelsPerEm() const | |
101 | { | |
102 | return fPointSize; | |
103 | }; | |
104 | ||
105 | float getYPixelsPerEm() const | |
106 | { | |
107 | return fPointSize; | |
108 | }; | |
109 | ||
110 | float getScaleFactorX() const | |
111 | { | |
112 | return 1.0; | |
113 | } | |
114 | ||
115 | float getScaleFactorY() const | |
116 | { | |
117 | return 1.0; | |
118 | } | |
119 | ||
120 | }; | |
121 | ||
122 | #endif |