]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/letest/PortableFontInstance.h
ICU-8.11.tar.gz
[apple/icu.git] / icuSources / test / letest / PortableFontInstance.h
1
2 /*
3 *******************************************************************************
4 *
5 * Copyright (C) 1999-2006, 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_uint32 fFontChecksum;
36 le_int32 fAscent;
37 le_int32 fDescent;
38 le_int32 fLeading;
39
40 const SFNTDirectory *fDirectory;
41 le_uint16 fDirPower;
42 le_uint16 fDirExtra;
43
44 float fDeviceScaleX;
45 float fDeviceScaleY;
46
47 const NAMETable *fNAMETable;
48 le_uint16 fNameCount;
49 le_uint16 fNameStringOffset;
50
51 CMAPMapper *fCMAPMapper;
52
53 const HMTXTable *fHMTXTable;
54 le_uint16 fNumGlyphs;
55 le_uint16 fNumLongHorMetrics;
56
57 static le_int8 highBit(le_int32 value);
58
59 const DirectoryEntry *findTable(LETag tag) const;
60 const void *readTable(LETag tag, le_uint32 *length) const;
61 void deleteTable(const void *table) const;
62 void getMetrics();
63
64 CMAPMapper *findUnicodeMapper();
65
66 protected:
67 const void *readFontTable(LETag tableTag) const;
68
69 public:
70 PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status);
71
72 virtual ~PortableFontInstance();
73
74 virtual const void *getFontTable(LETag tableTag) const;
75
76 virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
77
78 virtual void deleteNameString(const char *name) const;
79
80 virtual le_int32 getUnitsPerEM() const;
81
82 virtual le_uint32 getFontChecksum() const;
83
84 virtual le_int32 getAscent() const;
85
86 virtual le_int32 getDescent() const;
87
88 virtual le_int32 getLeading() const;
89
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, le_bool filterZeroWidth) const;
93
94 // We really want to inherit this method from the superclass, but some compilers
95 // issue a warning if we don't implement it...
96 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
97
98 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
99
100 virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
101
102 virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
103
104 float getXPixelsPerEm() const;
105
106 float getYPixelsPerEm() const;
107
108 float getScaleFactorX() const;
109
110 float getScaleFactorY() const;
111
112 };
113
114 #endif