cf73f3a222c39dcab0e26a6ce413179019a19415
[platform/upstream/harfbuzz.git] / src / hb-icu-le / cmaps.h
1 /***************************************************************************
2 *
3 *   Copyright (C) 1998-2006, 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 "layout/LETypes.h"
13 #include "letest.h"
14 #include "sfnt.h"
15
16 HB_BEGIN_VISIBILITY
17
18 class CMAPMapper
19 {
20 public:
21     virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const = 0;
22
23     virtual ~CMAPMapper();
24
25     static CMAPMapper *createUnicodeMapper(const CMAPTable *cmap);
26
27 protected:
28     CMAPMapper(const CMAPTable *cmap);
29
30     CMAPMapper() {};
31
32 private:
33     const CMAPTable *fcmap;
34 };
35
36 class CMAPFormat4Mapper : public CMAPMapper
37 {
38 public:
39     CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header);
40
41     virtual ~CMAPFormat4Mapper();
42
43     virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
44
45 protected:
46     CMAPFormat4Mapper() {};
47
48 private:
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
57 class CMAPGroupMapper : public CMAPMapper
58 {
59 public:
60     CMAPGroupMapper(const CMAPTable *cmap, const CMAPGroup *groups, le_uint32 nGroups);
61
62     virtual ~CMAPGroupMapper();
63
64     virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
65
66 protected:
67     CMAPGroupMapper() {};
68
69 private:
70     le_int32 fPower;
71     le_int32 fRangeOffset;
72     const CMAPGroup *fGroups;
73 };
74
75 inline CMAPMapper::CMAPMapper(const CMAPTable *cmap)
76     : fcmap(cmap)
77 {
78     // nothing else to do
79 }
80
81 inline CMAPMapper::~CMAPMapper()
82 {
83 }
84
85 HB_END_VISIBILITY
86
87 #endif