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