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