]>
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 | * | |
57a6839d | 5 | * Copyright (C) 1998-2013, International Business Machines |
b75a7d8f A |
6 | * Corporation and others. All Rights Reserved. |
7 | * | |
8 | ************************************************************************/ | |
9 | ||
10 | ||
11 | #ifndef __CMAPS_H | |
12 | #define __CMAPS_H | |
13 | ||
73c04bcf | 14 | #include "layout/LETypes.h" |
57a6839d | 15 | //#include "letest.h" |
b75a7d8f A |
16 | #include "sfnt.h" |
17 | ||
18 | class CMAPMapper | |
19 | { | |
20 | public: | |
21 | virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const = 0; | |
22 | ||
23 | virtual ~CMAPMapper(); | |
24 | ||
25 | static CMAPMapper *createUnicodeMapper(const CMAPTable *cmap); | |
26 | ||
27 | protected: | |
28 | CMAPMapper(const CMAPTable *cmap); | |
29 | ||
30 | CMAPMapper() {}; | |
31 | ||
32 | private: | |
33 | const CMAPTable *fcmap; | |
34 | }; | |
35 | ||
36 | class CMAPFormat4Mapper : public CMAPMapper | |
37 | { | |
38 | public: | |
39 | CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header); | |
40 | ||
41 | virtual ~CMAPFormat4Mapper(); | |
42 | ||
43 | virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const; | |
44 | ||
45 | protected: | |
46 | CMAPFormat4Mapper() {}; | |
47 | ||
48 | private: | |
49 | le_uint16 fEntrySelector; | |
50 | le_uint16 fRangeShift; | |
51 | const le_uint16 *fEndCodes; | |
52 | const le_uint16 *fStartCodes; | |
53 | const le_uint16 *fIdDelta; | |
54 | const le_uint16 *fIdRangeOffset; | |
55 | }; | |
56 | ||
57 | class CMAPGroupMapper : public CMAPMapper | |
58 | { | |
59 | public: | |
60 | CMAPGroupMapper(const CMAPTable *cmap, const CMAPGroup *groups, le_uint32 nGroups); | |
61 | ||
62 | virtual ~CMAPGroupMapper(); | |
63 | ||
64 | virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const; | |
65 | ||
66 | protected: | |
67 | CMAPGroupMapper() {}; | |
68 | ||
69 | private: | |
70 | le_int32 fPower; | |
71 | le_int32 fRangeOffset; | |
72 | const CMAPGroup *fGroups; | |
73 | }; | |
74 | ||
75 | inline CMAPMapper::CMAPMapper(const CMAPTable *cmap) | |
76 | : fcmap(cmap) | |
77 | { | |
78 | // nothing else to do | |
79 | } | |
80 | ||
81 | inline CMAPMapper::~CMAPMapper() | |
82 | { | |
57a6839d | 83 | LE_DELETE_ARRAY(fcmap); |
b75a7d8f A |
84 | } |
85 | ||
86 | #endif | |
87 |