author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 16:40:13 +0300 | |
changeset 22 | 79de32ba3296 |
parent 0 | 1918ee327afb |
child 30 | 5dc02b23752f |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
|
3 |
* |
|
4 |
* This is part of HarfBuzz, an OpenType Layout engine library. |
|
5 |
* |
|
6 |
* Permission is hereby granted, without written agreement and without |
|
7 |
* license or royalty fees, to use, copy, modify, and distribute this |
|
8 |
* software and its documentation for any purpose, provided that the |
|
9 |
* above copyright notice and the following two paragraphs appear in |
|
10 |
* all copies of this software. |
|
11 |
* |
|
12 |
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
|
13 |
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
|
14 |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
|
15 |
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
|
16 |
* DAMAGE. |
|
17 |
* |
|
18 |
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
|
19 |
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
|
20 |
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
|
21 |
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
|
22 |
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
23 |
*/ |
|
24 |
||
25 |
#ifndef HARFBUZZ_SHAPER_PRIVATE_H |
|
26 |
#define HARFBUZZ_SHAPER_PRIVATE_H |
|
27 |
||
28 |
HB_BEGIN_HEADER |
|
29 |
||
30 |
enum { |
|
31 |
C_DOTTED_CIRCLE = 0x25CC |
|
32 |
}; |
|
33 |
||
34 |
typedef enum |
|
35 |
{ |
|
36 |
HB_Combining_BelowLeftAttached = 200, |
|
37 |
HB_Combining_BelowAttached = 202, |
|
38 |
HB_Combining_BelowRightAttached = 204, |
|
39 |
HB_Combining_LeftAttached = 208, |
|
40 |
HB_Combining_RightAttached = 210, |
|
41 |
HB_Combining_AboveLeftAttached = 212, |
|
42 |
HB_Combining_AboveAttached = 214, |
|
43 |
HB_Combining_AboveRightAttached = 216, |
|
44 |
||
45 |
HB_Combining_BelowLeft = 218, |
|
46 |
HB_Combining_Below = 220, |
|
47 |
HB_Combining_BelowRight = 222, |
|
48 |
HB_Combining_Left = 224, |
|
49 |
HB_Combining_Right = 226, |
|
50 |
HB_Combining_AboveLeft = 228, |
|
51 |
HB_Combining_Above = 230, |
|
52 |
HB_Combining_AboveRight = 232, |
|
53 |
||
54 |
HB_Combining_DoubleBelow = 233, |
|
55 |
HB_Combining_DoubleAbove = 234, |
|
56 |
HB_Combining_IotaSubscript = 240 |
|
57 |
} HB_CombiningClass; |
|
58 |
||
59 |
typedef enum { |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
LocaProperty = 0x1, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
CcmpProperty = 0x2, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
InitProperty = 0x4, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
IsolProperty = 0x8, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
64 |
FinaProperty = 0x10, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
65 |
MediProperty = 0x20, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
RligProperty = 0x40, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
67 |
CaltProperty = 0x80, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
LigaProperty = 0x100, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
DligProperty = 0x200, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
70 |
CswhProperty = 0x400, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
MsetProperty = 0x800, |
0 | 72 |
|
73 |
/* used by indic and myanmar shaper */ |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
NuktaProperty = 0x8, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
AkhantProperty = 0x10, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
RephProperty = 0x20, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
PreFormProperty = 0x40, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
BelowFormProperty = 0x80, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
AboveFormProperty = 0x100, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
HalfFormProperty = 0x200, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
PostFormProperty = 0x400, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
ConjunctFormProperty = 0x800, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
VattuProperty = 0x1000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
PreSubstProperty = 0x2000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
BelowSubstProperty = 0x4000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
AboveSubstProperty = 0x8000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
PostSubstProperty = 0x10000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
HalantProperty = 0x20000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
CligProperty = 0x40000, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
IndicCaltProperty = 0x80000 |
0 | 91 |
|
92 |
} HB_OpenTypeProperty; |
|
93 |
||
94 |
/* return true if ok. */ |
|
95 |
typedef HB_Bool (*HB_ShapeFunction)(HB_ShaperItem *shaper_item); |
|
96 |
typedef void (*HB_AttributeFunction)(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); |
|
97 |
||
98 |
typedef struct { |
|
99 |
HB_ShapeFunction shape; |
|
100 |
HB_AttributeFunction charAttributes; |
|
101 |
} HB_ScriptEngine; |
|
102 |
||
103 |
extern const HB_ScriptEngine hb_scriptEngines[]; |
|
104 |
||
105 |
extern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item); |
|
106 |
extern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item); |
|
107 |
extern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item); |
|
108 |
extern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item); |
|
109 |
extern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item); |
|
110 |
extern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item); |
|
111 |
extern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item); |
|
112 |
extern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item); |
|
113 |
||
114 |
extern void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); |
|
115 |
||
116 |
extern void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); |
|
117 |
||
118 |
extern void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); |
|
119 |
||
120 |
extern void HB_IndicAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); |
|
121 |
||
122 |
extern void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); |
|
123 |
||
124 |
typedef struct { |
|
125 |
hb_uint32 tag; |
|
126 |
hb_uint32 property; |
|
127 |
} HB_OpenTypeFeature; |
|
128 |
||
129 |
#define PositioningProperties 0x80000000 |
|
130 |
||
131 |
HB_Bool HB_SelectScript(HB_ShaperItem *item, const HB_OpenTypeFeature *features); |
|
132 |
||
133 |
HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties); |
|
134 |
HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters); |
|
135 |
||
136 |
void HB_HeuristicPosition(HB_ShaperItem *item); |
|
137 |
void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item); |
|
138 |
||
139 |
#define HB_IsControlChar(uc) \ |
|
140 |
((uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) \ |
|
141 |
|| (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) \ |
|
142 |
|| (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */)) |
|
143 |
||
144 |
HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item); |
|
145 |
||
146 |
#define HB_GetGlyphAdvances(shaper_item) \ |
|
147 |
shaper_item->font->klass->getGlyphAdvances(shaper_item->font, \ |
|
148 |
shaper_item->glyphs, shaper_item->num_glyphs, \ |
|
149 |
shaper_item->advances, \ |
|
150 |
shaper_item->face->current_flags); |
|
151 |
||
152 |
#define HB_DECLARE_STACKARRAY(Type, Name) \ |
|
153 |
Type stack##Name[512]; \ |
|
154 |
Type *Name = stack##Name; |
|
155 |
||
156 |
#define HB_INIT_STACKARRAY(Type, Name, Length) \ |
|
157 |
if ((Length) >= 512) \ |
|
158 |
Name = (Type *)malloc((Length) * sizeof(Type)); |
|
159 |
||
160 |
#define HB_STACKARRAY(Type, Name, Length) \ |
|
161 |
HB_DECLARE_STACKARRAY(Type, Name) \ |
|
162 |
HB_INIT_STACKARRAY(Type, Name, Length) |
|
163 |
||
164 |
#define HB_FREE_STACKARRAY(Name) \ |
|
165 |
if (stack##Name != Name) \ |
|
166 |
free(Name); |
|
167 |
||
168 |
HB_END_HEADER |
|
169 |
||
170 |
#endif |