OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
3 * | 3 * |
4 * This is part of HarfBuzz, an OpenType Layout engine library. | 4 * This is part of HarfBuzz, an OpenType Layout engine library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "harfbuzz-global.h" | 28 #include "harfbuzz-global.h" |
29 #include "harfbuzz-gdef.h" | 29 #include "harfbuzz-gdef.h" |
30 #include "harfbuzz-gpos.h" | 30 #include "harfbuzz-gpos.h" |
31 #include "harfbuzz-gsub.h" | 31 #include "harfbuzz-gsub.h" |
32 #include "harfbuzz-external.h" | 32 #include "harfbuzz-external.h" |
33 #include "harfbuzz-stream-private.h" | 33 #include "harfbuzz-stream-private.h" |
34 | 34 |
35 HB_BEGIN_HEADER | 35 HB_BEGIN_HEADER |
36 | 36 |
| 37 #ifdef HB_USE_PACKED_STRUCTS |
| 38 #pragma pack(push, 1) |
| 39 #endif |
| 40 |
| 41 /* |
| 42 using anything else than signed or unsigned for bitfields in C is non standar
d, |
| 43 but accepted by almost all compilers. And it gives a significant reduction in |
| 44 memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have |
| 45 a 4 byte alignment |
| 46 */ |
| 47 #ifdef __xlC__ |
| 48 typedef unsigned hb_bitfield; |
| 49 #else |
| 50 typedef hb_uint8 hb_bitfield; |
| 51 #endif |
| 52 |
37 typedef enum { | 53 typedef enum { |
38 HB_Script_Common, | 54 HB_Script_Common, |
39 HB_Script_Greek, | 55 HB_Script_Greek, |
40 HB_Script_Cyrillic, | 56 HB_Script_Cyrillic, |
41 HB_Script_Armenian, | 57 HB_Script_Armenian, |
42 HB_Script_Hebrew, | 58 HB_Script_Hebrew, |
43 HB_Script_Arabic, | 59 HB_Script_Arabic, |
44 HB_Script_Syriac, | 60 HB_Script_Syriac, |
45 HB_Script_Thaana, | 61 HB_Script_Thaana, |
46 HB_Script_Devanagari, | 62 HB_Script_Devanagari, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 132 |
117 typedef enum { | 133 typedef enum { |
118 HB_NoBreak, | 134 HB_NoBreak, |
119 HB_SoftHyphen, | 135 HB_SoftHyphen, |
120 HB_Break, | 136 HB_Break, |
121 HB_ForcedBreak | 137 HB_ForcedBreak |
122 } HB_LineBreakType; | 138 } HB_LineBreakType; |
123 | 139 |
124 | 140 |
125 typedef struct { | 141 typedef struct { |
126 /*HB_LineBreakType*/ unsigned lineBreakType :2; | 142 /*HB_LineBreakType*/ hb_bitfield lineBreakType :2; |
127 /*HB_Bool*/ unsigned whiteSpace :1; /* A unicode whitespace
character, except NBSP, ZWNBSP */ | 143 /*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitesp
ace character, except NBSP, ZWNBSP */ |
128 /*HB_Bool*/ unsigned charStop :1; /* Valid cursor positio
n (for left/right arrow) */ | 144 /*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor posi
tion (for left/right arrow) */ |
129 /*HB_Bool*/ unsigned wordBoundary :1; | 145 /*HB_Bool*/ hb_bitfield wordBoundary :1; |
130 /*HB_Bool*/ unsigned sentenceBoundary :1; | 146 /*HB_Bool*/ hb_bitfield sentenceBoundary :1; |
131 unsigned unused :2; | 147 hb_bitfield unused :2; |
132 } HB_CharAttributes; | 148 } HB_CharAttributes; |
133 | 149 |
134 void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, | 150 void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, |
135 const HB_ScriptItem *items, hb_uint32 numItems, | 151 const HB_ScriptItem *items, hb_uint32 numItems, |
136 HB_CharAttributes *attributes); | 152 HB_CharAttributes *attributes); |
137 | 153 |
138 /* requires HB_GetCharAttributes to be called before */ | 154 /* requires HB_GetCharAttributes to be called before */ |
139 void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength, | 155 void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength, |
140 const HB_ScriptItem *items, hb_uint32 numItems, | 156 const HB_ScriptItem *items, hb_uint32 numItems, |
141 HB_CharAttributes *attributes); | 157 HB_CharAttributes *attributes); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 HB_Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf
/Gaf */ | 194 HB_Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf
/Gaf */ |
179 HB_Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marb
utah */ | 195 HB_Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marb
utah */ |
180 HB_Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */ | 196 HB_Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */ |
181 HB_Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */ | 197 HB_Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */ |
182 } HB_JustificationClass; | 198 } HB_JustificationClass; |
183 | 199 |
184 /* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be
nice to keep | 200 /* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be
nice to keep |
185 * it like that. If this is a problem please tell Trolltech :) | 201 * it like that. If this is a problem please tell Trolltech :) |
186 */ | 202 */ |
187 typedef struct { | 203 typedef struct { |
188 unsigned justification :4; /* Justification class */ | 204 hb_bitfield justification :4; /* Justification class */ |
189 unsigned clusterStart :1; /* First glyph of representation of cluster */ | 205 hb_bitfield clusterStart :1; /* First glyph of representation of cluster
*/ |
190 unsigned mark :1; /* needs to be positioned around base char */ | 206 hb_bitfield mark :1; /* needs to be positioned around base char
*/ |
191 unsigned zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ | 207 hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ |
192 unsigned dontPrint :1; | 208 hb_bitfield dontPrint :1; |
193 unsigned combiningClass :8; | 209 hb_bitfield combiningClass :8; |
194 } HB_GlyphAttributes; | 210 } HB_GlyphAttributes; |
195 | 211 |
196 typedef struct HB_FaceRec_ { | 212 typedef struct HB_FaceRec_ { |
197 HB_Bool isSymbolFont; | 213 HB_Bool isSymbolFont; |
198 | 214 |
199 HB_GDEF gdef; | 215 HB_GDEF gdef; |
200 HB_GSUB gsub; | 216 HB_GSUB gsub; |
201 HB_GPOS gpos; | 217 HB_GPOS gpos; |
202 HB_Bool supported_scripts[HB_ScriptCount]; | 218 HB_Bool supported_scripts[HB_ScriptCount]; |
203 HB_Buffer buffer; | 219 HB_Buffer buffer; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 typedef struct HB_Font_ { | 255 typedef struct HB_Font_ { |
240 const HB_FontClass *klass; | 256 const HB_FontClass *klass; |
241 | 257 |
242 /* Metrics */ | 258 /* Metrics */ |
243 HB_UShort x_ppem, y_ppem; | 259 HB_UShort x_ppem, y_ppem; |
244 HB_16Dot16 x_scale, y_scale; | 260 HB_16Dot16 x_scale, y_scale; |
245 | 261 |
246 void *userData; | 262 void *userData; |
247 } HB_FontRec; | 263 } HB_FontRec; |
248 | 264 |
| 265 #ifdef HB_USE_PACKED_STRUCTS |
| 266 #pragma pack(pop) |
| 267 #endif |
| 268 |
249 typedef struct HB_ShaperItem_ HB_ShaperItem; | 269 typedef struct HB_ShaperItem_ HB_ShaperItem; |
250 | 270 |
251 struct HB_ShaperItem_ { | 271 struct HB_ShaperItem_ { |
252 const HB_UChar16 *string; /* input: the Unicode UTF16 text to
be shaped */ | 272 const HB_UChar16 *string; /* input: the Unicode UTF16 text to
be shaped */ |
253 hb_uint32 stringLength; /* input: the length of the input in
16-bit words */ | 273 hb_uint32 stringLength; /* input: the length of the input in
16-bit words */ |
254 HB_ScriptItem item; /* input: the current run to be shap
ed: a run of text all in the same script that is a substring of <string> */ | 274 HB_ScriptItem item; /* input: the current run to be shap
ed: a run of text all in the same script that is a substring of <string> */ |
255 HB_Font font; /* input: the font: scale, units and
function pointers supplying glyph indices and metrics */ | 275 HB_Font font; /* input: the font: scale, units and
function pointers supplying glyph indices and metrics */ |
256 HB_Face face; /* input: the shaper state; current
script, access to the OpenType tables , etc. */ | 276 HB_Face face; /* input: the shaper state; current
script, access to the OpenType tables , etc. */ |
257 int shaperFlags; /* input (unused) should be set to 0
; intended to support flags defined in HB_ShaperFlag */ | 277 int shaperFlags; /* input (unused) should be set to 0
; intended to support flags defined in HB_ShaperFlag */ |
258 HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array
contains glyph indices ready to be shaped */ | 278 HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array
contains glyph indices ready to be shaped */ |
(...skipping 10 matching lines...) Expand all Loading... |
269 | 289 |
270 /* internal */ | 290 /* internal */ |
271 HB_Bool kerning_applied; /* output: true if kerning was appli
ed by the shaper */ | 291 HB_Bool kerning_applied; /* output: true if kerning was appli
ed by the shaper */ |
272 }; | 292 }; |
273 | 293 |
274 HB_Bool HB_ShapeItem(HB_ShaperItem *item); | 294 HB_Bool HB_ShapeItem(HB_ShaperItem *item); |
275 | 295 |
276 HB_END_HEADER | 296 HB_END_HEADER |
277 | 297 |
278 #endif | 298 #endif |
OLD | NEW |