2 * Implementation of Uniscribe Script Processor (usp10.dll)
4 * Copyright 2005 Steven Edwards for CodeWeavers
5 * Copyright 2006 Hans Leidekker
6 * Copyright 2010 CodeWeavers, Aric Stewart
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * Uniscribe allows for processing of complex scripts such as joining
24 * and filtering characters and bi-directional text with custom line breaks.
37 #include "usp10_internal.h"
39 #include "wine/debug.h"
40 #include "wine/unicode.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(uniscribe
);
44 typedef struct _scriptRange
53 static const scriptRange scriptRanges
[] = {
54 /* Basic Latin: U+0000–U+007A */
55 { Script_Latin
, 0x00, 0x07a , Script_Numeric
, Script_Punctuation
},
56 /* Latin-1 Supplement: U+0080–U+00FF */
57 /* Latin Extended-A: U+0100–U+017F */
58 /* Latin Extended-B: U+0180–U+024F */
59 /* IPA Extensions: U+0250–U+02AF */
60 /* Spacing Modifier Letters:U+02B0–U+02FF */
61 { Script_Latin
, 0x80, 0x2ff , Script_Numeric2
, Script_Punctuation
},
62 /* Combining Diacritical Marks : U+0300–U+036F */
63 { Script_Diacritical
,0x300, 0x36f, 0, 0},
64 /* Greek: U+0370–U+03FF */
65 { Script_Greek
, 0x370, 0x3ff, 0, 0},
66 /* Cyrillic: U+0400–U+04FF */
67 /* Cyrillic Supplement: U+0500–U+052F */
68 { Script_Cyrillic
, 0x400, 0x52f, 0, 0},
69 /* Armenian: U+0530–U+058F */
70 { Script_Armenian
, 0x530, 0x58f, 0, 0},
71 /* Hebrew: U+0590–U+05FF */
72 { Script_Hebrew
, 0x590, 0x5ff, 0, 0},
73 /* Arabic: U+0600–U+06FF */
74 { Script_Arabic
, 0x600, 0x6ef, Script_Arabic_Numeric
, 0},
75 /* Defined by Windows */
76 { Script_Persian
, 0x6f0, 0x6f9, 0, 0},
77 /* Continue Arabic: U+0600–U+06FF */
78 { Script_Arabic
, 0x6fa, 0x6ff, 0, 0},
79 /* Syriac: U+0700–U+074F*/
80 { Script_Syriac
, 0x700, 0x74f, 0, 0},
81 /* Arabic Supplement: U+0750–U+077F */
82 { Script_Arabic
, 0x750, 0x77f, 0, 0},
83 /* Thaana: U+0780–U+07BF */
84 { Script_Thaana
, 0x780, 0x7bf, 0, 0},
85 /* N’Ko: U+07C0–U+07FF */
86 { Script_NKo
, 0x7c0, 0x7ff, 0, 0},
87 /* Devanagari: U+0900–U+097F */
88 { Script_Devanagari
, 0x900, 0x97f, Script_Devanagari_Numeric
, 0},
89 /* Bengali: U+0980–U+09FF */
90 { Script_Bengali
, 0x980, 0x9ff, Script_Bengali_Numeric
, 0},
91 /* Gurmukhi: U+0A00–U+0A7F*/
92 { Script_Gurmukhi
, 0xa00, 0xa7f, Script_Gurmukhi_Numeric
, 0},
93 /* Gujarati: U+0A80–U+0AFF*/
94 { Script_Gujarati
, 0xa80, 0xaff, Script_Gujarati_Numeric
, 0},
95 /* Oriya: U+0B00–U+0B7F */
96 { Script_Oriya
, 0xb00, 0xb7f, Script_Oriya_Numeric
, 0},
97 /* Tamil: U+0B80–U+0BFF */
98 { Script_Tamil
, 0xb80, 0xbff, Script_Tamil_Numeric
, 0},
99 /* Telugu: U+0C00–U+0C7F */
100 { Script_Telugu
, 0xc00, 0xc7f, Script_Telugu_Numeric
, 0},
101 /* Kannada: U+0C80–U+0CFF */
102 { Script_Kannada
, 0xc80, 0xcff, Script_Kannada_Numeric
, 0},
103 /* Malayalam: U+0D00–U+0D7F */
104 { Script_Malayalam
, 0xd00, 0xd7f, Script_Malayalam_Numeric
, 0},
105 /* Sinhala: U+0D80–U+0DFF */
106 { Script_Sinhala
, 0xd80, 0xdff, 0, 0},
107 /* Thai: U+0E00–U+0E7F */
108 { Script_Thai
, 0xe00, 0xe7f, Script_Thai_Numeric
, 0},
109 /* Lao: U+0E80–U+0EFF */
110 { Script_Lao
, 0xe80, 0xeff, Script_Lao_Numeric
, 0},
111 /* Tibetan: U+0F00–U+0FFF */
112 { Script_Tibetan
, 0xf00, 0xfff, 0, 0},
113 /* Myanmar: U+1000–U+109F */
114 { Script_Myanmar
, 0x1000, 0x109f, Script_Myanmar_Numeric
, 0},
115 /* Georgian: U+10A0–U+10FF */
116 { Script_Georgian
, 0x10a0, 0x10ff, 0, 0},
117 /* Hangul Jamo: U+1100–U+11FF */
118 { Script_Hangul
, 0x1100, 0x11ff, 0, 0},
119 /* Ethiopic: U+1200–U+137F */
120 /* Ethiopic Extensions: U+1380–U+139F */
121 { Script_Ethiopic
, 0x1200, 0x139f, 0, 0},
122 /* Cherokee: U+13A0–U+13FF */
123 { Script_Cherokee
, 0x13a0, 0x13ff, 0, 0},
124 /* Canadian Aboriginal Syllabics: U+1400–U+167F */
125 { Script_Canadian
, 0x1400, 0x167f, 0, 0},
126 /* Ogham: U+1680–U+169F */
127 { Script_Ogham
, 0x1680, 0x169f, 0, 0},
128 /* Runic: U+16A0–U+16F0 */
129 { Script_Runic
, 0x16a0, 0x16f0, 0, 0},
130 /* Khmer: U+1780–U+17FF */
131 { Script_Khmer
, 0x1780, 0x17ff, Script_Khmer_Numeric
, 0},
132 /* Mongolian: U+1800–U+18AF */
133 { Script_Mongolian
, 0x1800, 0x18af, Script_Mongolian_Numeric
, 0},
134 /* Canadian Aboriginal Syllabics Extended: U+18B0–U+18FF */
135 { Script_Canadian
, 0x18b0, 0x18ff, 0, 0},
136 /* Tai Le: U+1950–U+197F */
137 { Script_Tai_Le
, 0x1950, 0x197f, 0, 0},
138 /* New Tai Lue: U+1980–U+19DF */
139 { Script_New_Tai_Lue
,0x1980, 0x19df, Script_New_Tai_Lue_Numeric
, 0},
140 /* Khmer Symbols: U+19E0–U+19FF */
141 { Script_Khmer
, 0x19e0, 0x19ff, Script_Khmer_Numeric
, 0},
142 /* Vedic Extensions: U+1CD0-U+1CFF */
143 { Script_Devanagari
, 0x1cd0, 0x1cff, Script_Devanagari_Numeric
, 0},
144 /* Phonetic Extensions: U+1D00–U+1DBF */
145 { Script_Latin
, 0x1d00, 0x1dbf, 0, 0},
146 /* Combining Diacritical Marks Supplement: U+1DC0–U+1DFF */
147 { Script_Diacritical
,0x1dc0, 0x1dff, 0, 0},
148 /* Latin Extended Additional: U+1E00–U+1EFF */
149 { Script_Latin
, 0x1e00, 0x1eff, 0, 0},
150 /* Greek Extended: U+1F00–U+1FFF */
151 { Script_Greek
, 0x1f00, 0x1fff, 0, 0},
152 /* General Punctuation: U+2000 –U+206f */
153 { Script_Latin
, 0x2000, 0x206f, 0, 0},
154 /* Superscripts and Subscripts : U+2070 –U+209f */
155 /* Currency Symbols : U+20a0 –U+20cf */
156 { Script_Numeric2
, 0x2070, 0x2070, 0, 0},
157 { Script_Latin
, 0x2071, 0x2073, 0, 0},
158 { Script_Numeric2
, 0x2074, 0x2079, 0, 0},
159 { Script_Latin
, 0x207a, 0x207f, 0, 0},
160 { Script_Numeric2
, 0x2080, 0x2089, 0, 0},
161 { Script_Latin
, 0x208a, 0x20cf, 0, 0},
162 /* Letterlike Symbols : U+2100 –U+214f */
163 /* Number Forms : U+2150 –U+218f */
164 /* Arrows : U+2190 –U+21ff */
165 /* Mathematical Operators : U+2200 –U+22ff */
166 /* Miscellaneous Technical : U+2300 –U+23ff */
167 /* Control Pictures : U+2400 –U+243f */
168 /* Optical Character Recognition : U+2440 –U+245f */
169 /* Enclosed Alphanumerics : U+2460 –U+24ff */
170 /* Box Drawing : U+2500 –U+25ff */
171 /* Block Elements : U+2580 –U+259f */
172 /* Geometric Shapes : U+25a0 –U+25ff */
173 /* Miscellaneous Symbols : U+2600 –U+26ff */
174 /* Dingbats : U+2700 –U+27bf */
175 /* Miscellaneous Mathematical Symbols-A : U+27c0 –U+27ef */
176 /* Supplemental Arrows-A : U+27f0 –U+27ff */
177 { Script_Latin
, 0x2100, 0x27ff, 0, 0},
178 /* Braille Patterns: U+2800–U+28FF */
179 { Script_Braille
, 0x2800, 0x28ff, 0, 0},
180 /* Supplemental Arrows-B : U+2900 –U+297f */
181 /* Miscellaneous Mathematical Symbols-B : U+2980 –U+29ff */
182 /* Supplemental Mathematical Operators : U+2a00 –U+2aff */
183 /* Miscellaneous Symbols and Arrows : U+2b00 –U+2bff */
184 { Script_Latin
, 0x2900, 0x2bff, 0, 0},
185 /* Latin Extended-C: U+2C60–U+2C7F */
186 { Script_Latin
, 0x2c60, 0x2c7f, 0, 0},
187 /* Georgian: U+2D00–U+2D2F */
188 { Script_Georgian
, 0x2d00, 0x2d2f, 0, 0},
189 /* Tifinagh: U+2D30–U+2D7F */
190 { Script_Tifinagh
, 0x2d30, 0x2d7f, 0, 0},
191 /* Ethiopic Extensions: U+2D80–U+2DDF */
192 { Script_Ethiopic
, 0x2d80, 0x2ddf, 0, 0},
193 /* Cyrillic Extended-A: U+2DE0–U+2DFF */
194 { Script_Cyrillic
, 0x2de0, 0x2dff, 0, 0},
195 /* CJK Radicals Supplement: U+2E80–U+2EFF */
196 /* Kangxi Radicals: U+2F00–U+2FDF */
197 { Script_CJK_Han
, 0x2e80, 0x2fdf, 0, 0},
198 /* Ideographic Description Characters: U+2FF0–U+2FFF */
199 { Script_Ideograph
,0x2ff0, 0x2fff, 0, 0},
200 /* CJK Symbols and Punctuation: U+3000–U+303F */
201 { Script_Ideograph
,0x3000, 0x3004, 0, 0},
202 { Script_CJK_Han
,0x3005, 0x3005, 0, 0},
203 { Script_Ideograph
,0x3006, 0x3006, 0, 0},
204 { Script_CJK_Han
,0x3007, 0x3007, 0, 0},
205 { Script_Ideograph
,0x3008, 0x3020, 0, 0},
206 { Script_CJK_Han
,0x3021, 0x3029, 0, 0},
207 { Script_Ideograph
,0x302a, 0x3030, 0, 0},
209 { Script_Kana
,0x3031, 0x3035, 0, 0},
210 { Script_Ideograph
,0x3036, 0x3037, 0, 0},
211 { Script_CJK_Han
,0x3038, 0x303b, 0, 0},
212 { Script_Ideograph
,0x303c, 0x303f, 0, 0},
213 /* Hiragana: U+3040–U+309F */
214 /* Katakana: U+30A0–U+30FF */
215 { Script_Kana
,0x3040, 0x30ff, 0, 0},
216 /* Bopomofo: U+3100–U+312F */
217 { Script_Bopomofo
,0x3100, 0x312f, 0, 0},
218 /* Hangul Compatibility Jamo: U+3130–U+318F */
219 { Script_Hangul
,0x3130, 0x318f, 0, 0},
220 /* Kanbun: U+3190–U+319F */
221 { Script_Ideograph
,0x3190, 0x319f, 0, 0},
222 /* Bopomofo Extended: U+31A0–U+31BF */
223 { Script_Bopomofo
,0x31a0, 0x31bf, 0, 0},
224 /* CJK Strokes: U+31C0–U+31EF */
225 { Script_Ideograph
,0x31c0, 0x31ef, 0, 0},
226 /* Katakana Phonetic Extensions: U+31F0–U+31FF */
227 { Script_Kana
,0x31f0, 0x31ff, 0, 0},
228 /* Enclosed CJK Letters and Months: U+3200–U+32FF */
229 { Script_Hangul
,0x3200, 0x321f, 0, 0},
230 { Script_Ideograph
,0x3220, 0x325f, 0, 0},
231 { Script_Hangul
,0x3260, 0x327f, 0, 0},
232 { Script_Ideograph
,0x3280, 0x32ef, 0, 0},
233 { Script_Kana
,0x32d0, 0x31ff, 0, 0},
234 /* CJK Compatibility: U+3300–U+33FF*/
235 { Script_Kana
,0x3300, 0x3357, 0, 0},
236 { Script_Ideograph
,0x3358, 0x33ff, 0, 0},
237 /* CJK Unified Ideographs Extension A: U+3400–U+4DBF */
238 { Script_CJK_Han
,0x3400, 0x4dbf, 0, 0},
239 /* CJK Unified Ideographs: U+4E00–U+9FFF */
240 { Script_CJK_Han
,0x4e00, 0x9fff, 0, 0},
241 /* Yi: U+A000–U+A4CF */
242 { Script_Yi
,0xa000, 0xa4cf, 0, 0},
243 /* Vai: U+A500–U+A63F */
244 { Script_Vai
,0xa500, 0xa63f, Script_Vai_Numeric
, 0},
245 /* Cyrillic Extended-B: U+A640–U+A69F */
246 { Script_Cyrillic
, 0xa640, 0xa69f, 0, 0},
247 /* Modifier Tone Letters: U+A700–U+A71F */
248 /* Latin Extended-D: U+A720–U+A7FF */
249 { Script_Latin
, 0xa700, 0xa7ff, 0, 0},
250 /* Phags-pa: U+A840–U+A87F */
251 { Script_Phags_pa
, 0xa840, 0xa87f, 0, 0},
252 /* Devanagari Extended: U+A8E0-U+A8FF */
253 { Script_Devanagari
, 0xa8e0, 0xa8ff, Script_Devanagari_Numeric
, 0},
254 /* Myanmar Extended-A: U+AA60–U+AA7F */
255 { Script_Myanmar
, 0xaa60, 0xaa7f, Script_Myanmar_Numeric
, 0},
256 /* Hangul Jamo Extended-A: U+A960–U+A97F */
257 { Script_Hangul
, 0xa960, 0xa97f, 0, 0},
258 /* Hangul Syllables: U+AC00–U+D7A3 */
259 { Script_Hangul
, 0xac00, 0xd7a3, 0, 0},
260 /* Hangul Jamo Extended-B: U+D7B0–U+D7FF */
261 { Script_Hangul
, 0xd7b0, 0xd7ff, 0, 0},
262 /* Surrogates Area: U+D800–U+DFFF */
263 { Script_Surrogates
, 0xd800, 0xdbfe, 0, 0},
264 { Script_Private
, 0xdbff, 0xdc00, 0, 0},
265 { Script_Surrogates
, 0xdc01, 0xdfff, 0, 0},
266 /* Private Use Area: U+E000–U+F8FF */
267 { Script_Private
, 0xe000, 0xf8ff, 0, 0},
268 /* CJK Compatibility Ideographs: U+F900–U+FAFF */
269 { Script_CJK_Han
,0xf900, 0xfaff, 0, 0},
270 /* Latin Ligatures: U+FB00–U+FB06 */
271 { Script_Latin
, 0xfb00, 0xfb06, 0, 0},
272 /* Armenian ligatures U+FB13..U+FB17 */
273 { Script_Armenian
, 0xfb13, 0xfb17, 0, 0},
274 /* Alphabetic Presentation Forms: U+FB1D–U+FB4F */
275 { Script_Hebrew
, 0xfb1d, 0xfb4f, 0, 0},
276 /* Arabic Presentation Forms-A: U+FB50–U+FDFF*/
277 { Script_Arabic
, 0xfb50, 0xfdff, 0, 0},
278 /* Vertical Forms: U+FE10–U+FE1F */
279 /* Combining Half Marks: U+FE20–U+FE2F */
280 /* CJK Compatibility Forms: U+FE30–U+FE4F */
281 /* Small Form Variants: U+FE50–U+FE6F */
282 { Script_Ideograph
,0xfe10, 0xfe6f, 0, 0},
283 /* Arabic Presentation Forms-B: U+FE70–U+FEFF*/
284 { Script_Arabic
, 0xfe70, 0xfeff, 0, 0},
285 /* Halfwidth and Fullwidth Forms: U+FF00–FFEF */
286 { Script_Ideograph
,0xff00, 0xff64, Script_Numeric2
, 0},
287 { Script_Kana
,0xff65, 0xff9f, 0, 0},
288 { Script_Hangul
,0xffa0, 0xffdf, 0, 0},
289 { Script_Ideograph
,0xffe0, 0xffef, 0, 0},
291 { SCRIPT_UNDEFINED
, 0, 0, 0}
294 typedef struct _scriptData
297 SCRIPT_PROPERTIES props
;
298 OPENTYPE_TAG scriptTag
;
299 WCHAR fallbackFont
[LF_FACESIZE
];
302 /* the must be in order so that the index matches the Script value */
303 static const scriptData scriptInformation
[] = {
304 {{SCRIPT_UNDEFINED
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
305 {LANG_NEUTRAL
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
308 {{Script_Latin
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
309 {LANG_ENGLISH
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
310 MS_MAKE_TAG('l','a','t','n'),
312 {{Script_CR
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
313 {LANG_NEUTRAL
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
316 {{Script_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
317 {LANG_ENGLISH
, 1, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
320 {{Script_Control
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
321 {LANG_ENGLISH
, 0, 1, 0, 0, ANSI_CHARSET
, 1, 0, 0, 0, 0, 0, 1, 0, 0},
324 {{Script_Punctuation
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
325 {LANG_NEUTRAL
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
328 {{Script_Arabic
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
329 {LANG_ARABIC
, 0, 1, 0, 0, ARABIC_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 1, 0},
330 MS_MAKE_TAG('a','r','a','b'),
331 {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f',0}},
332 {{Script_Arabic_Numeric
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
333 {LANG_ARABIC
, 1, 1, 0, 0, ARABIC_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
334 MS_MAKE_TAG('a','r','a','b'),
335 {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f',0}},
336 {{Script_Hebrew
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
337 {LANG_HEBREW
, 0, 1, 0, 1, HEBREW_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
338 MS_MAKE_TAG('h','e','b','r'),
339 {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f',0}},
340 {{Script_Syriac
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
341 {LANG_SYRIAC
, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 1, 0},
342 MS_MAKE_TAG('s','y','r','c'),
343 {'E','s','t','r','a','n','g','e','l','o',' ','E','d','e','s','s','a',0}},
344 {{Script_Persian
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
345 {LANG_PERSIAN
, 1, 1, 0, 0, ARABIC_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
346 MS_MAKE_TAG('s','y','r','c'),
347 {'E','s','t','r','a','n','g','e','l','o',' ','E','d','e','s','s','a',0}},
348 {{Script_Thaana
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
349 {LANG_DIVEHI
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
350 MS_MAKE_TAG('t','h','a','a'),
351 {'M','V',' ','B','o','l','i',0}},
352 {{Script_Greek
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
353 {LANG_GREEK
, 0, 0, 0, 0, GREEK_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
354 MS_MAKE_TAG('g','r','e','k'),
356 {{Script_Cyrillic
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
357 {LANG_RUSSIAN
, 0, 0, 0, 0, RUSSIAN_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
358 MS_MAKE_TAG('c','y','r','l'),
360 {{Script_Armenian
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
361 {LANG_ARMENIAN
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
362 MS_MAKE_TAG('a','r','m','n'),
363 {'S','y','l','f','a','e','n',0}},
364 {{Script_Georgian
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
365 {LANG_GEORGIAN
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
366 MS_MAKE_TAG('g','e','o','r'),
367 {'S','y','l','f','a','e','n',0}},
368 {{Script_Sinhala
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
369 {LANG_SINHALESE
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
370 MS_MAKE_TAG('s','i','n','h'),
371 {'I','s','k','o','o','l','a',' ','P','o','t','a',0}},
372 {{Script_Tibetan
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
373 {LANG_TIBETAN
, 0, 1, 1, 1, DEFAULT_CHARSET
, 0, 0, 1, 0, 1, 0, 0, 0, 0},
374 MS_MAKE_TAG('t','i','b','t'),
375 {'M','i','c','r','o','s','o','f','t',' ','H','i','m','a','l','a','y','a',0}},
376 {{Script_Tibetan_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
377 {LANG_TIBETAN
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
378 MS_MAKE_TAG('t','i','b','t'),
379 {'M','i','c','r','o','s','o','f','t',' ','H','i','m','a','l','a','y','a',0}},
380 {{Script_Phags_pa
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
381 {LANG_MONGOLIAN
, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
382 MS_MAKE_TAG('p','h','a','g'),
383 {'M','i','c','r','o','s','o','f','t',' ','P','h','a','g','s','P','a',0}},
384 {{Script_Thai
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
385 {LANG_THAI
, 0, 1, 1, 1, THAI_CHARSET
, 0, 0, 1, 0, 1, 0, 0, 0, 1},
386 MS_MAKE_TAG('t','h','a','i'),
387 {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f',0}},
388 {{Script_Thai_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
389 {LANG_THAI
, 1, 1, 0, 0, THAI_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
390 MS_MAKE_TAG('t','h','a','i'),
391 {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f',0}},
392 {{Script_Lao
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
393 {LANG_LAO
, 0, 1, 1, 1, DEFAULT_CHARSET
, 0, 0, 1, 0, 1, 0, 0, 0, 0},
394 MS_MAKE_TAG('l','a','o',' '),
395 {'D','o','k','C','h','a','m','p','a',0}},
396 {{Script_Lao_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
397 {LANG_LAO
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
398 MS_MAKE_TAG('l','a','o',' '),
399 {'D','o','k','C','h','a','m','p','a',0}},
400 {{Script_Devanagari
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
401 {LANG_HINDI
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
402 MS_MAKE_TAG('d','e','v','a'),
403 {'M','a','n','g','a','l',0}},
404 {{Script_Devanagari_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
405 {LANG_HINDI
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
406 MS_MAKE_TAG('d','e','v','a'),
407 {'M','a','n','g','a','l',0}},
408 {{Script_Bengali
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
409 {LANG_BENGALI
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
410 MS_MAKE_TAG('b','e','n','g'),
411 {'V','r','i','n','d','a',0}},
412 {{Script_Bengali_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
413 {LANG_BENGALI
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
414 MS_MAKE_TAG('b','e','n','g'),
415 {'V','r','i','n','d','a',0}},
416 {{Script_Bengali_Currency
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
417 {LANG_BENGALI
, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
418 MS_MAKE_TAG('b','e','n','g'),
419 {'V','r','i','n','d','a',0}},
420 {{Script_Gurmukhi
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
421 {LANG_PUNJABI
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
422 MS_MAKE_TAG('g','u','r','u'),
423 {'R','a','a','v','i',0}},
424 {{Script_Gurmukhi_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
425 {LANG_PUNJABI
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
426 MS_MAKE_TAG('g','u','r','u'),
427 {'R','a','a','v','i',0}},
428 {{Script_Gujarati
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
429 {LANG_GUJARATI
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
430 MS_MAKE_TAG('g','u','j','r'),
431 {'S','h','r','u','t','i',0}},
432 {{Script_Gujarati_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
433 {LANG_GUJARATI
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
434 MS_MAKE_TAG('g','u','j','r'),
435 {'S','h','r','u','t','i',0}},
436 {{Script_Gujarati_Currency
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
437 {LANG_GUJARATI
, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
438 MS_MAKE_TAG('g','u','j','r'),
439 {'S','h','r','u','t','i',0}},
440 {{Script_Oriya
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
441 {LANG_ORIYA
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
442 MS_MAKE_TAG('o','r','y','a'),
443 {'K','a','l','i','n','g','a',0}},
444 {{Script_Oriya_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
445 {LANG_ORIYA
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
446 MS_MAKE_TAG('o','r','y','a'),
447 {'K','a','l','i','n','g','a',0}},
448 {{Script_Tamil
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
449 {LANG_TAMIL
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
450 MS_MAKE_TAG('t','a','m','l'),
451 {'L','a','t','h','a',0}},
452 {{Script_Tamil_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
453 {LANG_TAMIL
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
454 MS_MAKE_TAG('t','a','m','l'),
455 {'L','a','t','h','a',0}},
456 {{Script_Telugu
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
457 {LANG_TELUGU
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
458 MS_MAKE_TAG('t','e','l','u'),
459 {'G','a','u','t','a','m','i',0}},
460 {{Script_Telugu_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
461 {LANG_TELUGU
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
462 MS_MAKE_TAG('t','e','l','u'),
463 {'G','a','u','t','a','m','i',0}},
464 {{Script_Kannada
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
465 {LANG_KANNADA
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
466 MS_MAKE_TAG('k','n','d','a'),
467 {'T','u','n','g','a',0}},
468 {{Script_Kannada_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
469 {LANG_KANNADA
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
470 MS_MAKE_TAG('k','n','d','a'),
471 {'T','u','n','g','a',0}},
472 {{Script_Malayalam
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
473 {LANG_MALAYALAM
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
474 MS_MAKE_TAG('m','l','y','m'),
475 {'K','a','r','t','i','k','a',0}},
476 {{Script_Malayalam_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
477 {LANG_MALAYALAM
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
478 MS_MAKE_TAG('m','l','y','m'),
479 {'K','a','r','t','i','k','a',0}},
480 {{Script_Diacritical
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
481 {LANG_ENGLISH
, 0, 1, 0, 1, ANSI_CHARSET
, 0, 0, 0, 0, 0, 1, 1, 0, 0},
484 {{Script_Punctuation2
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
485 {LANG_ENGLISH
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
486 MS_MAKE_TAG('l','a','t','n'),
488 {{Script_Numeric2
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
489 {LANG_ENGLISH
, 1, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
492 {{Script_Myanmar
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
493 {0x55, 0, 1, 1, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
494 MS_MAKE_TAG('m','y','m','r'),
496 {{Script_Myanmar_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
497 {0x55, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
498 MS_MAKE_TAG('m','y','m','r'),
500 {{Script_Tai_Le
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
501 {0, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
502 MS_MAKE_TAG('t','a','l','e'),
503 {'M','i','c','r','o','s','o','f','t',' ','T','a','i',' ','L','e'}},
504 {{Script_New_Tai_Lue
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
505 {0, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
506 MS_MAKE_TAG('t','a','l','u'),
507 {'M','i','c','r','o','s','o','f','t',' ','N','e','w',' ','T','a','i',' ','L','u','e'}},
508 {{Script_New_Tai_Lue_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
509 {0, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
510 MS_MAKE_TAG('t','a','l','u'),
511 {'M','i','c','r','o','s','o','f','t',' ','N','e','w',' ','T','a','i',' ','L','u','e'}},
512 {{Script_Khmer
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
513 {0x53, 0, 1, 1, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 1, 0, 0, 0, 0},
514 MS_MAKE_TAG('k','h','m','r'),
515 {'D','a','u','n','P','e','n','h'}},
516 {{Script_Khmer
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
517 {0x53, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
518 MS_MAKE_TAG('k','h','m','r'),
519 {'D','a','u','n','P','e','n','h'}},
520 {{Script_CJK_Han
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
521 {LANG_ENGLISH
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
522 MS_MAKE_TAG('h','a','n','i'),
524 {{Script_Ideograph
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
525 {LANG_ENGLISH
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
526 MS_MAKE_TAG('h','a','n','i'),
528 {{Script_Bopomofo
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
529 {LANG_ENGLISH
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
530 MS_MAKE_TAG('b','o','p','o'),
532 {{Script_Kana
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
533 {LANG_ENGLISH
, 0, 0, 0, 0, ANSI_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
534 MS_MAKE_TAG('k','a','n','a'),
536 {{Script_Hangul
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
537 {LANG_KOREAN
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
538 MS_MAKE_TAG('h','a','n','g'),
540 {{Script_Yi
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
541 {LANG_ENGLISH
, 0, 0, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
542 MS_MAKE_TAG('y','i',' ',' '),
543 {'M','i','c','r','o','s','o','f','t',' ','Y','i',' ','B','a','i','t','i'}},
544 {{Script_Ethiopic
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
545 {0x5e, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
546 MS_MAKE_TAG('e','t','h','i'),
547 {'N','y','a','l','a'}},
548 {{Script_Ethiopic_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
549 {0x5e, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
550 MS_MAKE_TAG('e','t','h','i'),
551 {'N','y','a','l','a'}},
552 {{Script_Mongolian
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
553 {LANG_MONGOLIAN
, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
554 MS_MAKE_TAG('m','o','n','g'),
555 {'M','o','n','g','o','l','i','a','n',' ','B','a','i','t','i'}},
556 {{Script_Mongolian_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
557 {LANG_MONGOLIAN
, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
558 MS_MAKE_TAG('m','o','n','g'),
559 {'M','o','n','g','o','l','i','a','n',' ','B','a','i','t','i'}},
560 {{Script_Tifinagh
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
561 {0, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
562 MS_MAKE_TAG('t','f','n','g'),
563 {'E','b','r','i','m','a'}},
564 {{Script_NKo
, 1, 1, 0, 0, 0, 0, { 1,0,0,0,0,0,0,0,0,0,0}},
565 {0, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
566 MS_MAKE_TAG('n','k','o',' '),
567 {'E','b','r','i','m','a'}},
568 {{Script_Vai
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
569 {0, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
570 MS_MAKE_TAG('v','a','i',' '),
571 {'E','b','r','i','m','a'}},
572 {{Script_Vai_Numeric
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
573 {0, 1, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
574 MS_MAKE_TAG('v','a','i',' '),
575 {'E','b','r','i','m','a'}},
576 {{Script_Cherokee
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
577 {0x5c, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
578 MS_MAKE_TAG('c','h','e','r'),
579 {'P','l','a','n','t','a','g','e','n','e','t',' ','C','h','e','r','o','k','e','e'}},
580 {{Script_Canadian
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
581 {0x5d, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
582 MS_MAKE_TAG('c','a','n','s'),
583 {'E','u','p','h','e','m','i','a'}},
584 {{Script_Ogham
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
585 {0, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
586 MS_MAKE_TAG('o','g','a','m'),
587 {'S','e','g','o','e',' ','U','I',' ','S','y','m','b','o','l'}},
588 {{Script_Runic
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
589 {0, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
590 MS_MAKE_TAG('r','u','n','r'),
591 {'S','e','g','o','e',' ','U','I',' ','S','y','m','b','o','l'}},
592 {{Script_Braille
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
593 {LANG_ENGLISH
, 0, 1, 0, 0, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 0, 0, 0},
594 MS_MAKE_TAG('b','r','a','i'),
595 {'S','e','g','o','e',' ','U','I',' ','S','y','m','b','o','l'}},
596 {{Script_Surrogates
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
597 {LANG_ENGLISH
, 0, 1, 0, 1, DEFAULT_CHARSET
, 0, 0, 0, 0, 0, 0, 1, 0, 0},
600 {{Script_Private
, 0, 0, 0, 0, 0, 0, { 0,0,0,0,0,0,0,0,0,0,0}},
601 {0, 0, 0, 0, 0, DEFAULT_CHARSET
, 0, 1, 0, 0, 0, 0, 1, 0, 0},
606 static const SCRIPT_PROPERTIES
*script_props
[] =
608 &scriptInformation
[0].props
, &scriptInformation
[1].props
,
609 &scriptInformation
[2].props
, &scriptInformation
[3].props
,
610 &scriptInformation
[4].props
, &scriptInformation
[5].props
,
611 &scriptInformation
[6].props
, &scriptInformation
[7].props
,
612 &scriptInformation
[8].props
, &scriptInformation
[9].props
,
613 &scriptInformation
[10].props
, &scriptInformation
[11].props
,
614 &scriptInformation
[12].props
, &scriptInformation
[13].props
,
615 &scriptInformation
[14].props
, &scriptInformation
[15].props
,
616 &scriptInformation
[16].props
, &scriptInformation
[17].props
,
617 &scriptInformation
[18].props
, &scriptInformation
[19].props
,
618 &scriptInformation
[20].props
, &scriptInformation
[21].props
,
619 &scriptInformation
[22].props
, &scriptInformation
[23].props
,
620 &scriptInformation
[24].props
, &scriptInformation
[25].props
,
621 &scriptInformation
[26].props
, &scriptInformation
[27].props
,
622 &scriptInformation
[28].props
, &scriptInformation
[29].props
,
623 &scriptInformation
[30].props
, &scriptInformation
[31].props
,
624 &scriptInformation
[32].props
, &scriptInformation
[33].props
,
625 &scriptInformation
[34].props
, &scriptInformation
[35].props
,
626 &scriptInformation
[36].props
, &scriptInformation
[37].props
,
627 &scriptInformation
[38].props
, &scriptInformation
[39].props
,
628 &scriptInformation
[40].props
, &scriptInformation
[41].props
,
629 &scriptInformation
[42].props
, &scriptInformation
[43].props
,
630 &scriptInformation
[44].props
, &scriptInformation
[45].props
,
631 &scriptInformation
[46].props
, &scriptInformation
[47].props
,
632 &scriptInformation
[48].props
, &scriptInformation
[49].props
,
633 &scriptInformation
[50].props
, &scriptInformation
[51].props
,
634 &scriptInformation
[52].props
, &scriptInformation
[53].props
,
635 &scriptInformation
[54].props
, &scriptInformation
[55].props
,
636 &scriptInformation
[56].props
, &scriptInformation
[57].props
,
637 &scriptInformation
[58].props
, &scriptInformation
[59].props
,
638 &scriptInformation
[60].props
, &scriptInformation
[61].props
,
639 &scriptInformation
[62].props
, &scriptInformation
[63].props
,
640 &scriptInformation
[64].props
, &scriptInformation
[65].props
,
641 &scriptInformation
[66].props
, &scriptInformation
[67].props
,
642 &scriptInformation
[68].props
, &scriptInformation
[69].props
,
643 &scriptInformation
[70].props
, &scriptInformation
[71].props
,
644 &scriptInformation
[72].props
, &scriptInformation
[73].props
,
645 &scriptInformation
[74].props
654 SCRIPT_VISATTR
* psva
;
670 StringGlyphs
* glyphs
;
671 SCRIPT_LOGATTR
* logattrs
;
676 static inline void *heap_alloc(SIZE_T size
)
678 return HeapAlloc(GetProcessHeap(), 0, size
);
681 static inline void *heap_alloc_zero(SIZE_T size
)
683 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, size
);
686 static inline void *heap_realloc_zero(LPVOID mem
, SIZE_T size
)
688 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, size
);
691 static inline BOOL
heap_free(LPVOID mem
)
693 return HeapFree(GetProcessHeap(), 0, mem
);
696 static inline WCHAR
get_cache_default_char(SCRIPT_CACHE
*psc
)
698 return ((ScriptCache
*)*psc
)->tm
.tmDefaultChar
;
701 static inline LONG
get_cache_height(SCRIPT_CACHE
*psc
)
703 return ((ScriptCache
*)*psc
)->tm
.tmHeight
;
706 static inline BYTE
get_cache_pitch_family(SCRIPT_CACHE
*psc
)
708 return ((ScriptCache
*)*psc
)->tm
.tmPitchAndFamily
;
711 static inline WORD
get_cache_glyph(SCRIPT_CACHE
*psc
, WCHAR c
)
713 WORD
*block
= ((ScriptCache
*)*psc
)->glyphs
[c
>> GLYPH_BLOCK_SHIFT
];
715 if (!block
) return 0;
716 return block
[c
& GLYPH_BLOCK_MASK
];
719 static inline WORD
set_cache_glyph(SCRIPT_CACHE
*psc
, WCHAR c
, WORD glyph
)
721 WORD
**block
= &((ScriptCache
*)*psc
)->glyphs
[c
>> GLYPH_BLOCK_SHIFT
];
723 if (!*block
&& !(*block
= heap_alloc_zero(sizeof(WORD
) * GLYPH_BLOCK_SIZE
))) return 0;
724 return ((*block
)[c
& GLYPH_BLOCK_MASK
] = glyph
);
727 static inline BOOL
get_cache_glyph_widths(SCRIPT_CACHE
*psc
, WORD glyph
, ABC
*abc
)
729 static const ABC nil
;
730 ABC
*block
= ((ScriptCache
*)*psc
)->widths
[glyph
>> GLYPH_BLOCK_SHIFT
];
732 if (!block
|| !memcmp(&block
[glyph
& GLYPH_BLOCK_MASK
], &nil
, sizeof(ABC
))) return FALSE
;
733 memcpy(abc
, &block
[glyph
& GLYPH_BLOCK_MASK
], sizeof(ABC
));
737 static inline BOOL
set_cache_glyph_widths(SCRIPT_CACHE
*psc
, WORD glyph
, ABC
*abc
)
739 ABC
**block
= &((ScriptCache
*)*psc
)->widths
[glyph
>> GLYPH_BLOCK_SHIFT
];
741 if (!*block
&& !(*block
= heap_alloc_zero(sizeof(ABC
) * GLYPH_BLOCK_SIZE
))) return FALSE
;
742 memcpy(&(*block
)[glyph
& GLYPH_BLOCK_MASK
], abc
, sizeof(ABC
));
746 static HRESULT
init_script_cache(const HDC hdc
, SCRIPT_CACHE
*psc
)
750 if (!psc
) return E_INVALIDARG
;
751 if (*psc
) return S_OK
;
752 if (!hdc
) return E_PENDING
;
754 if (!(sc
= heap_alloc_zero(sizeof(ScriptCache
)))) return E_OUTOFMEMORY
;
755 if (!GetTextMetricsW(hdc
, &sc
->tm
))
760 if (!GetObjectW(GetCurrentObject(hdc
, OBJ_FONT
), sizeof(LOGFONTW
), &sc
->lf
))
765 sc
->sfnt
= (GetFontData(hdc
, MS_MAKE_TAG('h','e','a','d'), 0, NULL
, 0)!=GDI_ERROR
);
767 TRACE("<- %p\n", sc
);
771 static WCHAR
mirror_char( WCHAR ch
)
773 extern const WCHAR wine_mirror_map
[];
774 return ch
+ wine_mirror_map
[wine_mirror_map
[ch
>> 8] + (ch
& 0xff)];
777 static inline DWORD
decode_surrogate_pair(LPCWSTR str
, INT index
, INT end
)
779 if (index
< end
-1 && IS_SURROGATE_PAIR(str
[index
],str
[index
+1]))
781 DWORD ch
= 0x10000 + ((str
[index
] - 0xd800) << 10) + (str
[index
+1] - 0xdc00);
782 TRACE("Surrogate Pair %x %x => %x\n",str
[index
], str
[index
+1], ch
);
788 static WORD
get_char_script( LPCWSTR str
, INT index
, INT end
, INT
*consumed
)
790 static const WCHAR latin_punc
[] = {'#','$','&','\'',',',';','<','>','?','@','\\','^','_','`','{','|','}','~', 0x00a0, 0};
797 if (str
[index
] == 0xc || str
[index
] == 0x20 || str
[index
] == 0x202f)
800 /* These punctuation are separated out as Latin punctuation */
801 if (strchrW(latin_punc
,str
[index
]))
802 return Script_Punctuation2
;
804 /* These chars are itemized as Punctuation by Windows */
805 if (str
[index
] == 0x2212 || str
[index
] == 0x2044)
806 return Script_Punctuation
;
808 GetStringTypeW(CT_CTYPE1
, &str
[index
], 1, &type
);
811 return SCRIPT_UNDEFINED
;
814 return Script_Control
;
816 ch
= decode_surrogate_pair(str
, index
, end
);
825 if (ch
< scriptRanges
[i
].rangeFirst
|| scriptRanges
[i
].script
== SCRIPT_UNDEFINED
)
828 if (ch
>= scriptRanges
[i
].rangeFirst
&& ch
<= scriptRanges
[i
].rangeLast
)
830 if (scriptRanges
[i
].numericScript
&& type
& C1_DIGIT
)
831 return scriptRanges
[i
].numericScript
;
832 if (scriptRanges
[i
].punctScript
&& type
& C1_PUNCT
)
833 return scriptRanges
[i
].punctScript
;
834 return scriptRanges
[i
].script
;
839 return SCRIPT_UNDEFINED
;
842 /***********************************************************************
846 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
850 case DLL_PROCESS_ATTACH
:
851 DisableThreadLibraryCalls(hInstDLL
);
853 case DLL_PROCESS_DETACH
:
859 /***********************************************************************
860 * ScriptFreeCache (USP10.@)
862 * Free a script cache.
865 * psc [I/O] Script cache.
869 * Failure: Non-zero HRESULT value.
871 HRESULT WINAPI
ScriptFreeCache(SCRIPT_CACHE
*psc
)
878 for (i
= 0; i
< GLYPH_MAX
/ GLYPH_BLOCK_SIZE
; i
++)
880 heap_free(((ScriptCache
*)*psc
)->glyphs
[i
]);
881 heap_free(((ScriptCache
*)*psc
)->widths
[i
]);
883 heap_free(((ScriptCache
*)*psc
)->GSUB_Table
);
884 heap_free(((ScriptCache
*)*psc
)->GDEF_Table
);
885 heap_free(((ScriptCache
*)*psc
)->CMAP_Table
);
886 heap_free(((ScriptCache
*)*psc
)->features
);
893 /***********************************************************************
894 * ScriptGetProperties (USP10.@)
896 * Retrieve a list of script properties.
899 * props [I] Pointer to an array of SCRIPT_PROPERTIES pointers.
900 * num [I] Pointer to the number of scripts.
904 * Failure: Non-zero HRESULT value.
907 * Behaviour matches WinXP.
909 HRESULT WINAPI
ScriptGetProperties(const SCRIPT_PROPERTIES
***props
, int *num
)
911 TRACE("(%p,%p)\n", props
, num
);
913 if (!props
&& !num
) return E_INVALIDARG
;
915 if (num
) *num
= sizeof(script_props
)/sizeof(script_props
[0]);
916 if (props
) *props
= script_props
;
921 /***********************************************************************
922 * ScriptGetFontProperties (USP10.@)
924 * Get information on special glyphs.
927 * hdc [I] Device context.
928 * psc [I/O] Opaque pointer to a script cache.
929 * sfp [O] Font properties structure.
931 HRESULT WINAPI
ScriptGetFontProperties(HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_FONTPROPERTIES
*sfp
)
935 TRACE("%p,%p,%p\n", hdc
, psc
, sfp
);
937 if (!sfp
) return E_INVALIDARG
;
938 if ((hr
= init_script_cache(hdc
, psc
)) != S_OK
) return hr
;
940 if (sfp
->cBytes
!= sizeof(SCRIPT_FONTPROPERTIES
))
943 /* return something sensible? */
945 sfp
->wgDefault
= get_cache_default_char(psc
);
947 sfp
->wgKashida
= 0xffff;
948 sfp
->iKashidaWidth
= 0;
953 /***********************************************************************
954 * ScriptRecordDigitSubstitution (USP10.@)
956 * Record digit substitution settings for a given locale.
959 * locale [I] Locale identifier.
960 * sds [I] Structure to record substitution settings.
964 * Failure: E_POINTER if sds is NULL, E_INVALIDARG otherwise.
967 * http://blogs.msdn.com/michkap/archive/2006/02/22/536877.aspx
969 HRESULT WINAPI
ScriptRecordDigitSubstitution(LCID locale
, SCRIPT_DIGITSUBSTITUTE
*sds
)
973 TRACE("0x%x, %p\n", locale
, sds
);
975 /* This implementation appears to be correct for all languages, but it's
976 * not clear if sds->DigitSubstitute is ever set to anything except
977 * CONTEXT or NONE in reality */
979 if (!sds
) return E_POINTER
;
981 locale
= ConvertDefaultLocale(locale
);
983 if (!IsValidLocale(locale
, LCID_INSTALLED
))
986 plgid
= PRIMARYLANGID(LANGIDFROMLCID(locale
));
987 sds
->TraditionalDigitLanguage
= plgid
;
989 if (plgid
== LANG_ARABIC
|| plgid
== LANG_FARSI
)
990 sds
->NationalDigitLanguage
= plgid
;
992 sds
->NationalDigitLanguage
= LANG_ENGLISH
;
994 if (!GetLocaleInfoW(locale
, LOCALE_IDIGITSUBSTITUTION
| LOCALE_RETURN_NUMBER
,
995 (LPWSTR
)&sub
, sizeof(sub
)/sizeof(WCHAR
))) return E_INVALIDARG
;
1000 if (plgid
== LANG_ARABIC
|| plgid
== LANG_FARSI
)
1001 sds
->DigitSubstitute
= SCRIPT_DIGITSUBSTITUTE_CONTEXT
;
1003 sds
->DigitSubstitute
= SCRIPT_DIGITSUBSTITUTE_NONE
;
1006 sds
->DigitSubstitute
= SCRIPT_DIGITSUBSTITUTE_NONE
;
1009 sds
->DigitSubstitute
= SCRIPT_DIGITSUBSTITUTE_NATIONAL
;
1012 sds
->DigitSubstitute
= SCRIPT_DIGITSUBSTITUTE_TRADITIONAL
;
1016 sds
->dwReserved
= 0;
1020 /***********************************************************************
1021 * ScriptApplyDigitSubstitution (USP10.@)
1023 * Apply digit substitution settings.
1026 * sds [I] Structure with recorded substitution settings.
1027 * sc [I] Script control structure.
1028 * ss [I] Script state structure.
1032 * Failure: E_INVALIDARG if sds is invalid. Otherwise an HRESULT.
1034 HRESULT WINAPI
ScriptApplyDigitSubstitution(const SCRIPT_DIGITSUBSTITUTE
*sds
,
1035 SCRIPT_CONTROL
*sc
, SCRIPT_STATE
*ss
)
1037 SCRIPT_DIGITSUBSTITUTE psds
;
1039 TRACE("%p, %p, %p\n", sds
, sc
, ss
);
1041 if (!sc
|| !ss
) return E_POINTER
;
1045 if (ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT
, &psds
) != S_OK
)
1046 return E_INVALIDARG
;
1049 sc
->uDefaultLanguage
= LANG_ENGLISH
;
1050 sc
->fContextDigits
= 0;
1051 ss
->fDigitSubstitute
= 0;
1053 switch (sds
->DigitSubstitute
) {
1054 case SCRIPT_DIGITSUBSTITUTE_CONTEXT
:
1055 case SCRIPT_DIGITSUBSTITUTE_NATIONAL
:
1056 case SCRIPT_DIGITSUBSTITUTE_NONE
:
1057 case SCRIPT_DIGITSUBSTITUTE_TRADITIONAL
:
1060 return E_INVALIDARG
;
1064 static inline BOOL
is_indic(WORD script
)
1066 return (script
>= Script_Devanagari
&& script
<= Script_Malayalam_Numeric
);
1069 static inline WORD
base_indic(WORD script
)
1073 case Script_Devanagari
:
1074 case Script_Devanagari_Numeric
: return Script_Devanagari
;
1075 case Script_Bengali
:
1076 case Script_Bengali_Numeric
:
1077 case Script_Bengali_Currency
: return Script_Bengali
;
1078 case Script_Gurmukhi
:
1079 case Script_Gurmukhi_Numeric
: return Script_Gurmukhi
;
1080 case Script_Gujarati
:
1081 case Script_Gujarati_Numeric
:
1082 case Script_Gujarati_Currency
: return Script_Gujarati
;
1084 case Script_Oriya_Numeric
: return Script_Oriya
;
1086 case Script_Tamil_Numeric
: return Script_Tamil
;
1088 case Script_Telugu_Numeric
: return Script_Telugu
;
1089 case Script_Kannada
:
1090 case Script_Kannada_Numeric
: return Script_Kannada
;
1091 case Script_Malayalam
:
1092 case Script_Malayalam_Numeric
: return Script_Malayalam
;
1098 /***********************************************************************
1099 * ScriptItemizeOpenType (USP10.@)
1101 * Split a Unicode string into shapeable parts.
1104 * pwcInChars [I] String to split.
1105 * cInChars [I] Number of characters in pwcInChars.
1106 * cMaxItems [I] Maximum number of items to return.
1107 * psControl [I] Pointer to a SCRIPT_CONTROL structure.
1108 * psState [I] Pointer to a SCRIPT_STATE structure.
1109 * pItems [O] Buffer to receive SCRIPT_ITEM structures.
1110 * pScriptTags [O] Buffer to receive OPENTYPE_TAGs.
1111 * pcItems [O] Number of script items returned.
1115 * Failure: Non-zero HRESULT value.
1117 HRESULT WINAPI
ScriptItemizeOpenType(const WCHAR
*pwcInChars
, int cInChars
, int cMaxItems
,
1118 const SCRIPT_CONTROL
*psControl
, const SCRIPT_STATE
*psState
,
1119 SCRIPT_ITEM
*pItems
, OPENTYPE_TAG
*pScriptTags
, int *pcItems
)
1122 #define Numeric_space 0x0020
1126 int cnt
= 0, index
= 0, str
= 0;
1127 int New_Script
= -1;
1129 WORD
*levels
= NULL
;
1130 WORD
*strength
= NULL
;
1131 WORD
*scripts
= NULL
;
1134 WORD last_indic
= -1;
1136 BOOL forceLevels
= FALSE
;
1139 TRACE("%s,%d,%d,%p,%p,%p,%p\n", debugstr_wn(pwcInChars
, cInChars
), cInChars
, cMaxItems
,
1140 psControl
, psState
, pItems
, pcItems
);
1142 if (!pwcInChars
|| !cInChars
|| !pItems
|| cMaxItems
< 2)
1143 return E_INVALIDARG
;
1145 scripts
= heap_alloc(cInChars
* sizeof(WORD
));
1147 return E_OUTOFMEMORY
;
1149 for (i
= 0; i
< cInChars
; i
++)
1153 scripts
[i
] = get_char_script(pwcInChars
,i
,cInChars
,&consumed
);
1158 scripts
[i
] = scripts
[i
-1];
1161 /* Devanagari danda (U+0964) and double danda (U+0965) are used for
1162 all Indic scripts */
1163 if ((pwcInChars
[i
] == 0x964 || pwcInChars
[i
] ==0x965) && last_indic
> 0)
1164 scripts
[i
] = last_indic
;
1165 else if (is_indic(scripts
[i
]))
1166 last_indic
= base_indic(scripts
[i
]);
1168 /* Some unicode points (Zero Width Space U+200B -
1169 Right-to-Left Mark U+200F) will force us into bidi mode */
1170 if (!forceLevels
&& pwcInChars
[i
] >= 0x200B && pwcInChars
[i
] <= 0x200F)
1173 /* Diacritical marks merge with other scripts */
1174 if (scripts
[i
] == Script_Diacritical
&& i
> 0)
1175 scripts
[i
] = scripts
[i
-1];
1178 for (i
= 0; i
< cInChars
; i
++)
1180 /* Joiners get merged preferencially right */
1181 if (i
> 0 && (pwcInChars
[i
] == ZWJ
|| pwcInChars
[i
] == ZWNJ
))
1184 if (i
+1 == cInChars
)
1185 scripts
[i
] = scripts
[i
-1];
1188 for (j
= i
+1; j
< cInChars
; j
++)
1190 if (pwcInChars
[j
] != ZWJ
&& pwcInChars
[j
] != ZWNJ
&& pwcInChars
[j
] != Numeric_space
)
1192 scripts
[i
] = scripts
[j
];
1200 if (psState
&& psControl
)
1202 levels
= heap_alloc_zero(cInChars
* sizeof(WORD
));
1206 return E_OUTOFMEMORY
;
1209 BIDI_DetermineLevels(pwcInChars
, cInChars
, psState
, psControl
, levels
);
1210 baselevel
= levels
[0];
1211 for (i
= 0; i
< cInChars
; i
++)
1212 if (levels
[i
]!=levels
[0])
1214 if (i
>= cInChars
&& !odd(baselevel
) && !odd(psState
->uBidiLevel
) && !forceLevels
)
1221 BOOL inNumber
= FALSE
;
1222 static WCHAR math_punc
[] = {'#','$','%','+',',','-','.','/',':',0x2212, 0x2044, 0x00a0,0};
1224 strength
= heap_alloc_zero(cInChars
* sizeof(WORD
));
1229 return E_OUTOFMEMORY
;
1231 BIDI_GetStrengths(pwcInChars
, cInChars
, psControl
, strength
);
1233 /* We currently mis-level leading Diacriticals */
1234 if (scripts
[0] == Script_Diacritical
)
1235 for (i
= 0; i
< cInChars
&& scripts
[0] == Script_Diacritical
; i
++)
1237 levels
[i
] = odd(levels
[i
])?levels
[i
]+1:levels
[i
];
1238 strength
[i
] = BIDI_STRONG
;
1241 for (i
= 0; i
< cInChars
; i
++)
1243 /* Script_Numeric and select puncuation at level 0 get bumped to level 2 */
1244 if ((levels
[i
] == 0 || (odd(psState
->uBidiLevel
) && levels
[i
] == psState
->uBidiLevel
+1)) && inNumber
&& strchrW(math_punc
,pwcInChars
[i
]))
1246 scripts
[i
] = Script_Numeric
;
1249 else if ((levels
[i
] == 0 || (odd(psState
->uBidiLevel
) && levels
[i
] == psState
->uBidiLevel
+1)) && scripts
[i
] == Script_Numeric
)
1257 /* Joiners get merged preferencially right */
1258 if (i
> 0 && (pwcInChars
[i
] == ZWJ
|| pwcInChars
[i
] == ZWNJ
))
1261 if (i
+1 == cInChars
&& levels
[i
-1] == levels
[i
])
1262 strength
[i
] = strength
[i
-1];
1264 for (j
= i
+1; j
< cInChars
&& levels
[i
] == levels
[j
]; j
++)
1265 if (pwcInChars
[j
] != ZWJ
&& pwcInChars
[j
] != ZWNJ
&& pwcInChars
[j
] != Numeric_space
)
1267 strength
[i
] = strength
[j
];
1272 if (psControl
->fMergeNeutralItems
)
1274 /* Merge the neutrals */
1275 for (i
= 0; i
< cInChars
; i
++)
1277 if (strength
[i
] == BIDI_NEUTRAL
|| strength
[i
] == BIDI_WEAK
)
1280 for (j
= i
; j
> 0; j
--)
1282 if (levels
[i
] != levels
[j
])
1284 if ((strength
[j
] == BIDI_STRONG
) || (strength
[i
] == BIDI_NEUTRAL
&& strength
[j
] == BIDI_WEAK
))
1286 scripts
[i
] = scripts
[j
];
1287 strength
[i
] = strength
[j
];
1292 /* Try going the other way */
1293 if (strength
[i
] == BIDI_NEUTRAL
|| strength
[i
] == BIDI_WEAK
)
1296 for (j
= i
; j
< cInChars
; j
++)
1298 if (levels
[i
] != levels
[j
])
1300 if ((strength
[j
] == BIDI_STRONG
) || (strength
[i
] == BIDI_NEUTRAL
&& strength
[j
] == BIDI_WEAK
))
1302 scripts
[i
] = scripts
[j
];
1303 strength
[i
] = strength
[j
];
1313 while ((!levels
|| (levels
&& levels
[cnt
+1] == levels
[0])) && (pwcInChars
[cnt
] == Numeric_space
) && cnt
< cInChars
)
1316 if (cnt
== cInChars
) /* All Spaces */
1319 New_Script
= scripts
[cnt
];
1322 pItems
[index
].iCharPos
= 0;
1323 pItems
[index
].a
= scriptInformation
[scripts
[cnt
]].a
;
1324 pScriptTags
[index
] = scriptInformation
[scripts
[cnt
]].scriptTag
;
1326 if (strength
&& strength
[cnt
] == BIDI_STRONG
)
1327 str
= strength
[cnt
];
1335 if (strength
[cnt
] == BIDI_STRONG
)
1336 layoutRTL
= (odd(levels
[cnt
]))?1:0;
1338 layoutRTL
= (psState
->uBidiLevel
|| odd(levels
[cnt
]))?1:0;
1339 pItems
[index
].a
.fRTL
= odd(levels
[cnt
]);
1340 pItems
[index
].a
.fLayoutRTL
= layoutRTL
;
1341 pItems
[index
].a
.s
.uBidiLevel
= levels
[cnt
];
1343 else if (!pItems
[index
].a
.s
.uBidiLevel
)
1345 layoutRTL
= (odd(baselevel
))?1:0;
1346 pItems
[index
].a
.s
.uBidiLevel
= baselevel
;
1347 pItems
[index
].a
.fLayoutRTL
= odd(baselevel
);
1348 pItems
[index
].a
.fRTL
= odd(baselevel
);
1351 TRACE("New_Level=%i New_Strength=%i New_Script=%d, eScript=%d index=%d cnt=%d iCharPos=%d\n",
1352 levels
?levels
[cnt
]:-1, str
, New_Script
, pItems
[index
].a
.eScript
, index
, cnt
,
1353 pItems
[index
].iCharPos
);
1355 for (cnt
=1; cnt
< cInChars
; cnt
++)
1357 if(pwcInChars
[cnt
] != Numeric_space
)
1358 New_Script
= scripts
[cnt
];
1362 while (cnt
+ j
< cInChars
- 1 && pwcInChars
[cnt
+j
] == Numeric_space
&& levels
[cnt
] == levels
[cnt
+j
])
1364 if (cnt
+ j
< cInChars
&& levels
[cnt
] == levels
[cnt
+j
])
1365 New_Script
= scripts
[cnt
+j
];
1367 New_Script
= scripts
[cnt
];
1371 /* merge space strengths*/
1372 if (strength
&& strength
[cnt
] == BIDI_STRONG
&& str
!= BIDI_STRONG
&& New_Script
== pItems
[index
].a
.eScript
)
1375 if (strength
&& strength
[cnt
] == BIDI_NEUTRAL
&& str
== BIDI_STRONG
&& pwcInChars
[cnt
] != Numeric_space
&& New_Script
== pItems
[index
].a
.eScript
)
1378 /* changes in level */
1379 if (levels
&& (levels
[cnt
] != pItems
[index
].a
.s
.uBidiLevel
))
1381 TRACE("Level break(%i/%i)\n",pItems
[index
].a
.s
.uBidiLevel
,levels
[cnt
]);
1384 /* changes in strength */
1385 else if (strength
&& pwcInChars
[cnt
] != Numeric_space
&& str
!= strength
[cnt
])
1387 TRACE("Strength break (%i/%i)\n",str
,strength
[cnt
]);
1390 /* changes in script */
1391 else if (((pwcInChars
[cnt
] != Numeric_space
) && (New_Script
!= -1) && (New_Script
!= pItems
[index
].a
.eScript
)) || (New_Script
== Script_Control
))
1393 TRACE("Script break(%i/%i)\n",pItems
[index
].a
.eScript
,New_Script
);
1397 if (!new_run
&& strength
&& str
== BIDI_STRONG
)
1399 layoutRTL
= odd(levels
[cnt
])?1:0;
1400 pItems
[index
].a
.fLayoutRTL
= layoutRTL
;
1405 TRACE("New_Level = %i, New_Strength = %i, New_Script=%d, eScript=%d\n", levels
?levels
[cnt
]:-1, strength
?strength
[cnt
]:str
, New_Script
, pItems
[index
].a
.eScript
);
1408 if (index
+1 > cMaxItems
)
1409 return E_OUTOFMEMORY
;
1412 str
= strength
[cnt
];
1414 pItems
[index
].iCharPos
= cnt
;
1415 memset(&pItems
[index
].a
, 0, sizeof(SCRIPT_ANALYSIS
));
1417 pItems
[index
].a
= scriptInformation
[New_Script
].a
;
1418 pScriptTags
[index
] = scriptInformation
[New_Script
].scriptTag
;
1421 if (levels
[cnt
] == 0)
1424 layoutRTL
= (layoutRTL
|| odd(levels
[cnt
]))?1:0;
1425 pItems
[index
].a
.fRTL
= odd(levels
[cnt
]);
1426 pItems
[index
].a
.fLayoutRTL
= layoutRTL
;
1427 pItems
[index
].a
.s
.uBidiLevel
= levels
[cnt
];
1429 else if (!pItems
[index
].a
.s
.uBidiLevel
)
1431 pItems
[index
].a
.s
.uBidiLevel
= baselevel
;
1432 pItems
[index
].a
.fLayoutRTL
= layoutRTL
;
1433 pItems
[index
].a
.fRTL
= odd(baselevel
);
1436 TRACE("index=%d cnt=%d iCharPos=%d\n", index
, cnt
, pItems
[index
].iCharPos
);
1440 /* While not strictly necessary according to the spec, make sure the n+1
1441 * item is set up to prevent random behaviour if the caller erroneously
1442 * checks the n+1 structure */
1444 memset(&pItems
[index
].a
, 0, sizeof(SCRIPT_ANALYSIS
));
1446 TRACE("index=%d cnt=%d iCharPos=%d\n", index
, cnt
, pItems
[index
].iCharPos
);
1448 /* Set one SCRIPT_STATE item being returned */
1449 if (index
+ 1 > cMaxItems
) return E_OUTOFMEMORY
;
1450 if (pcItems
) *pcItems
= index
;
1452 /* Set SCRIPT_ITEM */
1453 pItems
[index
].iCharPos
= cnt
; /* the last item contains the ptr to the lastchar */
1455 heap_free(strength
);
1460 /***********************************************************************
1461 * ScriptItemize (USP10.@)
1463 * Split a Unicode string into shapeable parts.
1466 * pwcInChars [I] String to split.
1467 * cInChars [I] Number of characters in pwcInChars.
1468 * cMaxItems [I] Maximum number of items to return.
1469 * psControl [I] Pointer to a SCRIPT_CONTROL structure.
1470 * psState [I] Pointer to a SCRIPT_STATE structure.
1471 * pItems [O] Buffer to receive SCRIPT_ITEM structures.
1472 * pcItems [O] Number of script items returned.
1476 * Failure: Non-zero HRESULT value.
1478 HRESULT WINAPI
ScriptItemize(const WCHAR
*pwcInChars
, int cInChars
, int cMaxItems
,
1479 const SCRIPT_CONTROL
*psControl
, const SCRIPT_STATE
*psState
,
1480 SCRIPT_ITEM
*pItems
, int *pcItems
)
1482 OPENTYPE_TAG
*discarded_tags
;
1485 discarded_tags
= heap_alloc(cMaxItems
* sizeof(OPENTYPE_TAG
));
1486 if (!discarded_tags
)
1487 return E_OUTOFMEMORY
;
1488 res
= ScriptItemizeOpenType(pwcInChars
, cInChars
, cMaxItems
, psControl
, psState
, pItems
, discarded_tags
, pcItems
);
1489 heap_free(discarded_tags
);
1493 static inline int getGivenTabWidth(ScriptCache
*psc
, SCRIPT_TABDEF
*pTabdef
, int charPos
, int current_x
)
1497 INT
*lpTabPos
= NULL
;
1502 lpTabPos
= pTabdef
->pTabStops
;
1504 if (pTabdef
&& pTabdef
->iTabOrigin
)
1506 if (pTabdef
->iScale
)
1507 nTabOrg
= (pTabdef
->iTabOrigin
* pTabdef
->iScale
)/4;
1509 nTabOrg
= pTabdef
->iTabOrigin
* psc
->tm
.tmAveCharWidth
;
1513 cTabStops
= pTabdef
->cTabStops
;
1517 if (pTabdef
->iScale
)
1518 defWidth
= ((pTabdef
->pTabStops
[0])*pTabdef
->iScale
) / 4;
1520 defWidth
= (pTabdef
->pTabStops
[0])*psc
->tm
.tmAveCharWidth
;
1524 defWidth
= 8 * psc
->tm
.tmAveCharWidth
;
1526 for (; cTabStops
>0 ; lpTabPos
++, cTabStops
--)
1528 int position
= *lpTabPos
;
1530 position
= -1 * position
;
1531 if (pTabdef
->iScale
)
1532 position
= (position
* pTabdef
->iScale
) / 4;
1534 position
= position
* psc
->tm
.tmAveCharWidth
;
1536 if( nTabOrg
+ position
> current_x
)
1540 /* a left aligned tab */
1541 x
= (nTabOrg
+ *lpTabPos
) - current_x
;
1546 FIXME("Negative tabstop\n");
1551 if ((!cTabStops
) && (defWidth
> 0))
1552 x
=((((current_x
- nTabOrg
) / defWidth
)+1) * defWidth
) - current_x
;
1553 else if ((!cTabStops
) && (defWidth
< 0))
1554 FIXME("TODO: Negative defWidth\n");
1559 /***********************************************************************
1560 * Helper function for ScriptStringAnalyse
1562 static BOOL
requires_fallback(HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
,
1563 const WCHAR
*pwcInChars
, int cChars
)
1565 /* FIXME: When to properly fallback is still a bit of a mystery */
1568 if (psa
->fNoGlyphIndex
)
1571 if (init_script_cache(hdc
, psc
) != S_OK
)
1574 if (SHAPE_CheckFontForRequiredFeatures(hdc
, (ScriptCache
*)*psc
, psa
) != S_OK
)
1577 glyphs
= heap_alloc(sizeof(WORD
) * cChars
);
1580 if (ScriptGetCMap(hdc
, psc
, pwcInChars
, cChars
, 0, glyphs
) != S_OK
)
1590 static void find_fallback_font(DWORD scriptid
, LPWSTR FaceName
)
1594 if (!RegOpenKeyA(HKEY_CURRENT_USER
, "Software\\Wine\\Uniscribe\\Fallback", &hkey
))
1596 static const WCHAR szFmt
[] = {'%','x',0};
1598 DWORD count
= LF_FACESIZE
* sizeof(WCHAR
);
1601 sprintfW(value
, szFmt
, scriptInformation
[scriptid
].scriptTag
);
1602 if (RegQueryValueExW(hkey
, value
, 0, &type
, (LPBYTE
)FaceName
, &count
))
1603 lstrcpyW(FaceName
,scriptInformation
[scriptid
].fallbackFont
);
1607 lstrcpyW(FaceName
,scriptInformation
[scriptid
].fallbackFont
);
1610 /***********************************************************************
1611 * ScriptStringAnalyse (USP10.@)
1614 HRESULT WINAPI
ScriptStringAnalyse(HDC hdc
, const void *pString
, int cString
,
1615 int cGlyphs
, int iCharset
, DWORD dwFlags
,
1616 int iReqWidth
, SCRIPT_CONTROL
*psControl
,
1617 SCRIPT_STATE
*psState
, const int *piDx
,
1618 SCRIPT_TABDEF
*pTabdef
, const BYTE
*pbInClass
,
1619 SCRIPT_STRING_ANALYSIS
*pssa
)
1621 HRESULT hr
= E_OUTOFMEMORY
;
1622 StringAnalysis
*analysis
= NULL
;
1623 SCRIPT_CONTROL sControl
;
1624 SCRIPT_STATE sState
;
1625 int i
, num_items
= 255;
1627 WCHAR
*iString
= NULL
;
1629 TRACE("(%p,%p,%d,%d,%d,0x%x,%d,%p,%p,%p,%p,%p,%p)\n",
1630 hdc
, pString
, cString
, cGlyphs
, iCharset
, dwFlags
, iReqWidth
,
1631 psControl
, psState
, piDx
, pTabdef
, pbInClass
, pssa
);
1635 FIXME("Only Unicode strings are supported\n");
1636 return E_INVALIDARG
;
1638 if (cString
< 1 || !pString
) return E_INVALIDARG
;
1639 if ((dwFlags
& SSA_GLYPHS
) && !hdc
) return E_PENDING
;
1641 if (!(analysis
= heap_alloc_zero(sizeof(StringAnalysis
)))) return E_OUTOFMEMORY
;
1642 if (!(analysis
->pItem
= heap_alloc_zero(num_items
* sizeof(SCRIPT_ITEM
) + 1))) goto error
;
1644 /* FIXME: handle clipping */
1645 analysis
->clip_len
= cString
;
1646 analysis
->hdc
= hdc
;
1647 analysis
->dwFlags
= dwFlags
;
1652 memset(&sState
, 0, sizeof(SCRIPT_STATE
));
1655 sControl
= *psControl
;
1657 memset(&sControl
, 0, sizeof(SCRIPT_CONTROL
));
1659 if (dwFlags
& SSA_PASSWORD
)
1661 iString
= heap_alloc(sizeof(WCHAR
)*cString
);
1667 for (i
= 0; i
< cString
; i
++)
1668 iString
[i
] = *((const WCHAR
*)pString
);
1672 hr
= ScriptItemize(pString
, cString
, num_items
, &sControl
, &sState
, analysis
->pItem
,
1673 &analysis
->numItems
);
1675 while (hr
== E_OUTOFMEMORY
)
1680 if (!(tmp
= heap_realloc_zero(analysis
->pItem
, num_items
* sizeof(SCRIPT_ITEM
) + 1)))
1683 analysis
->pItem
= tmp
;
1684 hr
= ScriptItemize(pString
, cString
, num_items
, psControl
, psState
, analysis
->pItem
,
1685 &analysis
->numItems
);
1687 if (hr
!= S_OK
) goto error
;
1689 /* set back to out of memory for default goto error behaviour */
1692 if (dwFlags
& SSA_BREAK
)
1694 if ((analysis
->logattrs
= heap_alloc(sizeof(SCRIPT_LOGATTR
) * cString
)))
1696 for (i
= 0; i
< analysis
->numItems
; i
++)
1697 ScriptBreak(&((LPWSTR
)pString
)[analysis
->pItem
[i
].iCharPos
], analysis
->pItem
[i
+1].iCharPos
- analysis
->pItem
[i
].iCharPos
, &analysis
->pItem
[i
].a
, &analysis
->logattrs
[analysis
->pItem
[i
].iCharPos
]);
1703 if (!(analysis
->logical2visual
= heap_alloc_zero(sizeof(int) * analysis
->numItems
)))
1705 if (!(BidiLevel
= heap_alloc_zero(analysis
->numItems
)))
1708 if (dwFlags
& SSA_GLYPHS
)
1711 if (!(analysis
->glyphs
= heap_alloc_zero(sizeof(StringGlyphs
) * analysis
->numItems
)))
1713 heap_free(BidiLevel
);
1717 for (i
= 0; i
< analysis
->numItems
; i
++)
1719 SCRIPT_CACHE
*sc
= (SCRIPT_CACHE
*)&analysis
->glyphs
[i
].sc
;
1720 int cChar
= analysis
->pItem
[i
+1].iCharPos
- analysis
->pItem
[i
].iCharPos
;
1721 int numGlyphs
= 1.5 * cChar
+ 16;
1722 WORD
*glyphs
= heap_alloc_zero(sizeof(WORD
) * numGlyphs
);
1723 WORD
*pwLogClust
= heap_alloc_zero(sizeof(WORD
) * cChar
);
1724 int *piAdvance
= heap_alloc_zero(sizeof(int) * numGlyphs
);
1725 SCRIPT_VISATTR
*psva
= heap_alloc_zero(sizeof(SCRIPT_VISATTR
) * numGlyphs
);
1726 GOFFSET
*pGoffset
= heap_alloc_zero(sizeof(GOFFSET
) * numGlyphs
);
1727 ABC
*abc
= heap_alloc_zero(sizeof(ABC
));
1728 int numGlyphsReturned
;
1729 HFONT originalFont
= 0x0;
1731 /* FIXME: non unicode strings */
1732 const WCHAR
* pStr
= (const WCHAR
*)pString
;
1733 analysis
->glyphs
[i
].fallbackFont
= NULL
;
1735 if (!glyphs
|| !pwLogClust
|| !piAdvance
|| !psva
|| !pGoffset
|| !abc
)
1737 heap_free (BidiLevel
);
1739 heap_free (pwLogClust
);
1740 heap_free (piAdvance
);
1742 heap_free (pGoffset
);
1748 if ((dwFlags
& SSA_FALLBACK
) && requires_fallback(hdc
, sc
, &analysis
->pItem
[i
].a
, &pStr
[analysis
->pItem
[i
].iCharPos
], cChar
))
1751 GetObjectW(GetCurrentObject(hdc
, OBJ_FONT
), sizeof(lf
), & lf
);
1752 lf
.lfCharSet
= scriptInformation
[analysis
->pItem
[i
].a
.eScript
].props
.bCharSet
;
1753 lf
.lfFaceName
[0] = 0;
1754 find_fallback_font(analysis
->pItem
[i
].a
.eScript
, lf
.lfFaceName
);
1755 if (lf
.lfFaceName
[0])
1757 analysis
->glyphs
[i
].fallbackFont
= CreateFontIndirectW(&lf
);
1758 if (analysis
->glyphs
[i
].fallbackFont
)
1760 ScriptFreeCache(sc
);
1761 originalFont
= SelectObject(hdc
, analysis
->glyphs
[i
].fallbackFont
);
1766 hr
= ScriptShape(hdc
, sc
, &pStr
[analysis
->pItem
[i
].iCharPos
],
1767 cChar
, numGlyphs
, &analysis
->pItem
[i
].a
,
1768 glyphs
, pwLogClust
, psva
, &numGlyphsReturned
);
1769 hr
= ScriptPlace(hdc
, sc
, glyphs
, numGlyphsReturned
, psva
, &analysis
->pItem
[i
].a
,
1770 piAdvance
, pGoffset
, abc
);
1772 SelectObject(hdc
,originalFont
);
1774 if (dwFlags
& SSA_TAB
)
1777 for (tabi
= 0; tabi
< cChar
; tabi
++)
1779 if (pStr
[analysis
->pItem
[i
].iCharPos
+tabi
] == 0x0009)
1780 piAdvance
[tabi
] = getGivenTabWidth(analysis
->glyphs
[i
].sc
, pTabdef
, analysis
->pItem
[i
].iCharPos
+tabi
, tab_x
);
1781 tab_x
+=piAdvance
[tabi
];
1785 analysis
->glyphs
[i
].numGlyphs
= numGlyphsReturned
;
1786 analysis
->glyphs
[i
].glyphs
= glyphs
;
1787 analysis
->glyphs
[i
].pwLogClust
= pwLogClust
;
1788 analysis
->glyphs
[i
].piAdvance
= piAdvance
;
1789 analysis
->glyphs
[i
].psva
= psva
;
1790 analysis
->glyphs
[i
].pGoffset
= pGoffset
;
1791 analysis
->glyphs
[i
].abc
= abc
;
1792 analysis
->glyphs
[i
].iMaxPosX
= -1;
1794 BidiLevel
[i
] = analysis
->pItem
[i
].a
.s
.uBidiLevel
;
1799 for (i
= 0; i
< analysis
->numItems
; i
++)
1800 BidiLevel
[i
] = analysis
->pItem
[i
].a
.s
.uBidiLevel
;
1803 ScriptLayout(analysis
->numItems
, BidiLevel
, NULL
, analysis
->logical2visual
);
1804 heap_free(BidiLevel
);
1812 heap_free(analysis
->glyphs
);
1813 heap_free(analysis
->logattrs
);
1814 heap_free(analysis
->pItem
);
1815 heap_free(analysis
->logical2visual
);
1816 heap_free(analysis
);
1820 static inline BOOL
does_glyph_start_cluster(const SCRIPT_VISATTR
*pva
, const WORD
*pwLogClust
, int cChars
, int glyph
, int direction
)
1824 if (pva
[glyph
].fClusterStart
)
1826 for (i
= 0; i
< cChars
; i
++)
1827 if (pwLogClust
[i
] == glyph
) break;
1835 static HRESULT
SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa
,
1846 StringAnalysis
*analysis
;
1849 COLORREF BkColor
= 0x0;
1850 COLORREF TextColor
= 0x0;
1852 INT runStart
, runEnd
;
1853 INT iGlyph
, cGlyphs
;
1854 HFONT oldFont
= 0x0;
1856 TRACE("(%p,%d,%d,%d,%d,%d, 0x%1x, %d, %d)\n",
1857 ssa
, iX
, iY
, iItem
, cStart
, cEnd
, uOptions
, fSelected
, fDisabled
);
1859 if (!(analysis
= ssa
)) return E_INVALIDARG
;
1861 if ((cStart
>= 0 && analysis
->pItem
[iItem
+1].iCharPos
<= cStart
) ||
1862 (cEnd
>= 0 && analysis
->pItem
[iItem
].iCharPos
>= cEnd
))
1867 BkMode
= GetBkMode(analysis
->hdc
);
1868 SetBkMode( analysis
->hdc
, OPAQUE
);
1869 BkColor
= GetBkColor(analysis
->hdc
);
1870 SetBkColor(analysis
->hdc
, GetSysColor(COLOR_HIGHLIGHT
));
1873 TextColor
= GetTextColor(analysis
->hdc
);
1874 SetTextColor(analysis
->hdc
, GetSysColor(COLOR_HIGHLIGHTTEXT
));
1877 if (analysis
->glyphs
[iItem
].fallbackFont
)
1878 oldFont
= SelectObject(analysis
->hdc
, analysis
->glyphs
[iItem
].fallbackFont
);
1880 if (cStart
>= 0 && analysis
->pItem
[iItem
+1].iCharPos
> cStart
&& analysis
->pItem
[iItem
].iCharPos
<= cStart
)
1881 runStart
= cStart
- analysis
->pItem
[iItem
].iCharPos
;
1884 if (cEnd
>= 0 && analysis
->pItem
[iItem
+1].iCharPos
> cEnd
&& analysis
->pItem
[iItem
].iCharPos
<= cEnd
)
1885 runEnd
= (cEnd
-1) - analysis
->pItem
[iItem
].iCharPos
;
1887 runEnd
= (analysis
->pItem
[iItem
+1].iCharPos
- analysis
->pItem
[iItem
].iCharPos
) - 1;
1889 if (analysis
->pItem
[iItem
].a
.fRTL
)
1891 if (cEnd
>= 0 && cEnd
< analysis
->pItem
[iItem
+1].iCharPos
)
1892 ScriptStringCPtoX(ssa
, cEnd
, FALSE
, &off_x
);
1894 ScriptStringCPtoX(ssa
, analysis
->pItem
[iItem
+1].iCharPos
-1, TRUE
, &off_x
);
1898 if (cStart
>=0 && runStart
)
1899 ScriptStringCPtoX(ssa
, cStart
, FALSE
, &off_x
);
1901 ScriptStringCPtoX(ssa
, analysis
->pItem
[iItem
].iCharPos
, FALSE
, &off_x
);
1904 if (analysis
->pItem
[iItem
].a
.fRTL
)
1905 iGlyph
= analysis
->glyphs
[iItem
].pwLogClust
[runEnd
];
1907 iGlyph
= analysis
->glyphs
[iItem
].pwLogClust
[runStart
];
1909 if (analysis
->pItem
[iItem
].a
.fRTL
)
1910 cGlyphs
= analysis
->glyphs
[iItem
].pwLogClust
[runStart
] - iGlyph
;
1912 cGlyphs
= analysis
->glyphs
[iItem
].pwLogClust
[runEnd
] - iGlyph
;
1916 if (cEnd
< 0 || scriptInformation
[analysis
->pItem
[iItem
].a
.eScript
].props
.fNeedsCaretInfo
)
1921 clust_glyph
= iGlyph
+ cGlyphs
;
1922 if (analysis
->pItem
[iItem
].a
.fRTL
)
1927 while(clust_glyph
< analysis
->glyphs
[iItem
].numGlyphs
&&
1928 !does_glyph_start_cluster(analysis
->glyphs
[iItem
].psva
, analysis
->glyphs
[iItem
].pwLogClust
, (analysis
->pItem
[iItem
+1].iCharPos
- analysis
->pItem
[iItem
].iCharPos
), clust_glyph
, direction
))
1935 hr
= ScriptTextOut(analysis
->hdc
,
1936 (SCRIPT_CACHE
*)&analysis
->glyphs
[iItem
].sc
, iX
+ off_x
,
1937 iY
, uOptions
, prc
, &analysis
->pItem
[iItem
].a
, NULL
, 0,
1938 &analysis
->glyphs
[iItem
].glyphs
[iGlyph
], cGlyphs
,
1939 &analysis
->glyphs
[iItem
].piAdvance
[iGlyph
], NULL
,
1940 &analysis
->glyphs
[iItem
].pGoffset
[iGlyph
]);
1942 TRACE("ScriptTextOut hr=%08x\n", hr
);
1946 SetBkColor(analysis
->hdc
, BkColor
);
1947 SetBkMode( analysis
->hdc
, BkMode
);
1949 SetTextColor(analysis
->hdc
, TextColor
);
1951 if (analysis
->glyphs
[iItem
].fallbackFont
)
1952 SelectObject(analysis
->hdc
, oldFont
);
1957 /***********************************************************************
1958 * ScriptStringOut (USP10.@)
1960 * This function takes the output of ScriptStringAnalyse and joins the segments
1961 * of glyphs and passes the resulting string to ScriptTextOut. ScriptStringOut
1962 * only processes glyphs.
1965 * ssa [I] buffer to hold the analysed string components
1966 * iX [I] X axis displacement for output
1967 * iY [I] Y axis displacement for output
1968 * uOptions [I] flags controling output processing
1969 * prc [I] rectangle coordinates
1970 * iMinSel [I] starting pos for substringing output string
1971 * iMaxSel [I] ending pos for substringing output string
1972 * fDisabled [I] controls text highlighting
1976 * Failure: is the value returned by ScriptTextOut
1978 HRESULT WINAPI
ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa
,
1987 StringAnalysis
*analysis
;
1991 TRACE("(%p,%d,%d,0x%1x,%p,%d,%d,%d)\n",
1992 ssa
, iX
, iY
, uOptions
, prc
, iMinSel
, iMaxSel
, fDisabled
);
1994 if (!(analysis
= ssa
)) return E_INVALIDARG
;
1995 if (!(analysis
->dwFlags
& SSA_GLYPHS
)) return E_INVALIDARG
;
1997 for (item
= 0; item
< analysis
->numItems
; item
++)
1999 hr
= SS_ItemOut( ssa
, iX
, iY
, analysis
->logical2visual
[item
], -1, -1, uOptions
, prc
, FALSE
, fDisabled
);
2004 if (iMinSel
< iMaxSel
&& (iMinSel
> 0 || iMaxSel
> 0))
2006 if (iMaxSel
> 0 && iMinSel
< 0)
2008 for (item
= 0; item
< analysis
->numItems
; item
++)
2010 hr
= SS_ItemOut( ssa
, iX
, iY
, analysis
->logical2visual
[item
], iMinSel
, iMaxSel
, uOptions
, prc
, TRUE
, fDisabled
);
2019 /***********************************************************************
2020 * ScriptStringCPtoX (USP10.@)
2023 HRESULT WINAPI
ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa
, int icp
, BOOL fTrailing
, int* pX
)
2027 StringAnalysis
* analysis
= ssa
;
2029 TRACE("(%p), %d, %d, (%p)\n", ssa
, icp
, fTrailing
, pX
);
2031 if (!ssa
|| !pX
) return S_FALSE
;
2032 if (!(analysis
->dwFlags
& SSA_GLYPHS
)) return S_FALSE
;
2034 /* icp out of range */
2037 analysis
->invalid
= TRUE
;
2038 return E_INVALIDARG
;
2041 for(item
=0; item
<analysis
->numItems
; item
++)
2046 i
= analysis
->logical2visual
[item
];
2047 CP
= analysis
->pItem
[i
+1].iCharPos
- analysis
->pItem
[i
].iCharPos
;
2048 /* initialize max extents for uninitialized runs */
2049 if (analysis
->glyphs
[i
].iMaxPosX
== -1)
2051 if (analysis
->pItem
[i
].a
.fRTL
)
2052 ScriptCPtoX(0, FALSE
, CP
, analysis
->glyphs
[i
].numGlyphs
, analysis
->glyphs
[i
].pwLogClust
,
2053 analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].piAdvance
,
2054 &analysis
->pItem
[i
].a
, &analysis
->glyphs
[i
].iMaxPosX
);
2056 ScriptCPtoX(CP
, TRUE
, CP
, analysis
->glyphs
[i
].numGlyphs
, analysis
->glyphs
[i
].pwLogClust
,
2057 analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].piAdvance
,
2058 &analysis
->pItem
[i
].a
, &analysis
->glyphs
[i
].iMaxPosX
);
2061 if (icp
>= analysis
->pItem
[i
+1].iCharPos
|| icp
< analysis
->pItem
[i
].iCharPos
)
2063 runningX
+= analysis
->glyphs
[i
].iMaxPosX
;
2067 icp
-= analysis
->pItem
[i
].iCharPos
;
2068 ScriptCPtoX(icp
, fTrailing
, CP
, analysis
->glyphs
[i
].numGlyphs
, analysis
->glyphs
[i
].pwLogClust
,
2069 analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].piAdvance
,
2070 &analysis
->pItem
[i
].a
, &offset
);
2077 /* icp out of range */
2078 analysis
->invalid
= TRUE
;
2079 return E_INVALIDARG
;
2082 /***********************************************************************
2083 * ScriptStringXtoCP (USP10.@)
2086 HRESULT WINAPI
ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa
, int iX
, int* piCh
, int* piTrailing
)
2088 StringAnalysis
* analysis
= ssa
;
2091 TRACE("(%p), %d, (%p), (%p)\n", ssa
, iX
, piCh
, piTrailing
);
2093 if (!ssa
|| !piCh
|| !piTrailing
) return S_FALSE
;
2094 if (!(analysis
->dwFlags
& SSA_GLYPHS
)) return S_FALSE
;
2099 if (analysis
->pItem
[0].a
.fRTL
)
2102 *piTrailing
= FALSE
;
2112 for(item
=0; item
<analysis
->numItems
; item
++)
2117 for (i
= 0; i
< analysis
->numItems
&& analysis
->logical2visual
[i
] != item
; i
++)
2120 CP
= analysis
->pItem
[i
+1].iCharPos
- analysis
->pItem
[i
].iCharPos
;
2121 /* initialize max extents for uninitialized runs */
2122 if (analysis
->glyphs
[i
].iMaxPosX
== -1)
2124 if (analysis
->pItem
[i
].a
.fRTL
)
2125 ScriptCPtoX(0, FALSE
, CP
, analysis
->glyphs
[i
].numGlyphs
, analysis
->glyphs
[i
].pwLogClust
,
2126 analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].piAdvance
,
2127 &analysis
->pItem
[i
].a
, &analysis
->glyphs
[i
].iMaxPosX
);
2129 ScriptCPtoX(CP
, TRUE
, CP
, analysis
->glyphs
[i
].numGlyphs
, analysis
->glyphs
[i
].pwLogClust
,
2130 analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].piAdvance
,
2131 &analysis
->pItem
[i
].a
, &analysis
->glyphs
[i
].iMaxPosX
);
2134 if (iX
> analysis
->glyphs
[i
].iMaxPosX
)
2136 iX
-= analysis
->glyphs
[i
].iMaxPosX
;
2140 ScriptXtoCP(iX
, CP
, analysis
->glyphs
[i
].numGlyphs
, analysis
->glyphs
[i
].pwLogClust
,
2141 analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].piAdvance
,
2142 &analysis
->pItem
[i
].a
, piCh
, piTrailing
);
2143 *piCh
+= analysis
->pItem
[i
].iCharPos
;
2149 *piCh
= analysis
->pItem
[analysis
->numItems
].iCharPos
;
2150 *piTrailing
= FALSE
;
2156 /***********************************************************************
2157 * ScriptStringFree (USP10.@)
2159 * Free a string analysis.
2162 * pssa [I] string analysis.
2166 * Failure: Non-zero HRESULT value.
2168 HRESULT WINAPI
ScriptStringFree(SCRIPT_STRING_ANALYSIS
*pssa
)
2170 StringAnalysis
* analysis
;
2174 TRACE("(%p)\n", pssa
);
2176 if (!pssa
|| !(analysis
= *pssa
)) return E_INVALIDARG
;
2178 invalid
= analysis
->invalid
;
2180 if (analysis
->glyphs
)
2182 for (i
= 0; i
< analysis
->numItems
; i
++)
2184 heap_free(analysis
->glyphs
[i
].glyphs
);
2185 heap_free(analysis
->glyphs
[i
].pwLogClust
);
2186 heap_free(analysis
->glyphs
[i
].piAdvance
);
2187 heap_free(analysis
->glyphs
[i
].psva
);
2188 heap_free(analysis
->glyphs
[i
].pGoffset
);
2189 heap_free(analysis
->glyphs
[i
].abc
);
2190 if (analysis
->glyphs
[i
].fallbackFont
)
2191 DeleteObject(analysis
->glyphs
[i
].fallbackFont
);
2192 ScriptFreeCache((SCRIPT_CACHE
*)&analysis
->glyphs
[i
].sc
);
2193 heap_free(analysis
->glyphs
[i
].sc
);
2195 heap_free(analysis
->glyphs
);
2198 heap_free(analysis
->pItem
);
2199 heap_free(analysis
->logattrs
);
2200 heap_free(analysis
->sz
);
2201 heap_free(analysis
->logical2visual
);
2202 heap_free(analysis
);
2204 if (invalid
) return E_INVALIDARG
;
2208 static inline int get_cluster_size(const WORD
*pwLogClust
, int cChars
, int item
,
2209 int direction
, int* iCluster
, int *check_out
)
2213 WORD clust
= pwLogClust
[item
];
2215 for (check
= item
+direction
; check
< cChars
&& check
>= 0; check
+=direction
)
2217 if (pwLogClust
[check
] == clust
)
2220 if (iCluster
&& *iCluster
== -1)
2232 static inline int get_glyph_cluster_advance(const int* piAdvance
, const SCRIPT_VISATTR
*pva
, const WORD
*pwLogClust
, int cGlyphs
, int cChars
, int glyph
, int direction
)
2235 int log_clust_max
= 0;
2238 advance
= piAdvance
[glyph
];
2240 for (i
= 0; i
< cChars
; i
++)
2242 if (pwLogClust
[i
] > log_clust_max
)
2243 log_clust_max
= pwLogClust
[i
];
2246 if (glyph
> log_clust_max
)
2249 for (glyph
+=direction
; glyph
< cGlyphs
&& glyph
>= 0; glyph
+=direction
)
2252 if (does_glyph_start_cluster(pva
, pwLogClust
, cChars
, glyph
, direction
))
2254 if (glyph
> log_clust_max
)
2256 advance
+= piAdvance
[glyph
];
2262 /***********************************************************************
2263 * ScriptCPtoX (USP10.@)
2266 HRESULT WINAPI
ScriptCPtoX(int iCP
,
2270 const WORD
*pwLogClust
,
2271 const SCRIPT_VISATTR
*psva
,
2272 const int *piAdvance
,
2273 const SCRIPT_ANALYSIS
*psa
,
2281 float special_size
= 0.0;
2286 TRACE("(%d,%d,%d,%d,%p,%p,%p,%p,%p)\n",
2287 iCP
, fTrailing
, cChars
, cGlyphs
, pwLogClust
, psva
, piAdvance
,
2290 if (psa
->fRTL
&& ! psa
->fLogicalOrder
)
2298 int max_clust
= pwLogClust
[0];
2300 for (item
=0; item
< cGlyphs
; item
++)
2301 if (pwLogClust
[item
] > max_clust
)
2303 ERR("We do not handle non reversed clusters properly\n");
2308 for (item
= max_clust
; item
>=0; item
--)
2309 iMaxPos
+= piAdvance
[item
];
2313 for (item
=0; item
< iCP
&& item
< cChars
; item
++)
2315 if (iSpecial
== -1 && (iCluster
== -1 || (iCluster
!= -1 && iCluster
+clust_size
<= item
)))
2318 int clust
= pwLogClust
[item
];
2321 clust_size
= get_cluster_size(pwLogClust
, cChars
, item
, 1, &iCluster
,
2324 advance
= get_glyph_cluster_advance(piAdvance
, psva
, pwLogClust
, cGlyphs
, cChars
, clust
, 1);
2326 if (check
>= cChars
&& !iMaxPos
)
2328 for (check
= clust
; check
< cChars
; check
++)
2329 special_size
+= get_glyph_cluster_advance(piAdvance
, psva
, pwLogClust
, cGlyphs
, cChars
, check
, 1);
2331 special_size
/= (cChars
- item
);
2332 iPosX
+= special_size
;
2336 if (scriptInformation
[psa
->eScript
].props
.fNeedsCaretInfo
)
2339 if (clust_size
== 0)
2343 iPosX
+= advance
/ (float)clust_size
;
2346 else if (iSpecial
!= -1)
2347 iPosX
+= special_size
;
2348 else /* (iCluster != -1) */
2350 int adv
= get_glyph_cluster_advance(piAdvance
, psva
, pwLogClust
, cGlyphs
, cChars
, pwLogClust
[iCluster
], 1);
2351 if (scriptInformation
[psa
->eScript
].props
.fNeedsCaretInfo
)
2354 if (clust_size
== 0)
2358 iPosX
+= adv
/ (float)clust_size
;
2364 iPosX
= iMaxPos
- iPosX
;
2370 TRACE("*piX=%d\n", *piX
);
2374 /***********************************************************************
2375 * ScriptXtoCP (USP10.@)
2378 HRESULT WINAPI
ScriptXtoCP(int iX
,
2381 const WORD
*pwLogClust
,
2382 const SCRIPT_VISATTR
*psva
,
2383 const int *piAdvance
,
2384 const SCRIPT_ANALYSIS
*psa
,
2396 float special_size
= 0.0;
2399 TRACE("(%d,%d,%d,%p,%p,%p,%p,%p,%p)\n",
2400 iX
, cChars
, cGlyphs
, pwLogClust
, psva
, piAdvance
,
2401 psa
, piCP
, piTrailing
);
2403 if (psa
->fRTL
&& ! psa
->fLogicalOrder
)
2408 int max_clust
= pwLogClust
[0];
2417 for (item
=0; item
< cChars
; item
++)
2418 if (pwLogClust
[item
] > max_clust
)
2420 ERR("We do not handle non reversed clusters properly\n");
2432 iPosX
= iLastPosX
= 0;
2437 for (; iPosX
<= iX
&& item
< cChars
&& item
>= 0; item
+=direction
)
2440 if (iSpecial
== -1 &&
2443 ((direction
> 0 && iCluster
+clust_size
<= item
) ||
2444 (direction
< 0 && iCluster
-clust_size
>= item
))
2450 int clust
= pwLogClust
[item
];
2454 clust_size
= get_cluster_size(pwLogClust
, cChars
, item
, direction
,
2456 advance
= get_glyph_cluster_advance(piAdvance
, psva
, pwLogClust
, cGlyphs
, cChars
, clust
, direction
);
2458 if (check
>= cChars
&& direction
> 0)
2460 for (check
= clust
; check
< cChars
; check
++)
2461 special_size
+= get_glyph_cluster_advance(piAdvance
, psva
, pwLogClust
, cGlyphs
, cChars
, check
, direction
);
2463 special_size
/= (cChars
- item
);
2464 iPosX
+= special_size
;
2468 if (scriptInformation
[psa
->eScript
].props
.fNeedsCaretInfo
)
2475 iPosX
+= advance
/ (float)clust_size
;
2478 else if (iSpecial
!= -1)
2479 iPosX
+= special_size
;
2480 else /* (iCluster != -1) */
2482 int adv
= get_glyph_cluster_advance(piAdvance
, psva
, pwLogClust
, cGlyphs
, cChars
, pwLogClust
[iCluster
], direction
);
2483 if (scriptInformation
[psa
->eScript
].props
.fNeedsCaretInfo
)
2490 iPosX
+= adv
/ (float)clust_size
;
2498 if (item
< cChars
&& ((iPosX
- iLastPosX
) / 2.0) + iX
>= iPosX
)
2500 if (scriptInformation
[psa
->eScript
].props
.fNeedsCaretInfo
&& clust_size
> 1)
2501 item
+=(clust_size
-1);
2509 if (iX
== iLastPosX
)
2511 if (iX
>= iLastPosX
&& iX
<= iPosX
)
2514 if (iLastPosX
== iX
)
2516 else if (item
< 0 || ((iLastPosX
- iPosX
) / 2.0) + iX
<= iLastPosX
)
2518 if (scriptInformation
[psa
->eScript
].props
.fNeedsCaretInfo
&& clust_size
> 1)
2519 item
-=(clust_size
-1);
2528 TRACE("*piCP=%d\n", *piCP
);
2529 TRACE("*piTrailing=%d\n", *piTrailing
);
2533 /***********************************************************************
2534 * ScriptBreak (USP10.@)
2536 * Retrieve line break information.
2539 * chars [I] Array of characters.
2540 * sa [I] String analysis.
2541 * la [I] Array of logical attribute structures.
2547 HRESULT WINAPI
ScriptBreak(const WCHAR
*chars
, int count
, const SCRIPT_ANALYSIS
*sa
, SCRIPT_LOGATTR
*la
)
2549 TRACE("(%s, %d, %p, %p)\n", debugstr_wn(chars
, count
), count
, sa
, la
);
2551 if (!la
) return S_FALSE
;
2553 BREAK_line(chars
, count
, sa
, la
);
2558 /***********************************************************************
2559 * ScriptIsComplex (USP10.@)
2561 * Determine if a string is complex.
2564 * chars [I] Array of characters to test.
2565 * len [I] Length in characters.
2573 HRESULT WINAPI
ScriptIsComplex(const WCHAR
*chars
, int len
, DWORD flag
)
2578 TRACE("(%s,%d,0x%x)\n", debugstr_wn(chars
, len
), len
, flag
);
2580 for (i
= 0; i
< len
; i
+=consumed
)
2586 if ((flag
& SIC_ASCIIDIGIT
) && chars
[i
] >= 0x30 && chars
[i
] <= 0x39)
2589 script
= get_char_script(chars
,i
,len
, &consumed
);
2590 if ((scriptInformation
[script
].props
.fComplex
&& (flag
& SIC_COMPLEX
))||
2591 (!scriptInformation
[script
].props
.fComplex
&& (flag
& SIC_NEUTRAL
)))
2597 /***********************************************************************
2598 * ScriptShapeOpenType (USP10.@)
2600 * Produce glyphs and visual attributes for a run.
2603 * hdc [I] Device context.
2604 * psc [I/O] Opaque pointer to a script cache.
2605 * psa [I/O] Script analysis.
2606 * tagScript [I] The OpenType tag for the Script
2607 * tagLangSys [I] The OpenType tag for the Language
2608 * rcRangeChars[I] Array of Character counts in each range
2609 * rpRangeProperties [I] Array of TEXTRANGE_PROPERTIES structures
2610 * cRanges [I] Count of ranges
2611 * pwcChars [I] Array of characters specifying the run.
2612 * cChars [I] Number of characters in pwcChars.
2613 * cMaxGlyphs [I] Length of pwOutGlyphs.
2614 * pwLogClust [O] Array of logical cluster info.
2615 * pCharProps [O] Array of character property values
2616 * pwOutGlyphs [O] Array of glyphs.
2617 * pOutGlyphProps [O] Array of attributes for the retrieved glyphs
2618 * pcGlyphs [O] Number of glyphs returned.
2622 * Failure: Non-zero HRESULT value.
2624 HRESULT WINAPI
ScriptShapeOpenType( HDC hdc
, SCRIPT_CACHE
*psc
,
2625 SCRIPT_ANALYSIS
*psa
, OPENTYPE_TAG tagScript
,
2626 OPENTYPE_TAG tagLangSys
, int *rcRangeChars
,
2627 TEXTRANGE_PROPERTIES
**rpRangeProperties
,
2628 int cRanges
, const WCHAR
*pwcChars
, int cChars
,
2629 int cMaxGlyphs
, WORD
*pwLogClust
,
2630 SCRIPT_CHARPROP
*pCharProps
, WORD
*pwOutGlyphs
,
2631 SCRIPT_GLYPHPROP
*pOutGlyphProps
, int *pcGlyphs
)
2637 TRACE("(%p, %p, %p, %s, %s, %p, %p, %d, %s, %d, %d, %p, %p, %p, %p, %p )\n",
2639 debugstr_an((char*)&tagScript
,4), debugstr_an((char*)&tagLangSys
,4),
2640 rcRangeChars
, rpRangeProperties
, cRanges
, debugstr_wn(pwcChars
, cChars
),
2641 cChars
, cMaxGlyphs
, pwLogClust
, pCharProps
, pwOutGlyphs
, pOutGlyphProps
, pcGlyphs
);
2643 if (psa
) TRACE("psa values: %d, %d, %d, %d, %d, %d, %d\n", psa
->eScript
, psa
->fRTL
, psa
->fLayoutRTL
,
2644 psa
->fLinkBefore
, psa
->fLinkAfter
, psa
->fLogicalOrder
, psa
->fNoGlyphIndex
);
2646 if (!pOutGlyphProps
|| !pcGlyphs
|| !pCharProps
) return E_INVALIDARG
;
2647 if (cChars
> cMaxGlyphs
) return E_OUTOFMEMORY
;
2650 FIXME("Ranges not supported yet\n");
2652 rtl
= (psa
&& !psa
->fLogicalOrder
&& psa
->fRTL
);
2655 if ((hr
= init_script_cache(hdc
, psc
)) != S_OK
) return hr
;
2656 if (!pwLogClust
) return E_FAIL
;
2658 ((ScriptCache
*)*psc
)->userScript
= tagScript
;
2659 ((ScriptCache
*)*psc
)->userLang
= tagLangSys
;
2661 /* set fNoGlyphIndex non truetype/opentype fonts */
2662 if (!psa
->fNoGlyphIndex
&& !((ScriptCache
*)*psc
)->sfnt
)
2663 psa
->fNoGlyphIndex
= TRUE
;
2665 /* Initialize a SCRIPT_VISATTR and LogClust for each char in this run */
2666 for (i
= 0; i
< cChars
; i
++)
2669 if (rtl
) idx
= cChars
- 1 - i
;
2670 /* FIXME: set to better values */
2671 pOutGlyphProps
[i
].sva
.uJustification
= (pwcChars
[idx
] == ' ') ? SCRIPT_JUSTIFY_BLANK
: SCRIPT_JUSTIFY_CHARACTER
;
2672 pOutGlyphProps
[i
].sva
.fClusterStart
= 1;
2673 pOutGlyphProps
[i
].sva
.fDiacritic
= 0;
2674 pOutGlyphProps
[i
].sva
.fZeroWidth
= 0;
2675 pOutGlyphProps
[i
].sva
.fReserved
= 0;
2676 pOutGlyphProps
[i
].sva
.fShapeReserved
= 0;
2678 /* FIXME: have the shaping engine set this */
2679 pCharProps
[i
].fCanGlyphAlone
= 0;
2681 pwLogClust
[i
] = idx
;
2684 if (psa
&& !psa
->fNoGlyphIndex
)
2687 if ((hr
= SHAPE_CheckFontForRequiredFeatures(hdc
, (ScriptCache
*)*psc
, psa
)) != S_OK
) return hr
;
2689 rChars
= heap_alloc(sizeof(WCHAR
) * cChars
);
2690 if (!rChars
) return E_OUTOFMEMORY
;
2691 for (i
= 0; i
< cChars
; i
++)
2695 if (rtl
) idx
= cChars
- 1 - i
;
2697 chInput
= mirror_char(pwcChars
[idx
]);
2699 chInput
= pwcChars
[idx
];
2700 /* special case for tabs */
2701 if (chInput
== 0x0009)
2703 if (!(pwOutGlyphs
[i
] = get_cache_glyph(psc
, chInput
)))
2711 if (GetGlyphIndicesW(hdc
, &chInput
, 1, &glyph
, 0) == GDI_ERROR
)
2716 pwOutGlyphs
[i
] = set_cache_glyph(psc
, chInput
, glyph
);
2718 rChars
[i
] = chInput
;
2721 SHAPE_ContextualShaping(hdc
, (ScriptCache
*)*psc
, psa
, rChars
, cChars
, pwOutGlyphs
, pcGlyphs
, cMaxGlyphs
, pwLogClust
);
2722 SHAPE_ApplyDefaultOpentypeFeatures(hdc
, (ScriptCache
*)*psc
, psa
, pwOutGlyphs
, pcGlyphs
, cMaxGlyphs
, cChars
, pwLogClust
);
2723 SHAPE_CharGlyphProp(hdc
, (ScriptCache
*)*psc
, psa
, pwcChars
, cChars
, pwOutGlyphs
, *pcGlyphs
, pwLogClust
, pCharProps
, pOutGlyphProps
);
2728 TRACE("no glyph translation\n");
2729 for (i
= 0; i
< cChars
; i
++)
2732 /* No mirroring done here */
2733 if (rtl
) idx
= cChars
- 1 - i
;
2734 pwOutGlyphs
[i
] = pwcChars
[idx
];
2742 /***********************************************************************
2743 * ScriptShape (USP10.@)
2745 * Produce glyphs and visual attributes for a run.
2748 * hdc [I] Device context.
2749 * psc [I/O] Opaque pointer to a script cache.
2750 * pwcChars [I] Array of characters specifying the run.
2751 * cChars [I] Number of characters in pwcChars.
2752 * cMaxGlyphs [I] Length of pwOutGlyphs.
2753 * psa [I/O] Script analysis.
2754 * pwOutGlyphs [O] Array of glyphs.
2755 * pwLogClust [O] Array of logical cluster info.
2756 * psva [O] Array of visual attributes.
2757 * pcGlyphs [O] Number of glyphs returned.
2761 * Failure: Non-zero HRESULT value.
2763 HRESULT WINAPI
ScriptShape(HDC hdc
, SCRIPT_CACHE
*psc
, const WCHAR
*pwcChars
,
2764 int cChars
, int cMaxGlyphs
,
2765 SCRIPT_ANALYSIS
*psa
, WORD
*pwOutGlyphs
, WORD
*pwLogClust
,
2766 SCRIPT_VISATTR
*psva
, int *pcGlyphs
)
2770 SCRIPT_CHARPROP
*charProps
;
2771 SCRIPT_GLYPHPROP
*glyphProps
;
2773 if (!psva
|| !pcGlyphs
) return E_INVALIDARG
;
2774 if (cChars
> cMaxGlyphs
) return E_OUTOFMEMORY
;
2776 charProps
= heap_alloc_zero(sizeof(SCRIPT_CHARPROP
)*cChars
);
2777 if (!charProps
) return E_OUTOFMEMORY
;
2778 glyphProps
= heap_alloc_zero(sizeof(SCRIPT_GLYPHPROP
)*cMaxGlyphs
);
2781 heap_free(charProps
);
2782 return E_OUTOFMEMORY
;
2785 hr
= ScriptShapeOpenType(hdc
, psc
, psa
, scriptInformation
[psa
->eScript
].scriptTag
, 0, NULL
, NULL
, 0, pwcChars
, cChars
, cMaxGlyphs
, pwLogClust
, charProps
, pwOutGlyphs
, glyphProps
, pcGlyphs
);
2789 for (i
= 0; i
< *pcGlyphs
; i
++)
2790 psva
[i
] = glyphProps
[i
].sva
;
2793 heap_free(charProps
);
2794 heap_free(glyphProps
);
2799 /***********************************************************************
2800 * ScriptPlaceOpenType (USP10.@)
2802 * Produce advance widths for a run.
2805 * hdc [I] Device context.
2806 * psc [I/O] Opaque pointer to a script cache.
2807 * psa [I/O] String analysis.
2808 * tagScript [I] The OpenType tag for the Script
2809 * tagLangSys [I] The OpenType tag for the Language
2810 * rcRangeChars[I] Array of Character counts in each range
2811 * rpRangeProperties [I] Array of TEXTRANGE_PROPERTIES structures
2812 * cRanges [I] Count of ranges
2813 * pwcChars [I] Array of characters specifying the run.
2814 * pwLogClust [I] Array of logical cluster info
2815 * pCharProps [I] Array of character property values
2816 * cChars [I] Number of characters in pwcChars.
2817 * pwGlyphs [I] Array of glyphs.
2818 * pGlyphProps [I] Array of attributes for the retrieved glyphs
2819 * cGlyphs [I] Count of Glyphs
2820 * piAdvance [O] Array of advance widths.
2821 * pGoffset [O] Glyph offsets.
2822 * pABC [O] Combined ABC width.
2826 * Failure: Non-zero HRESULT value.
2829 HRESULT WINAPI
ScriptPlaceOpenType( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
,
2830 OPENTYPE_TAG tagScript
, OPENTYPE_TAG tagLangSys
,
2831 int *rcRangeChars
, TEXTRANGE_PROPERTIES
**rpRangeProperties
,
2832 int cRanges
, const WCHAR
*pwcChars
, WORD
*pwLogClust
,
2833 SCRIPT_CHARPROP
*pCharProps
, int cChars
,
2834 const WORD
*pwGlyphs
, const SCRIPT_GLYPHPROP
*pGlyphProps
,
2835 int cGlyphs
, int *piAdvance
,
2836 GOFFSET
*pGoffset
, ABC
*pABC
2842 TRACE("(%p, %p, %p, %s, %s, %p, %p, %d, %s, %p, %p, %d, %p, %p, %d, %p %p %p)\n",
2844 debugstr_an((char*)&tagScript
,4), debugstr_an((char*)&tagLangSys
,4),
2845 rcRangeChars
, rpRangeProperties
, cRanges
, debugstr_wn(pwcChars
, cChars
),
2846 pwLogClust
, pCharProps
, cChars
, pwGlyphs
, pGlyphProps
, cGlyphs
, piAdvance
,
2849 if (!pGlyphProps
) return E_INVALIDARG
;
2850 if ((hr
= init_script_cache(hdc
, psc
)) != S_OK
) return hr
;
2851 if (!pGoffset
) return E_FAIL
;
2854 FIXME("Ranges not supported yet\n");
2856 ((ScriptCache
*)*psc
)->userScript
= tagScript
;
2857 ((ScriptCache
*)*psc
)->userLang
= tagLangSys
;
2859 if (pABC
) memset(pABC
, 0, sizeof(ABC
));
2860 for (i
= 0; i
< cGlyphs
; i
++)
2863 if (!get_cache_glyph_widths(psc
, pwGlyphs
[i
], &abc
))
2865 if (!hdc
) return E_PENDING
;
2866 if ((get_cache_pitch_family(psc
) & TMPF_TRUETYPE
) && !psa
->fNoGlyphIndex
)
2868 if (!GetCharABCWidthsI(hdc
, 0, 1, (WORD
*)&pwGlyphs
[i
], &abc
)) return S_FALSE
;
2873 if (!GetCharWidth32W(hdc
, pwGlyphs
[i
], pwGlyphs
[i
], &width
)) return S_FALSE
;
2875 abc
.abcA
= abc
.abcC
= 0;
2877 set_cache_glyph_widths(psc
, pwGlyphs
[i
], &abc
);
2881 pABC
->abcA
+= abc
.abcA
;
2882 pABC
->abcB
+= abc
.abcB
;
2883 pABC
->abcC
+= abc
.abcC
;
2885 /* FIXME: set to more reasonable values */
2886 pGoffset
[i
].du
= pGoffset
[i
].dv
= 0;
2887 if (piAdvance
) piAdvance
[i
] = abc
.abcA
+ abc
.abcB
+ abc
.abcC
;
2890 if (pABC
) TRACE("Total for run: abcA=%d, abcB=%d, abcC=%d\n", pABC
->abcA
, pABC
->abcB
, pABC
->abcC
);
2894 /***********************************************************************
2895 * ScriptPlace (USP10.@)
2897 * Produce advance widths for a run.
2900 * hdc [I] Device context.
2901 * psc [I/O] Opaque pointer to a script cache.
2902 * pwGlyphs [I] Array of glyphs.
2903 * cGlyphs [I] Number of glyphs in pwGlyphs.
2904 * psva [I] Array of visual attributes.
2905 * psa [I/O] String analysis.
2906 * piAdvance [O] Array of advance widths.
2907 * pGoffset [O] Glyph offsets.
2908 * pABC [O] Combined ABC width.
2912 * Failure: Non-zero HRESULT value.
2914 HRESULT WINAPI
ScriptPlace(HDC hdc
, SCRIPT_CACHE
*psc
, const WORD
*pwGlyphs
,
2915 int cGlyphs
, const SCRIPT_VISATTR
*psva
,
2916 SCRIPT_ANALYSIS
*psa
, int *piAdvance
, GOFFSET
*pGoffset
, ABC
*pABC
)
2919 SCRIPT_GLYPHPROP
*glyphProps
;
2922 TRACE("(%p, %p, %p, %d, %p, %p, %p, %p, %p)\n", hdc
, psc
, pwGlyphs
, cGlyphs
, psva
, psa
,
2923 piAdvance
, pGoffset
, pABC
);
2925 if (!psva
) return E_INVALIDARG
;
2926 if (!pGoffset
) return E_FAIL
;
2928 glyphProps
= heap_alloc(sizeof(SCRIPT_GLYPHPROP
)*cGlyphs
);
2929 if (!glyphProps
) return E_OUTOFMEMORY
;
2931 for (i
= 0; i
< cGlyphs
; i
++)
2932 glyphProps
[i
].sva
= psva
[i
];
2934 hr
= ScriptPlaceOpenType(hdc
, psc
, psa
, scriptInformation
[psa
->eScript
].scriptTag
, 0, NULL
, NULL
, 0, NULL
, NULL
, NULL
, 0, pwGlyphs
, glyphProps
, cGlyphs
, piAdvance
, pGoffset
, pABC
);
2936 heap_free(glyphProps
);
2941 /***********************************************************************
2942 * ScriptGetCMap (USP10.@)
2944 * Retrieve glyph indices.
2947 * hdc [I] Device context.
2948 * psc [I/O] Opaque pointer to a script cache.
2949 * pwcInChars [I] Array of Unicode characters.
2950 * cChars [I] Number of characters in pwcInChars.
2951 * dwFlags [I] Flags.
2952 * pwOutGlyphs [O] Buffer to receive the array of glyph indices.
2956 * Failure: Non-zero HRESULT value.
2958 HRESULT WINAPI
ScriptGetCMap(HDC hdc
, SCRIPT_CACHE
*psc
, const WCHAR
*pwcInChars
,
2959 int cChars
, DWORD dwFlags
, WORD
*pwOutGlyphs
)
2964 TRACE("(%p,%p,%s,%d,0x%x,%p)\n", hdc
, psc
, debugstr_wn(pwcInChars
, cChars
),
2965 cChars
, dwFlags
, pwOutGlyphs
);
2967 if ((hr
= init_script_cache(hdc
, psc
)) != S_OK
) return hr
;
2971 if ((get_cache_pitch_family(psc
) & TMPF_TRUETYPE
))
2973 for (i
= 0; i
< cChars
; i
++)
2976 if (dwFlags
== SGCM_RTL
)
2977 inChar
= mirror_char(pwcInChars
[i
]);
2979 inChar
= pwcInChars
[i
];
2980 if (!(pwOutGlyphs
[i
] = get_cache_glyph(psc
, inChar
)))
2983 if (!hdc
) return E_PENDING
;
2984 if (GetGlyphIndicesW(hdc
, &inChar
, 1, &glyph
, GGI_MARK_NONEXISTING_GLYPHS
) == GDI_ERROR
) return S_FALSE
;
2985 if (glyph
== 0xffff)
2990 pwOutGlyphs
[i
] = set_cache_glyph(psc
, inChar
, glyph
);
2996 TRACE("no glyph translation\n");
2997 for (i
= 0; i
< cChars
; i
++)
3000 if (dwFlags
== SGCM_RTL
)
3001 inChar
= mirror_char(pwcInChars
[i
]);
3003 inChar
= pwcInChars
[i
];
3004 pwOutGlyphs
[i
] = inChar
;
3010 /***********************************************************************
3011 * ScriptTextOut (USP10.@)
3014 HRESULT WINAPI
ScriptTextOut(const HDC hdc
, SCRIPT_CACHE
*psc
, int x
, int y
, UINT fuOptions
,
3015 const RECT
*lprc
, const SCRIPT_ANALYSIS
*psa
, const WCHAR
*pwcReserved
,
3016 int iReserved
, const WORD
*pwGlyphs
, int cGlyphs
, const int *piAdvance
,
3017 const int *piJustify
, const GOFFSET
*pGoffset
)
3021 TRACE("(%p, %p, %d, %d, %04x, %p, %p, %p, %d, %p, %d, %p, %p, %p)\n",
3022 hdc
, psc
, x
, y
, fuOptions
, lprc
, psa
, pwcReserved
, iReserved
, pwGlyphs
, cGlyphs
,
3023 piAdvance
, piJustify
, pGoffset
);
3025 if (!hdc
|| !psc
) return E_INVALIDARG
;
3026 if (!piAdvance
|| !psa
|| !pwGlyphs
) return E_INVALIDARG
;
3028 fuOptions
&= ETO_CLIPPED
+ ETO_OPAQUE
;
3029 fuOptions
|= ETO_IGNORELANGUAGE
;
3030 if (!psa
->fNoGlyphIndex
) /* Have Glyphs? */
3031 fuOptions
|= ETO_GLYPH_INDEX
; /* Say don't do translation to glyph */
3033 if (psa
->fRTL
&& psa
->fLogicalOrder
)
3038 rtlGlyphs
= heap_alloc(cGlyphs
* sizeof(WORD
));
3040 return E_OUTOFMEMORY
;
3042 for (i
= 0; i
< cGlyphs
; i
++)
3043 rtlGlyphs
[i
] = pwGlyphs
[cGlyphs
-1-i
];
3045 if (!ExtTextOutW(hdc
, x
, y
, fuOptions
, lprc
, rtlGlyphs
, cGlyphs
, NULL
))
3047 heap_free(rtlGlyphs
);
3050 if (!ExtTextOutW(hdc
, x
, y
, fuOptions
, lprc
, pwGlyphs
, cGlyphs
, NULL
))
3056 /***********************************************************************
3057 * ScriptCacheGetHeight (USP10.@)
3059 * Retrieve the height of the font in the cache.
3062 * hdc [I] Device context.
3063 * psc [I/O] Opaque pointer to a script cache.
3064 * height [O] Receives font height.
3068 * Failure: Non-zero HRESULT value.
3070 HRESULT WINAPI
ScriptCacheGetHeight(HDC hdc
, SCRIPT_CACHE
*psc
, LONG
*height
)
3074 TRACE("(%p, %p, %p)\n", hdc
, psc
, height
);
3076 if (!height
) return E_INVALIDARG
;
3077 if ((hr
= init_script_cache(hdc
, psc
)) != S_OK
) return hr
;
3079 *height
= get_cache_height(psc
);
3083 /***********************************************************************
3084 * ScriptGetGlyphABCWidth (USP10.@)
3086 * Retrieve the width of a glyph.
3089 * hdc [I] Device context.
3090 * psc [I/O] Opaque pointer to a script cache.
3091 * glyph [I] Glyph to retrieve the width for.
3092 * abc [O] ABC widths of the glyph.
3096 * Failure: Non-zero HRESULT value.
3098 HRESULT WINAPI
ScriptGetGlyphABCWidth(HDC hdc
, SCRIPT_CACHE
*psc
, WORD glyph
, ABC
*abc
)
3102 TRACE("(%p, %p, 0x%04x, %p)\n", hdc
, psc
, glyph
, abc
);
3104 if (!abc
) return E_INVALIDARG
;
3105 if ((hr
= init_script_cache(hdc
, psc
)) != S_OK
) return hr
;
3107 if (!get_cache_glyph_widths(psc
, glyph
, abc
))
3109 if (!hdc
) return E_PENDING
;
3110 if ((get_cache_pitch_family(psc
) & TMPF_TRUETYPE
))
3112 if (!GetCharABCWidthsI(hdc
, 0, 1, &glyph
, abc
)) return S_FALSE
;
3117 if (!GetCharWidth32W(hdc
, glyph
, glyph
, &width
)) return S_FALSE
;
3119 abc
->abcA
= abc
->abcC
= 0;
3121 set_cache_glyph_widths(psc
, glyph
, abc
);
3126 /***********************************************************************
3127 * ScriptLayout (USP10.@)
3129 * Map embedding levels to visual and/or logical order.
3132 * runs [I] Size of level array.
3133 * level [I] Array of embedding levels.
3134 * vistolog [O] Map of embedding levels from visual to logical order.
3135 * logtovis [O] Map of embedding levels from logical to visual order.
3139 * Failure: Non-zero HRESULT value.
3142 * This stub works correctly for any sequence of a single
3143 * embedding level but not for sequences of different
3144 * embedding levels, i.e. mixtures of RTL and LTR scripts.
3146 HRESULT WINAPI
ScriptLayout(int runs
, const BYTE
*level
, int *vistolog
, int *logtovis
)
3151 TRACE("(%d, %p, %p, %p)\n", runs
, level
, vistolog
, logtovis
);
3153 if (!level
|| (!vistolog
&& !logtovis
))
3154 return E_INVALIDARG
;
3156 indexs
= heap_alloc(sizeof(int) * runs
);
3158 return E_OUTOFMEMORY
;
3163 for( ich
= 0; ich
< runs
; ich
++)
3168 ich
+= BIDI_ReorderV2lLevel(0, indexs
+ich
, level
+ich
, runs
- ich
, FALSE
);
3169 for (ich
= 0; ich
< runs
; ich
++)
3170 vistolog
[ich
] = indexs
[ich
];
3176 for( ich
= 0; ich
< runs
; ich
++)
3181 ich
+= BIDI_ReorderL2vLevel(0, indexs
+ich
, level
+ich
, runs
- ich
, FALSE
);
3182 for (ich
= 0; ich
< runs
; ich
++)
3183 logtovis
[ich
] = indexs
[ich
];
3190 /***********************************************************************
3191 * ScriptStringGetLogicalWidths (USP10.@)
3193 * Returns logical widths from a string analysis.
3196 * ssa [I] string analysis.
3197 * piDx [O] logical widths returned.
3201 * Failure: a non-zero HRESULT.
3203 HRESULT WINAPI
ScriptStringGetLogicalWidths(SCRIPT_STRING_ANALYSIS ssa
, int *piDx
)
3206 StringAnalysis
*analysis
= ssa
;
3208 TRACE("%p, %p\n", ssa
, piDx
);
3210 if (!analysis
) return S_FALSE
;
3211 if (!(analysis
->dwFlags
& SSA_GLYPHS
)) return S_FALSE
;
3213 for (i
= 0; i
< analysis
->numItems
; i
++)
3215 int cChar
= analysis
->pItem
[i
+1].iCharPos
- analysis
->pItem
[i
].iCharPos
;
3218 if (analysis
->pItem
[i
].a
.fRTL
&& ! analysis
->pItem
[i
].a
.fLogicalOrder
)
3221 for (j
= 0; j
< cChar
; j
++)
3224 int glyph
= analysis
->glyphs
[i
].pwLogClust
[j
];
3225 int clust_size
= get_cluster_size(analysis
->glyphs
[i
].pwLogClust
,
3226 cChar
, j
, direction
, NULL
, NULL
);
3227 int advance
= get_glyph_cluster_advance(analysis
->glyphs
[i
].piAdvance
, analysis
->glyphs
[i
].psva
, analysis
->glyphs
[i
].pwLogClust
, analysis
->glyphs
[i
].numGlyphs
, cChar
, glyph
, direction
);
3229 for (k
= 0; k
< clust_size
; k
++)
3231 piDx
[next
] = advance
/ clust_size
;
3240 /***********************************************************************
3241 * ScriptStringValidate (USP10.@)
3243 * Validate a string analysis.
3246 * ssa [I] string analysis.
3250 * Failure: S_FALSE if invalid sequences are found
3251 * or a non-zero HRESULT if it fails.
3253 HRESULT WINAPI
ScriptStringValidate(SCRIPT_STRING_ANALYSIS ssa
)
3255 StringAnalysis
*analysis
= ssa
;
3257 TRACE("(%p)\n", ssa
);
3259 if (!analysis
) return E_INVALIDARG
;
3260 return (analysis
->invalid
) ? S_FALSE
: S_OK
;
3263 /***********************************************************************
3264 * ScriptString_pSize (USP10.@)
3266 * Retrieve width and height of an analysed string.
3269 * ssa [I] string analysis.
3272 * Success: Pointer to a SIZE structure.
3275 const SIZE
* WINAPI
ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa
)
3278 StringAnalysis
*analysis
= ssa
;
3280 TRACE("(%p)\n", ssa
);
3282 if (!analysis
) return NULL
;
3283 if (!(analysis
->dwFlags
& SSA_GLYPHS
)) return NULL
;
3287 if (!(analysis
->sz
= heap_alloc(sizeof(SIZE
)))) return NULL
;
3288 analysis
->sz
->cy
= analysis
->glyphs
[0].sc
->tm
.tmHeight
;
3290 analysis
->sz
->cx
= 0;
3291 for (i
= 0; i
< analysis
->numItems
; i
++)
3293 if (analysis
->glyphs
[i
].sc
->tm
.tmHeight
> analysis
->sz
->cy
)
3294 analysis
->sz
->cy
= analysis
->glyphs
[i
].sc
->tm
.tmHeight
;
3295 for (j
= 0; j
< analysis
->glyphs
[i
].numGlyphs
; j
++)
3296 analysis
->sz
->cx
+= analysis
->glyphs
[i
].piAdvance
[j
];
3299 return analysis
->sz
;
3302 /***********************************************************************
3303 * ScriptString_pLogAttr (USP10.@)
3305 * Retrieve logical attributes of an analysed string.
3308 * ssa [I] string analysis.
3311 * Success: Pointer to an array of SCRIPT_LOGATTR structures.
3314 const SCRIPT_LOGATTR
* WINAPI
ScriptString_pLogAttr(SCRIPT_STRING_ANALYSIS ssa
)
3316 StringAnalysis
*analysis
= ssa
;
3318 TRACE("(%p)\n", ssa
);
3320 if (!analysis
) return NULL
;
3321 if (!(analysis
->dwFlags
& SSA_BREAK
)) return NULL
;
3322 return analysis
->logattrs
;
3325 /***********************************************************************
3326 * ScriptString_pcOutChars (USP10.@)
3328 * Retrieve the length of a string after clipping.
3331 * ssa [I] String analysis.
3334 * Success: Pointer to the length.
3337 const int * WINAPI
ScriptString_pcOutChars(SCRIPT_STRING_ANALYSIS ssa
)
3339 StringAnalysis
*analysis
= ssa
;
3341 TRACE("(%p)\n", ssa
);
3343 if (!analysis
) return NULL
;
3344 return &analysis
->clip_len
;
3347 /***********************************************************************
3348 * ScriptStringGetOrder (USP10.@)
3350 * Retrieve a glyph order map.
3353 * ssa [I] String analysis.
3354 * order [I/O] Array of glyph positions.
3358 * Failure: a non-zero HRESULT.
3360 HRESULT WINAPI
ScriptStringGetOrder(SCRIPT_STRING_ANALYSIS ssa
, UINT
*order
)
3364 StringAnalysis
*analysis
= ssa
;
3366 TRACE("(%p)\n", ssa
);
3368 if (!analysis
) return S_FALSE
;
3369 if (!(analysis
->dwFlags
& SSA_GLYPHS
)) return S_FALSE
;
3371 /* FIXME: handle RTL scripts */
3372 for (i
= 0, k
= 0; i
< analysis
->numItems
; i
++)
3373 for (j
= 0; j
< analysis
->glyphs
[i
].numGlyphs
; j
++, k
++)
3379 /***********************************************************************
3380 * ScriptGetLogicalWidths (USP10.@)
3382 * Convert advance widths to logical widths.
3385 * sa [I] Script analysis.
3386 * nbchars [I] Number of characters.
3387 * nbglyphs [I] Number of glyphs.
3388 * glyph_width [I] Array of glyph widths.
3389 * log_clust [I] Array of logical clusters.
3390 * sva [I] Visual attributes.
3391 * widths [O] Array of logical widths.
3395 * Failure: a non-zero HRESULT.
3397 HRESULT WINAPI
ScriptGetLogicalWidths(const SCRIPT_ANALYSIS
*sa
, int nbchars
, int nbglyphs
,
3398 const int *glyph_width
, const WORD
*log_clust
,
3399 const SCRIPT_VISATTR
*sva
, int *widths
)
3403 TRACE("(%p, %d, %d, %p, %p, %p, %p)\n",
3404 sa
, nbchars
, nbglyphs
, glyph_width
, log_clust
, sva
, widths
);
3407 for (i
= 0; i
< nbchars
; i
++) widths
[i
] = glyph_width
[i
];
3411 /***********************************************************************
3412 * ScriptApplyLogicalWidth (USP10.@)
3414 * Generate glyph advance widths.
3417 * dx [I] Array of logical advance widths.
3418 * num_chars [I] Number of characters.
3419 * num_glyphs [I] Number of glyphs.
3420 * log_clust [I] Array of logical clusters.
3421 * sva [I] Visual attributes.
3422 * advance [I] Array of glyph advance widths.
3423 * sa [I] Script analysis.
3424 * abc [I/O] Summed ABC widths.
3425 * justify [O] Array of glyph advance widths.
3429 * Failure: a non-zero HRESULT.
3431 HRESULT WINAPI
ScriptApplyLogicalWidth(const int *dx
, int num_chars
, int num_glyphs
,
3432 const WORD
*log_clust
, const SCRIPT_VISATTR
*sva
,
3433 const int *advance
, const SCRIPT_ANALYSIS
*sa
,
3434 ABC
*abc
, int *justify
)
3438 FIXME("(%p, %d, %d, %p, %p, %p, %p, %p, %p)\n",
3439 dx
, num_chars
, num_glyphs
, log_clust
, sva
, advance
, sa
, abc
, justify
);
3441 for (i
= 0; i
< num_chars
; i
++) justify
[i
] = advance
[i
];
3445 HRESULT WINAPI
ScriptJustify(const SCRIPT_VISATTR
*sva
, const int *advance
,
3446 int num_glyphs
, int dx
, int min_kashida
, int *justify
)
3450 FIXME("(%p, %p, %d, %d, %d, %p)\n", sva
, advance
, num_glyphs
, dx
, min_kashida
, justify
);
3452 for (i
= 0; i
< num_glyphs
; i
++) justify
[i
] = advance
[i
];