1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! Unicode Complex Script processor API declarations
7 use ctypes::{c_int, c_long, c_void};
8 use shared::minwindef::{BOOL, BYTE, DWORD, UINT, ULONG, WORD};
9 use shared::ntdef::LCID;
10 use shared::windef::{HDC, RECT, SIZE};
11 use shared::winerror::{FACILITY_ITF, SEVERITY_ERROR};
12 use um::wingdi::ABC;
13 use um::winnt::{HRESULT, LONG, WCHAR};
14 pub const SCRIPT_UNDEFINED: WORD = 0;
15 pub const USP_E_SCRIPT_NOT_IN_FONT: HRESULT = MAKE_HRESULT!(SEVERITY_ERROR, FACILITY_ITF, 0x200);
16 DECLARE_HANDLE!{SCRIPT_CACHE, SCRIPT_CACHE__}
17 extern "system" {
ScriptFreeCache( psc: *mut SCRIPT_CACHE, ) -> HRESULT18     pub fn ScriptFreeCache(
19         psc: *mut SCRIPT_CACHE,
20     ) -> HRESULT;
21 }
22 STRUCT!{struct SCRIPT_CONTROL {
23     bit_fields: DWORD,
24 }}
25 BITFIELD!{SCRIPT_CONTROL bit_fields: DWORD [
26     uDefaultLanguage set_uDefaultLanguage[0..16],
27     fContextDigits set_fContextDigits[16..17],
28     fInvertPreBoundDir set_fInvertPreBoundDir[17..18],
29     fInvertPostBoundDir set_fInvertPostBoundDir[18..19],
30     fLinkStringBefore set_fLinkStringBefore[19..20],
31     fLinkStringAfter set_fLinkStringAfter[20..21],
32     fNeutralOverride set_fNeutralOverride[21..22],
33     fNumericOverride set_fNumericOverride[22..23],
34     fLegacyBidiClass set_fLegacyBidiClass[23..24],
35     fMergeNeutralItems set_fMergeNeutralItems[24..25],
36     fReserved set_fReserved[25..32],
37 ]}
38 STRUCT!{struct SCRIPT_STATE {
39     bit_fields: WORD,
40 }}
41 BITFIELD!{SCRIPT_STATE bit_fields: WORD [
42     uBidiLevel set_uBidiLevel[0..5],
43     fOverrideDirection set_fOverrideDirection[5..6],
44     fInhibitSymSwap set_fInhibitSymSwap[6..7],
45     fCharShape set_fCharShape[7..8],
46     fDigitSubstitute set_fDigitSubstitute[8..9],
47     fInhibitLigate set_fInhibitLigate[9..10],
48     fDisplayZWG set_fDisplayZWG[10..11],
49     fArabicNumContext set_fArabicNumContext[11..12],
50     fGcpClusters set_fGcpClusters[12..13],
51     fReserved set_fReserved[13..14],
52     fEngineReserved set_fEngineReserved[14..16],
53 ]}
54 STRUCT!{struct SCRIPT_ANALYSIS {
55     bit_fields: WORD,
56     s: SCRIPT_STATE,
57 }}
58 BITFIELD!{SCRIPT_ANALYSIS bit_fields: WORD [
59     eScript set_eScript[0..10],
60     fRTL set_fRTL[10..11],
61     fLayoutRTL set_fLayoutRTL[11..12],
62     fLinkBefore set_fLinkBefore[12..13],
63     fLinkAfter set_fLinkAfter[13..14],
64     fLogicalOrder set_fLogicalOrder[14..15],
65     fNoGlyphIndex set_fNoGlyphIndex[15..16],
66 ]}
67 STRUCT!{struct SCRIPT_ITEM {
68     iCharPos: c_int,
69     a: SCRIPT_ANALYSIS,
70 }}
71 extern "system" {
ScriptItemize( pwcInChars: *const WCHAR, cInChars: c_int, cMaxItems: c_int, psControl: *const SCRIPT_CONTROL, psState: *const SCRIPT_STATE, pItems: *mut SCRIPT_ITEM, pcItems: *mut c_int, ) -> HRESULT72     pub fn ScriptItemize(
73         pwcInChars: *const WCHAR,
74         cInChars: c_int,
75         cMaxItems: c_int,
76         psControl: *const SCRIPT_CONTROL,
77         psState: *const SCRIPT_STATE,
78         pItems: *mut SCRIPT_ITEM,
79         pcItems: *mut c_int,
80     ) -> HRESULT;
ScriptLayout( cRuns: c_int, pbLevel: *const BYTE, piVisualToLogical: *mut c_int, piLogicalToVisual: *mut c_int, ) -> HRESULT81     pub fn ScriptLayout(
82         cRuns: c_int,
83         pbLevel: *const BYTE,
84         piVisualToLogical: *mut c_int,
85         piLogicalToVisual: *mut c_int,
86     ) -> HRESULT;
87 }
88 pub const SCRIPT_JUSTIFY_NONE: WORD = 0;
89 pub const SCRIPT_JUSTIFY_ARABIC_BLANK: WORD = 1;
90 pub const SCRIPT_JUSTIFY_CHARACTER: WORD = 2;
91 pub const SCRIPT_JUSTIFY_RESERVED1: WORD = 3;
92 pub const SCRIPT_JUSTIFY_BLANK: WORD = 4;
93 pub const SCRIPT_JUSTIFY_RESERVED2: WORD = 5;
94 pub const SCRIPT_JUSTIFY_RESERVED3: WORD = 6;
95 pub const SCRIPT_JUSTIFY_ARABIC_NORMAL: WORD = 7;
96 pub const SCRIPT_JUSTIFY_ARABIC_KASHIDA: WORD = 8;
97 pub const SCRIPT_JUSTIFY_ARABIC_ALEF: WORD = 9;
98 pub const SCRIPT_JUSTIFY_ARABIC_HA: WORD = 10;
99 pub const SCRIPT_JUSTIFY_ARABIC_RA: WORD = 11;
100 pub const SCRIPT_JUSTIFY_ARABIC_BA: WORD = 12;
101 pub const SCRIPT_JUSTIFY_ARABIC_BARA: WORD = 13;
102 pub const SCRIPT_JUSTIFY_ARABIC_SEEN: WORD = 14;
103 pub const SCRIPT_JUSTIFY_ARABIC_SEEN_M: WORD = 15;
104 STRUCT!{struct SCRIPT_VISATTR {
105     bit_fields: WORD,
106 }}
107 BITFIELD!{SCRIPT_VISATTR bit_fields: WORD [
108     uJustification set_uJustification[0..4],
109     fClusterStart set_fClusterStart[4..5],
110     fDiacritic set_fDiacritic[5..6],
111     fZeroWidth set_fZeroWidth[6..7],
112     fReserved set_fReserved[7..8],
113     fShapeReserved set_fShapeReserved[8..16],
114 ]}
115 extern "system" {
ScriptShape( hdc: HDC, psc: *mut SCRIPT_CACHE, pwcChars: *const WCHAR, cChars: c_int, cMaxGlyphs: c_int, psa: *mut SCRIPT_ANALYSIS, pwOutGlyphs: *mut WORD, pwLogClust: *mut WORD, psva: *mut SCRIPT_VISATTR, pcGlyphs: *mut c_int, ) -> HRESULT116     pub fn ScriptShape(
117         hdc: HDC,
118         psc: *mut SCRIPT_CACHE,
119         pwcChars: *const WCHAR,
120         cChars: c_int,
121         cMaxGlyphs: c_int,
122         psa: *mut SCRIPT_ANALYSIS,
123         pwOutGlyphs: *mut WORD,
124         pwLogClust: *mut WORD,
125         psva: *mut SCRIPT_VISATTR,
126         pcGlyphs: *mut c_int,
127     ) -> HRESULT;
128 }
129 STRUCT!{struct GOFFSET {
130     du: LONG,
131     dv: LONG,
132 }}
133 extern "system" {
ScriptPlace( hdc: HDC, psc: *mut SCRIPT_CACHE, pwGlyphs: *const WORD, cGlyphs: c_int, psva: *const SCRIPT_VISATTR, psa: *mut SCRIPT_ANALYSIS, piAdvance: *mut c_int, pGoffset: *mut GOFFSET, pABC: *mut ABC, ) -> HRESULT134     pub fn ScriptPlace(
135         hdc: HDC,
136         psc: *mut SCRIPT_CACHE,
137         pwGlyphs: *const WORD,
138         cGlyphs: c_int,
139         psva: *const SCRIPT_VISATTR,
140         psa: *mut SCRIPT_ANALYSIS,
141         piAdvance: *mut c_int,
142         pGoffset: *mut GOFFSET,
143         pABC: *mut ABC,
144     ) -> HRESULT;
ScriptTextOut( hdc: HDC, psc: *mut SCRIPT_CACHE, x: c_int, y: c_int, fuOptions: UINT, lprc: *const RECT, psa: *const SCRIPT_ANALYSIS, pwcReserved: *const WCHAR, iReserved: c_int, pwGlyphs: *const WORD, cGlyphs: c_int, piAdvance: *const c_int, piJustify: *const c_int, pGoffset: *const GOFFSET, ) -> HRESULT145     pub fn ScriptTextOut(
146         hdc: HDC,
147         psc: *mut SCRIPT_CACHE,
148         x: c_int,
149         y: c_int,
150         fuOptions: UINT,
151         lprc: *const RECT,
152         psa: *const SCRIPT_ANALYSIS,
153         pwcReserved: *const WCHAR,
154         iReserved: c_int,
155         pwGlyphs: *const WORD,
156         cGlyphs: c_int,
157         piAdvance: *const c_int,
158         piJustify: *const c_int,
159         pGoffset: *const GOFFSET,
160     ) -> HRESULT;
ScriptJustify( psva: *const SCRIPT_VISATTR, piAdvance: *const c_int, cGlyphs: c_int, iDx: c_int, iMinKashida: c_int, piJustify: *mut c_int, ) -> HRESULT161     pub fn ScriptJustify(
162         psva: *const SCRIPT_VISATTR,
163         piAdvance: *const c_int,
164         cGlyphs: c_int,
165         iDx: c_int,
166         iMinKashida: c_int,
167         piJustify: *mut c_int,
168     ) -> HRESULT;
169 }
170 STRUCT!{struct SCRIPT_LOGATTR {
171     bit_fields: BYTE,
172 }}
173 BITFIELD!{SCRIPT_LOGATTR bit_fields: BYTE [
174     fSoftBreak set_fSoftBreak[0..1],
175     fWhiteSpace set_fWhiteSpace[1..2],
176     fCharStop set_fCharStop[2..3],
177     fWordStop set_fWordStop[3..4],
178     fInvalid set_fInvalid[4..5],
179     fReserved set_fReserved[5..8],
180 ]}
181 extern "system" {
ScriptBreak( pwcChars: *const WCHAR, cChars: c_int, psa: *const SCRIPT_ANALYSIS, psla: *mut SCRIPT_LOGATTR, ) -> HRESULT182     pub fn ScriptBreak(
183         pwcChars: *const WCHAR,
184         cChars: c_int,
185         psa: *const SCRIPT_ANALYSIS,
186         psla: *mut SCRIPT_LOGATTR,
187     ) -> HRESULT;
ScriptCPtoX( iCP: c_int, fTrailing: BOOL, cChars: c_int, cGlyphs: c_int, pwLogClust: *const WORD, psva: *const SCRIPT_VISATTR, piAdvance: *const c_int, psa: *const SCRIPT_ANALYSIS, piX: *mut c_int, ) -> HRESULT188     pub fn ScriptCPtoX(
189         iCP: c_int,
190         fTrailing: BOOL,
191         cChars: c_int,
192         cGlyphs: c_int,
193         pwLogClust: *const WORD,
194         psva: *const SCRIPT_VISATTR,
195         piAdvance: *const c_int,
196         psa: *const SCRIPT_ANALYSIS,
197         piX: *mut c_int,
198     ) -> HRESULT;
ScriptXtoCP( iX: c_int, cChars: c_int, cGlyphs: c_int, pwLogClust: *const WORD, psva: *const SCRIPT_VISATTR, piAdvance: *const c_int, psa: *const SCRIPT_ANALYSIS, piCP: *mut c_int, piTrailing: *mut c_int, ) -> HRESULT199     pub fn ScriptXtoCP(
200         iX: c_int,
201         cChars: c_int,
202         cGlyphs: c_int,
203         pwLogClust: *const WORD,
204         psva: *const SCRIPT_VISATTR,
205         piAdvance: *const c_int,
206         psa: *const SCRIPT_ANALYSIS,
207         piCP: *mut c_int,
208         piTrailing: *mut c_int,
209     ) -> HRESULT;
ScriptGetLogicalWidths( psa: *const SCRIPT_ANALYSIS, cChars: c_int, cGlyphs: c_int, piGlyphWidth: *const c_int, pwLogClust: *const WORD, psva: *const SCRIPT_VISATTR, piDx: *mut c_int, ) -> HRESULT210     pub fn ScriptGetLogicalWidths(
211         psa: *const SCRIPT_ANALYSIS,
212         cChars: c_int,
213         cGlyphs: c_int,
214         piGlyphWidth: *const c_int,
215         pwLogClust: *const WORD,
216         psva: *const SCRIPT_VISATTR,
217         piDx: *mut c_int,
218     ) -> HRESULT;
ScriptApplyLogicalWidth( piDx: *const c_int, cChars: c_int, cGlyphs: c_int, pwLogClust: *const WORD, psva: *const SCRIPT_VISATTR, piAdvance: *const c_int, psa: *const SCRIPT_ANALYSIS, pABC: *mut ABC, piJustify: *mut c_int, ) -> HRESULT219     pub fn ScriptApplyLogicalWidth(
220         piDx: *const c_int,
221         cChars: c_int,
222         cGlyphs: c_int,
223         pwLogClust: *const WORD,
224         psva: *const SCRIPT_VISATTR,
225         piAdvance: *const c_int,
226         psa: *const SCRIPT_ANALYSIS,
227         pABC: *mut ABC,
228         piJustify: *mut c_int,
229     ) -> HRESULT;
230 }
231 pub const SGCM_RTL: DWORD = 0x00000001;
232 extern "system" {
ScriptGetCMap( hdc: HDC, psc: *mut SCRIPT_CACHE, pwcInChars: *const WCHAR, cChars: c_int, dwFlags: DWORD, pwOutGlyphs: *mut WORD, ) -> HRESULT233     pub fn ScriptGetCMap(
234         hdc: HDC,
235         psc: *mut SCRIPT_CACHE,
236         pwcInChars: *const WCHAR,
237         cChars: c_int,
238         dwFlags: DWORD,
239         pwOutGlyphs: *mut WORD,
240     ) -> HRESULT;
ScriptGetGlyphABCWidth( hdc: HDC, psc: *mut SCRIPT_CACHE, wGlyph: WORD, pABC: *mut ABC, ) -> HRESULT241     pub fn ScriptGetGlyphABCWidth(
242         hdc: HDC,
243         psc: *mut SCRIPT_CACHE,
244         wGlyph: WORD,
245         pABC: *mut ABC,
246     ) -> HRESULT;
247 }
248 STRUCT!{struct SCRIPT_PROPERTIES {
249     bit_fields1: DWORD,
250     bit_fields2: DWORD,
251 }}
252 BITFIELD!{SCRIPT_PROPERTIES bit_fields1: DWORD [
253     langid set_langid[0..16],
254     fNumeric set_fNumeric[16..17],
255     fComplex set_fComplex[17..18],
256     fNeedsWordBreaking set_fNeedsWordBreaking[18..19],
257     fNeedsCaretInfo set_fNeedsCaretInfo[19..20],
258     bCharSet set_bCharSet[20..28],
259     fControl set_fControl[28..29],
260     fPrivateUseArea set_fPrivateUseArea[29..30],
261     fNeedsCharacterJustify set_fNeedsCharacterJustify[30..31],
262     fInvalidGlyph set_fInvalidGlyph[31..32],
263 ]}
264 BITFIELD!{SCRIPT_PROPERTIES bit_fields2: DWORD [
265     fInvalidLogAttr set_fInvalidLogAttr[0..1],
266     fCDM set_fCDM[1..2],
267     fAmbiguousCharSet set_fAmbiguousCharSet[2..3],
268     fClusterSizeVaries set_fClusterSizeVaries[3..4],
269     fRejectInvalid set_fRejectInvalid[4..5],
270 ]}
271 extern "system" {
ScriptGetProperties( ppSp: *mut *mut *const SCRIPT_PROPERTIES, piNumScripts: *mut c_int, ) -> HRESULT272     pub fn ScriptGetProperties(
273         ppSp: *mut *mut *const SCRIPT_PROPERTIES,
274         piNumScripts: *mut c_int,
275     ) -> HRESULT;
276 }
277 STRUCT!{struct SCRIPT_FONTPROPERTIES {
278     cBytes: c_int,
279     wgBlank: WORD,
280     wgDefault: WORD,
281     wgInvalid: WORD,
282     wgKashida: WORD,
283     iKashidaWidth: c_int,
284 }}
285 extern "system" {
ScriptGetFontProperties( hdc: HDC, psc: *mut SCRIPT_CACHE, sfp: *mut SCRIPT_FONTPROPERTIES, ) -> HRESULT286     pub fn ScriptGetFontProperties(
287         hdc: HDC,
288         psc: *mut SCRIPT_CACHE,
289         sfp: *mut SCRIPT_FONTPROPERTIES,
290     ) -> HRESULT;
ScriptCacheGetHeight( hdc: HDC, psc: *mut SCRIPT_CACHE, tmHeight: *mut c_long, ) -> HRESULT291     pub fn ScriptCacheGetHeight(
292         hdc: HDC,
293         psc: *mut SCRIPT_CACHE,
294         tmHeight: *mut c_long,
295     ) -> HRESULT;
296 }
297 pub const SSA_PASSWORD: DWORD = 0x00000001;
298 pub const SSA_TAB: DWORD = 0x00000002;
299 pub const SSA_CLIP: DWORD = 0x00000004;
300 pub const SSA_FIT: DWORD = 0x00000008;
301 pub const SSA_DZWG: DWORD = 0x00000010;
302 pub const SSA_FALLBACK: DWORD = 0x00000020;
303 pub const SSA_BREAK: DWORD = 0x00000040;
304 pub const SSA_GLYPHS: DWORD = 0x00000080;
305 pub const SSA_RTL: DWORD = 0x00000100;
306 pub const SSA_GCP: DWORD = 0x00000200;
307 pub const SSA_HOTKEY: DWORD = 0x00000400;
308 pub const SSA_METAFILE: DWORD = 0x00000800;
309 pub const SSA_LINK: DWORD = 0x00001000;
310 pub const SSA_HIDEHOTKEY: DWORD = 0x00002000;
311 pub const SSA_HOTKEYONLY: DWORD = 0x00002400;
312 pub const SSA_FULLMEASURE: DWORD = 0x04000000;
313 pub const SSA_LPKANSIFALLBACK: DWORD = 0x08000000;
314 pub const SSA_PIDX: DWORD = 0x10000000;
315 pub const SSA_LAYOUTRTL: DWORD = 0x20000000;
316 pub const SSA_DONTGLYPH: DWORD = 0x40000000;
317 pub const SSA_NOKASHIDA: DWORD = 0x80000000;
318 STRUCT!{struct SCRIPT_TABDEF {
319     cTabStops: c_int,
320     iScale: c_int,
321     pTabStops: *mut c_int,
322     iTabOrigin: c_int,
323 }}
324 DECLARE_HANDLE!{SCRIPT_STRING_ANALYSIS, SCRIPT_STRING_ANALYSIS__}
325 extern "system" {
ScriptStringAnalyse( hdc: HDC, pString: *const c_void, cString: c_int, cGlyphs: c_int, iCharset: c_int, dwFlags: DWORD, iReqWidth: c_int, psControl: *mut SCRIPT_CONTROL, psState: *mut SCRIPT_STATE, piDx: *const c_int, pTabdef: *mut SCRIPT_TABDEF, pbInClass: *const BYTE, pssa: *mut SCRIPT_STRING_ANALYSIS, ) -> HRESULT326     pub fn ScriptStringAnalyse(
327         hdc: HDC,
328         pString: *const c_void,
329         cString: c_int,
330         cGlyphs: c_int,
331         iCharset: c_int,
332         dwFlags: DWORD,
333         iReqWidth: c_int,
334         psControl: *mut SCRIPT_CONTROL,
335         psState: *mut SCRIPT_STATE,
336         piDx: *const c_int,
337         pTabdef: *mut SCRIPT_TABDEF,
338         pbInClass: *const BYTE,
339         pssa: *mut SCRIPT_STRING_ANALYSIS,
340     ) -> HRESULT;
ScriptStringFree( pssa: *mut SCRIPT_STRING_ANALYSIS, ) -> HRESULT341     pub fn ScriptStringFree(
342         pssa: *mut SCRIPT_STRING_ANALYSIS,
343     ) -> HRESULT;
ScriptString_pSize( ssa: SCRIPT_STRING_ANALYSIS, ) -> *const SIZE344     pub fn ScriptString_pSize(
345         ssa: SCRIPT_STRING_ANALYSIS,
346     ) -> *const SIZE;
ScriptString_pcOutChars( ssa: SCRIPT_STRING_ANALYSIS, ) -> *const c_int347     pub fn ScriptString_pcOutChars(
348         ssa: SCRIPT_STRING_ANALYSIS,
349     ) -> *const c_int;
ScriptString_pLogAttr( ssa: SCRIPT_STRING_ANALYSIS, ) -> *const SCRIPT_LOGATTR350     pub fn ScriptString_pLogAttr(
351         ssa: SCRIPT_STRING_ANALYSIS,
352     ) -> *const SCRIPT_LOGATTR;
ScriptStringGetOrder( ssa: SCRIPT_STRING_ANALYSIS, puOrder: *mut UINT, ) -> HRESULT353     pub fn ScriptStringGetOrder(
354         ssa: SCRIPT_STRING_ANALYSIS,
355         puOrder: *mut UINT,
356     ) -> HRESULT;
ScriptStringCPtoX( ssa: SCRIPT_STRING_ANALYSIS, icp: c_int, fTrailing: BOOL, pX: *mut c_int, ) -> HRESULT357     pub fn ScriptStringCPtoX(
358         ssa: SCRIPT_STRING_ANALYSIS,
359         icp: c_int,
360         fTrailing: BOOL,
361         pX: *mut c_int,
362     ) -> HRESULT;
ScriptStringXtoCP( ssa: SCRIPT_STRING_ANALYSIS, iX: c_int, piCh: *mut c_int, piTrailing: *mut c_int, ) -> HRESULT363     pub fn ScriptStringXtoCP(
364         ssa: SCRIPT_STRING_ANALYSIS,
365         iX: c_int,
366         piCh: *mut c_int,
367         piTrailing: *mut c_int,
368     ) -> HRESULT;
ScriptStringGetLogicalWidths( ssa: SCRIPT_STRING_ANALYSIS, dpiDx: *mut c_int, ) -> HRESULT369     pub fn ScriptStringGetLogicalWidths(
370         ssa: SCRIPT_STRING_ANALYSIS,
371         dpiDx: *mut c_int,
372     ) -> HRESULT;
ScriptStringValidate( ssa: SCRIPT_STRING_ANALYSIS, ) -> HRESULT373     pub fn ScriptStringValidate(
374         ssa: SCRIPT_STRING_ANALYSIS,
375     ) -> HRESULT;
ScriptStringOut( ssa: SCRIPT_STRING_ANALYSIS, iX: c_int, iY: c_int, uOptions: UINT, prc: *const RECT, iMinSel: c_int, iMaxSel: c_int, fDisabled: BOOL, ) -> HRESULT376     pub fn ScriptStringOut(
377         ssa: SCRIPT_STRING_ANALYSIS,
378         iX: c_int,
379         iY: c_int,
380         uOptions: UINT,
381         prc: *const RECT,
382         iMinSel: c_int,
383         iMaxSel: c_int,
384         fDisabled: BOOL,
385     ) -> HRESULT;
386 }
387 pub const SIC_COMPLEX: DWORD = 1;
388 pub const SIC_ASCIIDIGIT: DWORD = 2;
389 pub const SIC_NEUTRAL: DWORD = 4;
390 extern "system" {
ScriptIsComplex( pwcInChars: *const WCHAR, cInChars: c_int, dwFlags: DWORD, ) -> HRESULT391     pub fn ScriptIsComplex(
392         pwcInChars: *const WCHAR,
393         cInChars: c_int,
394         dwFlags: DWORD,
395     ) -> HRESULT;
396 }
397 STRUCT!{struct SCRIPT_DIGITSUBSTITUTE {
398     bit_fields1: DWORD,
399     bit_fields2: DWORD,
400     dwReserved: DWORD,
401 }}
402 BITFIELD!{SCRIPT_DIGITSUBSTITUTE bit_fields1: DWORD [
403     NationalDigitLanguage set_NationalDigitLanguage[0..16],
404     TraditionalDigitLanguage set_TraditionalDigitLanguage[16..32],
405 ]}
406 BITFIELD!{SCRIPT_DIGITSUBSTITUTE bit_fields2: DWORD [
407     DigitSubstitute set_DigitSubstitute[0..8],
408 ]}
409 extern "system" {
ScriptRecordDigitSubstitution( Locale: LCID, psds: *mut SCRIPT_DIGITSUBSTITUTE, ) -> HRESULT410     pub fn ScriptRecordDigitSubstitution(
411         Locale: LCID,
412         psds: *mut SCRIPT_DIGITSUBSTITUTE,
413     ) -> HRESULT;
414 }
415 pub const SCRIPT_DIGITSUBSTITUTE_CONTEXT: BYTE = 0;
416 pub const SCRIPT_DIGITSUBSTITUTE_NONE: BYTE = 1;
417 pub const SCRIPT_DIGITSUBSTITUTE_NATIONAL: BYTE = 2;
418 pub const SCRIPT_DIGITSUBSTITUTE_TRADITIONAL: BYTE = 3;
419 extern "system" {
ScriptApplyDigitSubstitution( psds: *const SCRIPT_DIGITSUBSTITUTE, psc: *mut SCRIPT_CONTROL, pss: *mut SCRIPT_STATE, ) -> HRESULT420     pub fn ScriptApplyDigitSubstitution(
421         psds: *const SCRIPT_DIGITSUBSTITUTE,
422         psc: *mut SCRIPT_CONTROL,
423         pss: *mut SCRIPT_STATE,
424     ) -> HRESULT;
425 }
426 pub type OPENTYPE_TAG = ULONG;
427 pub const SCRIPT_TAG_UNKNOWN: OPENTYPE_TAG = 0x00000000;
428 STRUCT!{struct OPENTYPE_FEATURE_RECORD {
429     tagFeature: OPENTYPE_TAG,
430     lParameter: LONG,
431 }}
432 STRUCT!{struct TEXTRANGE_PROPERTIES {
433     potfRecords: *mut OPENTYPE_FEATURE_RECORD,
434     cotfRecords: c_int,
435 }}
436 STRUCT!{struct SCRIPT_CHARPROP {
437     bit_fields: WORD,
438 }}
439 BITFIELD!{SCRIPT_CHARPROP bit_fields: WORD [
440     fCanGlyphAlone set_fCanGlyphAlone[0..1],
441     reserved set_reserved[1..16],
442 ]}
443 STRUCT!{struct SCRIPT_GLYPHPROP {
444     sva: SCRIPT_VISATTR,
445     reserved: WORD,
446 }}
447 extern "system" {
ScriptShapeOpenType( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, tagLangSys: OPENTYPE_TAG, rcRangeChars: *mut c_int, rpRangeProperties: *mut *mut TEXTRANGE_PROPERTIES, cRanges: c_int, pwcChars: *const WCHAR, cChars: c_int, cMaxGlyphs: c_int, pwLogClust: *mut WORD, pCharProps: *mut SCRIPT_CHARPROP, pwOutGlyphs: *mut WORD, pOutGlyphProps: *mut SCRIPT_GLYPHPROP, pcGlyphs: *mut c_int, ) -> HRESULT448     pub fn ScriptShapeOpenType(
449         hdc: HDC,
450         psc: *mut SCRIPT_CACHE,
451         psa: *mut SCRIPT_ANALYSIS,
452         tagScript: OPENTYPE_TAG,
453         tagLangSys: OPENTYPE_TAG,
454         rcRangeChars: *mut c_int,
455         rpRangeProperties: *mut *mut TEXTRANGE_PROPERTIES,
456         cRanges: c_int,
457         pwcChars: *const WCHAR,
458         cChars: c_int,
459         cMaxGlyphs: c_int,
460         pwLogClust: *mut WORD,
461         pCharProps: *mut SCRIPT_CHARPROP,
462         pwOutGlyphs: *mut WORD,
463         pOutGlyphProps: *mut SCRIPT_GLYPHPROP,
464         pcGlyphs: *mut c_int,
465     ) -> HRESULT;
ScriptPlaceOpenType( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, tagLangSys: OPENTYPE_TAG, rcRangeChars: *mut c_int, rpRangeProperties: *mut *mut TEXTRANGE_PROPERTIES, cRanges: c_int, pwcChars: *const WCHAR, pwLogClust: *mut WORD, pCharProps: *mut SCRIPT_CHARPROP, cChars: c_int, pwGlyphs: *const WORD, pGlyphProps: *const SCRIPT_GLYPHPROP, cGlyphs: c_int, piAdvance: *mut c_int, pGoffset: *mut GOFFSET, pABC: *mut ABC, ) -> HRESULT466     pub fn ScriptPlaceOpenType(
467         hdc: HDC,
468         psc: *mut SCRIPT_CACHE,
469         psa: *mut SCRIPT_ANALYSIS,
470         tagScript: OPENTYPE_TAG,
471         tagLangSys: OPENTYPE_TAG,
472         rcRangeChars: *mut c_int,
473         rpRangeProperties: *mut *mut TEXTRANGE_PROPERTIES,
474         cRanges: c_int,
475         pwcChars: *const WCHAR,
476         pwLogClust: *mut WORD,
477         pCharProps: *mut SCRIPT_CHARPROP,
478         cChars: c_int,
479         pwGlyphs: *const WORD,
480         pGlyphProps: *const SCRIPT_GLYPHPROP,
481         cGlyphs: c_int,
482         piAdvance: *mut c_int,
483         pGoffset: *mut GOFFSET,
484         pABC: *mut ABC,
485     ) -> HRESULT;
ScriptItemizeOpenType( pwcInChars: *const WCHAR, cInChars: c_int, cMaxItems: c_int, psControl: *const SCRIPT_CONTROL, psState: *const SCRIPT_STATE, pItems: *mut SCRIPT_ITEM, pScriptTags: *mut OPENTYPE_TAG, pcItems: *mut c_int, ) -> HRESULT486     pub fn ScriptItemizeOpenType(
487         pwcInChars: *const WCHAR,
488         cInChars: c_int,
489         cMaxItems: c_int,
490         psControl: *const SCRIPT_CONTROL,
491         psState: *const SCRIPT_STATE,
492         pItems: *mut SCRIPT_ITEM,
493         pScriptTags: *mut OPENTYPE_TAG,
494         pcItems: *mut c_int,
495     ) -> HRESULT;
ScriptGetFontScriptTags( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, cMaxTags: c_int, pScriptTags: *mut OPENTYPE_TAG, pcTags: *mut c_int, ) -> HRESULT496     pub fn ScriptGetFontScriptTags(
497         hdc: HDC,
498         psc: *mut SCRIPT_CACHE,
499         psa: *mut SCRIPT_ANALYSIS,
500         cMaxTags: c_int,
501         pScriptTags: *mut OPENTYPE_TAG,
502         pcTags: *mut c_int,
503     ) -> HRESULT;
ScriptGetFontLanguageTags( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, cMaxTags: c_int, pLangsysTags: *mut OPENTYPE_TAG, pcTags: *mut c_int, ) -> HRESULT504     pub fn ScriptGetFontLanguageTags(
505         hdc: HDC,
506         psc: *mut SCRIPT_CACHE,
507         psa: *mut SCRIPT_ANALYSIS,
508         tagScript: OPENTYPE_TAG,
509         cMaxTags: c_int,
510         pLangsysTags: *mut OPENTYPE_TAG,
511         pcTags: *mut c_int,
512     ) -> HRESULT;
ScriptGetFontFeatureTags( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, tagLangSys: OPENTYPE_TAG, cMaxTags: c_int, pFeatureTags: *mut OPENTYPE_TAG, pcTags: *mut c_int, ) -> HRESULT513     pub fn ScriptGetFontFeatureTags(
514         hdc: HDC,
515         psc: *mut SCRIPT_CACHE,
516         psa: *mut SCRIPT_ANALYSIS,
517         tagScript: OPENTYPE_TAG,
518         tagLangSys: OPENTYPE_TAG,
519         cMaxTags: c_int,
520         pFeatureTags: *mut OPENTYPE_TAG,
521         pcTags: *mut c_int,
522     ) -> HRESULT;
ScriptGetFontAlternateGlyphs( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, tagLangSys: OPENTYPE_TAG, tagFeature: OPENTYPE_TAG, wGlyphId: WORD, cMaxAlternates: c_int, pAlternateGlyphs: *mut WORD, pcAlternates: *mut c_int, ) -> HRESULT523     pub fn ScriptGetFontAlternateGlyphs(
524         hdc: HDC,
525         psc: *mut SCRIPT_CACHE,
526         psa: *mut SCRIPT_ANALYSIS,
527         tagScript: OPENTYPE_TAG,
528         tagLangSys: OPENTYPE_TAG,
529         tagFeature: OPENTYPE_TAG,
530         wGlyphId: WORD,
531         cMaxAlternates: c_int,
532         pAlternateGlyphs: *mut WORD,
533         pcAlternates: *mut c_int,
534     ) -> HRESULT;
ScriptSubstituteSingleGlyph( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, tagLangSys: OPENTYPE_TAG, tagFeature: OPENTYPE_TAG, lParameter: LONG, wGlyphId: WORD, pwOutGlyphId: *mut WORD, ) -> HRESULT535     pub fn ScriptSubstituteSingleGlyph(
536         hdc: HDC,
537         psc: *mut SCRIPT_CACHE,
538         psa: *mut SCRIPT_ANALYSIS,
539         tagScript: OPENTYPE_TAG,
540         tagLangSys: OPENTYPE_TAG,
541         tagFeature: OPENTYPE_TAG,
542         lParameter: LONG,
543         wGlyphId: WORD,
544         pwOutGlyphId: *mut WORD,
545     ) -> HRESULT;
ScriptPositionSingleGlyph( hdc: HDC, psc: *mut SCRIPT_CACHE, psa: *mut SCRIPT_ANALYSIS, tagScript: OPENTYPE_TAG, tagLangSys: OPENTYPE_TAG, tagFeature: OPENTYPE_TAG, lParameter: LONG, wGlyphId: WORD, iAdvance: c_int, GOffset: GOFFSET, piOutAdvance: *mut c_int, pOutGoffset: *mut GOFFSET, ) -> HRESULT546     pub fn ScriptPositionSingleGlyph(
547         hdc: HDC,
548         psc: *mut SCRIPT_CACHE,
549         psa: *mut SCRIPT_ANALYSIS,
550         tagScript: OPENTYPE_TAG,
551         tagLangSys: OPENTYPE_TAG,
552         tagFeature: OPENTYPE_TAG,
553         lParameter: LONG,
554         wGlyphId: WORD,
555         iAdvance: c_int,
556         GOffset: GOFFSET,
557         piOutAdvance: *mut c_int,
558         pOutGoffset: *mut GOFFSET,
559     ) -> HRESULT;
560 }
561