]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/letest/cmaps.h
ICU-64252.0.1.tar.gz
[apple/icu.git] / icuSources / test / letest / cmaps.h
CommitLineData
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
18class CMAPMapper
19{
20public:
21 virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const = 0;
22
23 virtual ~CMAPMapper();
24
25 static CMAPMapper *createUnicodeMapper(const CMAPTable *cmap);
26
27protected:
28 CMAPMapper(const CMAPTable *cmap);
29
30 CMAPMapper() {};
31
32private:
33 const CMAPTable *fcmap;
34};
35
36class CMAPFormat4Mapper : public CMAPMapper
37{
38public:
39 CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header);
40
41 virtual ~CMAPFormat4Mapper();
42
43 virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
44
45protected:
46 CMAPFormat4Mapper() {};
47
48private:
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
57class CMAPGroupMapper : public CMAPMapper
58{
59public:
60 CMAPGroupMapper(const CMAPTable *cmap, const CMAPGroup *groups, le_uint32 nGroups);
61
62 virtual ~CMAPGroupMapper();
63
64 virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
65
66protected:
67 CMAPGroupMapper() {};
68
69private:
70 le_int32 fPower;
71 le_int32 fRangeOffset;
72 const CMAPGroup *fGroups;
73};
74
75inline CMAPMapper::CMAPMapper(const CMAPTable *cmap)
76 : fcmap(cmap)
77{
78 // nothing else to do
79}
80
81inline CMAPMapper::~CMAPMapper()
82{
57a6839d 83 LE_DELETE_ARRAY(fcmap);
b75a7d8f
A
84}
85
86#endif
87