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