]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/letest/PortableFontInstance.h
ICU-57166.0.1.tar.gz
[apple/icu.git] / icuSources / test / letest / PortableFontInstance.h
CommitLineData
b75a7d8f
A
1
2/*
3 *******************************************************************************
4 *
b331163b 5 * Copyright (C) 1999-2015, International Business Machines
b75a7d8f
A
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
28class PortableFontInstance : public LEFontInstance, protected FontTableCache
29{
30private:
31 FILE *fFile;
32
73c04bcf
A
33 float fPointSize;
34 le_int32 fUnitsPerEM;
35 le_uint32 fFontChecksum;
36 le_int32 fAscent;
37 le_int32 fDescent;
38 le_int32 fLeading;
b75a7d8f
A
39
40 const SFNTDirectory *fDirectory;
41 le_uint16 fDirPower;
42 le_uint16 fDirExtra;
43
44 float fDeviceScaleX;
45 float fDeviceScaleY;
46
73c04bcf
A
47 const NAMETable *fNAMETable;
48 le_uint16 fNameCount;
49 le_uint16 fNameStringOffset;
50
b75a7d8f
A
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;
b75a7d8f
A
61 void getMetrics();
62
63 CMAPMapper *findUnicodeMapper();
64
65protected:
57a6839d
A
66 const void *readFontTable(LETag tableTag) const { size_t ignored; return readFontTable(tableTag, ignored); }
67 const void *readFontTable(LETag tableTag, size_t &length) const;
b75a7d8f
A
68
69public:
73c04bcf 70 PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status);
b75a7d8f
A
71
72 virtual ~PortableFontInstance();
73
57a6839d 74 virtual const void *getFontTable(LETag tableTag, size_t &length) const;
b75a7d8f 75
73c04bcf
A
76 virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
77
46f4442e
A
78 virtual const LEUnicode16 *getUnicodeNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
79
73c04bcf
A
80 virtual void deleteNameString(const char *name) const;
81
46f4442e
A
82 virtual void deleteNameString(const LEUnicode16 *name) const;
83
73c04bcf
A
84 virtual le_int32 getUnitsPerEM() const;
85
86 virtual le_uint32 getFontChecksum() const;
b75a7d8f 87
57a6839d
A
88 virtual le_uint32 getRawChecksum() const;
89
73c04bcf 90 virtual le_int32 getAscent() const;
b75a7d8f 91
73c04bcf 92 virtual le_int32 getDescent() const;
b75a7d8f 93
73c04bcf 94 virtual le_int32 getLeading() const;
b75a7d8f 95
73c04bcf
A
96 // We really want to inherit this method from the superclass, but some compilers
97 // issue a warning if we don't implement it...
98 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
99
100 // We really want to inherit this method from the superclass, but some compilers
101 // issue a warning if we don't implement it...
102 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
103
104 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
b75a7d8f
A
105
106 virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
107
108 virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
109
73c04bcf
A
110 float getXPixelsPerEm() const;
111
112 float getYPixelsPerEm() const;
113
114 float getScaleFactorX() const;
115
116 float getScaleFactorY() const;
b75a7d8f
A
117
118};
119
120#endif