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