]> git.saurik.com Git - apple/icu.git/blob - icuSources/layout/ArabicShaping.h
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / layout / ArabicShaping.h
1 /*
2 * @(#)ArabicShaping.h 1.6 00/03/15
3 *
4 * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
5 *
6 */
7
8 #ifndef __ARABICSHAPING_H
9 #define __ARABICSHAPING_H
10
11 /**
12 * \file
13 * \internal
14 */
15
16 #include "LETypes.h"
17 #include "OpenTypeTables.h"
18
19 U_NAMESPACE_BEGIN
20
21 class Shaper /* not : public UObject because this is an interface/mixin class */ {
22 public:
23 virtual inline ~Shaper() {};
24 virtual void init(LEUnicode ch, le_int32 outIndex, le_bool isloate) = 0;
25 virtual void shape(le_int32 outIndex, le_int32 shapeOffset) = 0;
26 };
27
28 class ArabicShaping /* not : public UObject because all methods are static */ {
29 public:
30 // shaping bit masks
31 enum ShapingBitMasks
32 {
33 MASK_SHAPE_RIGHT = 1, // if this bit set, shapes to right
34 MASK_SHAPE_LEFT = 2, // if this bit set, shapes to left
35 MASK_TRANSPARENT = 4, // if this bit set, is transparent (ignore other bits)
36 MASK_NOSHAPE = 8 // if this bit set, don't shape this char, i.e. tatweel
37 };
38
39 // shaping values
40 enum ShapeTypeValues
41 {
42 ST_NONE = 0,
43 ST_RIGHT = MASK_SHAPE_RIGHT,
44 ST_LEFT = MASK_SHAPE_LEFT,
45 ST_DUAL = MASK_SHAPE_RIGHT | MASK_SHAPE_LEFT,
46 ST_TRANSPARENT = MASK_TRANSPARENT,
47 ST_NOSHAPE_DUAL = MASK_NOSHAPE | ST_DUAL,
48 ST_NOSHAPE_NONE = MASK_NOSHAPE
49 };
50
51 typedef le_int32 ShapeType;
52
53 static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
54 le_bool rightToLeft, Shaper &shaper);
55
56 static const LETag *getFeatureOrder();
57
58 static const le_uint8 glyphSubstitutionTable[];
59 //static le_uint8 ligatureSubstitutionSubtable[];
60 static const le_uint8 glyphDefinitionTable[];
61
62 private:
63 // forbid instantiation
64 ArabicShaping();
65
66 static ShapeType getShapeType(LEUnicode c);
67
68 static const ShapeType shapeTypes[];
69 };
70
71 class GlyphShaper : public UMemory, public Shaper
72 {
73 public:
74 virtual void init(LEUnicode ch, le_int32 outIndex, le_bool isolate);
75 virtual void shape(le_int32 outIndex, le_int32 shapeOffset);
76
77 GlyphShaper(const LETag **outputTags);
78 ~GlyphShaper();
79
80 private:
81 const LETag **charTags;
82
83 static const LETag tagArray[];
84
85 GlyphShaper(const GlyphShaper &other); // forbid copying of this class
86 GlyphShaper &operator=(const GlyphShaper &other); // forbid copying of this class
87 };
88
89 class CharShaper : public UMemory, public Shaper
90 {
91 public:
92 virtual void init(LEUnicode ch, le_int32 outIndex, le_bool isolate);
93 virtual void shape(le_int32 outIndex, le_int32 shapeOffset);
94
95 CharShaper(LEUnicode *outputChars);
96 ~CharShaper();
97
98 private:
99 LEUnicode *chars;
100
101 static const LEUnicode isolateShapes[];
102
103 static LEUnicode getToIsolateShape(LEUnicode ch);
104
105 CharShaper(const CharShaper &other); // forbid copying of this class
106 CharShaper &operator=(const CharShaper &other); // forbid copying of this class
107 };
108
109 U_NAMESPACE_END
110 #endif