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