1 // Copyright © 2015, Jordan Miner
2 // Licensed under the MIT License <LICENSE.md>
3 //! Uniscribe structure declarations and constant definitions
4 pub const SCRIPT_UNDEFINED: ::WORD = 0;
5 pub const USP_E_SCRIPT_NOT_IN_FONT: ::HRESULT = MAKE_HRESULT!(
6     ::SEVERITY_ERROR, ::FACILITY_ITF, 0x200
7 );
8 DECLARE_HANDLE!(SCRIPT_CACHE, SCRIPT_CACHE__);
9 STRUCT!{struct SCRIPT_CONTROL {
10     bit_fields: ::DWORD,
11 }}
12 BITFIELD!(SCRIPT_CONTROL bit_fields: ::DWORD [
13     uDefaultLanguage set_uDefaultLanguage[0..16],
14     fContextDigits set_fContextDigits[16..17],
15     fInvertPreBoundDir set_fInvertPreBoundDir[17..18],
16     fInvertPostBoundDir set_fInvertPostBoundDir[18..19],
17     fLinkStringBefore set_fLinkStringBefore[19..20],
18     fLinkStringAfter set_fLinkStringAfter[20..21],
19     fNeutralOverride set_fNeutralOverride[21..22],
20     fNumericOverride set_fNumericOverride[22..23],
21     fLegacyBidiClass set_fLegacyBidiClass[23..24],
22     fMergeNeutralItems set_fMergeNeutralItems[24..25],
23     fReserved set_fReserved[25..32],
24 ]);
25 STRUCT!{struct SCRIPT_STATE {
26     bit_fields: ::WORD,
27 }}
28 BITFIELD!(SCRIPT_STATE bit_fields: ::WORD [
29     uBidiLevel set_uBidiLevel[0..5],
30     fOverrideDirection set_fOverrideDirection[5..6],
31     fInhibitSymSwap set_fInhibitSymSwap[6..7],
32     fCharShape set_fCharShape[7..8],
33     fDigitSubstitute set_fDigitSubstitute[8..9],
34     fInhibitLigate set_fInhibitLigate[9..10],
35     fDisplayZWG set_fDisplayZWG[10..11],
36     fArabicNumContext set_fArabicNumContext[11..12],
37     fGcpClusters set_fGcpClusters[12..13],
38     fReserved set_fReserved[13..14],
39     fEngineReserved set_fEngineReserved[14..16],
40 ]);
41 STRUCT!{struct SCRIPT_ANALYSIS {
42     bit_fields: ::WORD,
43     s: SCRIPT_STATE,
44 }}
45 BITFIELD!(SCRIPT_ANALYSIS bit_fields: ::WORD [
46     eScript set_eScript[0..10],
47     fRTL set_fRTL[10..11],
48     fLayoutRTL set_fLayoutRTL[11..12],
49     fLinkBefore set_fLinkBefore[12..13],
50     fLinkAfter set_fLinkAfter[13..14],
51     fLogicalOrder set_fLogicalOrder[14..15],
52     fNoGlyphIndex set_fNoGlyphIndex[15..16],
53 ]);
54 STRUCT!{struct SCRIPT_ITEM {
55     iCharPos: ::c_int,
56     a: SCRIPT_ANALYSIS,
57 }}
58 //490
59 pub const SCRIPT_JUSTIFY_NONE: ::WORD = 0;
60 pub const SCRIPT_JUSTIFY_ARABIC_BLANK: ::WORD = 1;
61 pub const SCRIPT_JUSTIFY_CHARACTER: ::WORD = 2;
62 pub const SCRIPT_JUSTIFY_RESERVED1: ::WORD = 3;
63 pub const SCRIPT_JUSTIFY_BLANK: ::WORD = 4;
64 pub const SCRIPT_JUSTIFY_RESERVED2: ::WORD = 5;
65 pub const SCRIPT_JUSTIFY_RESERVED3: ::WORD = 6;
66 pub const SCRIPT_JUSTIFY_ARABIC_NORMAL: ::WORD = 7;
67 pub const SCRIPT_JUSTIFY_ARABIC_KASHIDA: ::WORD = 8;
68 pub const SCRIPT_JUSTIFY_ARABIC_ALEF: ::WORD = 9;
69 pub const SCRIPT_JUSTIFY_ARABIC_HA: ::WORD = 10;
70 pub const SCRIPT_JUSTIFY_ARABIC_RA: ::WORD = 11;
71 pub const SCRIPT_JUSTIFY_ARABIC_BA: ::WORD = 12;
72 pub const SCRIPT_JUSTIFY_ARABIC_BARA: ::WORD = 13;
73 pub const SCRIPT_JUSTIFY_ARABIC_SEEN: ::WORD = 14;
74 pub const SCRIPT_JUSTIFY_ARABIC_SEEN_M: ::WORD = 15;
75 STRUCT!{struct SCRIPT_VISATTR {
76     bit_fields: ::WORD,
77 }}
78 BITFIELD!(SCRIPT_VISATTR bit_fields: ::WORD [
79     uJustification set_uJustification[0..4],
80     fClusterStart set_fClusterStart[4..5],
81     fDiacritic set_fDiacritic[5..6],
82     fZeroWidth set_fZeroWidth[6..7],
83     fReserved set_fReserved[7..8],
84     fShapeReserved set_fShapeReserved[8..16],
85 ]);
86 STRUCT!{struct GOFFSET {
87     du: ::LONG,
88     dv: ::LONG,
89 }}
90 STRUCT!{struct SCRIPT_LOGATTR {
91     bit_fields: ::BYTE,
92 }}
93 BITFIELD!(SCRIPT_LOGATTR bit_fields: ::BYTE [
94     fSoftBreak set_fSoftBreak[0..1],
95     fWhiteSpace set_fWhiteSpace[1..2],
96     fCharStop set_fCharStop[2..3],
97     fWordStop set_fWordStop[3..4],
98     fInvalid set_fInvalid[4..5],
99     fReserved set_fReserved[5..8],
100 ]);
101 pub const SGCM_RTL: ::DWORD = 0x00000001;
102 STRUCT!{struct SCRIPT_PROPERTIES {
103     bit_fields1: ::DWORD,
104     bit_fields2: ::DWORD,
105 }}
106 BITFIELD!(SCRIPT_PROPERTIES bit_fields1: ::DWORD [
107     langid set_langid[0..16],
108     fNumeric set_fNumeric[16..17],
109     fComplex set_fComplex[17..18],
110     fNeedsWordBreaking set_fNeedsWordBreaking[18..19],
111     fNeedsCaretInfo set_fNeedsCaretInfo[19..20],
112     bCharSet set_bCharSet[20..28],
113     fControl set_fControl[28..29],
114     fPrivateUseArea set_fPrivateUseArea[29..30],
115     fNeedsCharacterJustify set_fNeedsCharacterJustify[30..31],
116     fInvalidGlyph set_fInvalidGlyph[31..32],
117 ]);
118 BITFIELD!(SCRIPT_PROPERTIES bit_fields2: ::DWORD [
119     fInvalidLogAttr set_fInvalidLogAttr[0..1],
120     fCDM set_fCDM[1..2],
121     fAmbiguousCharSet set_fAmbiguousCharSet[2..3],
122     fClusterSizeVaries set_fClusterSizeVaries[3..4],
123     fRejectInvalid set_fRejectInvalid[4..5],
124 ]);
125 STRUCT!{struct SCRIPT_FONTPROPERTIES {
126     cBytes: ::c_int,
127     wgBlank: ::WORD,
128     wgDefault: ::WORD,
129     wgInvalid: ::WORD,
130     wgKashida: ::WORD,
131     iKashidaWidth: ::c_int,
132 }}
133 //1440
134 pub const SSA_PASSWORD: ::DWORD = 0x00000001;
135 pub const SSA_TAB: ::DWORD = 0x00000002;
136 pub const SSA_CLIP: ::DWORD = 0x00000004;
137 pub const SSA_FIT: ::DWORD = 0x00000008;
138 pub const SSA_DZWG: ::DWORD = 0x00000010;
139 pub const SSA_FALLBACK: ::DWORD = 0x00000020;
140 pub const SSA_BREAK: ::DWORD = 0x00000040;
141 pub const SSA_GLYPHS: ::DWORD = 0x00000080;
142 pub const SSA_RTL: ::DWORD = 0x00000100;
143 pub const SSA_GCP: ::DWORD = 0x00000200;
144 pub const SSA_HOTKEY: ::DWORD = 0x00000400;
145 pub const SSA_METAFILE: ::DWORD = 0x00000800;
146 pub const SSA_LINK: ::DWORD = 0x00001000;
147 pub const SSA_HIDEHOTKEY: ::DWORD = 0x00002000;
148 pub const SSA_HOTKEYONLY: ::DWORD = 0x00002400;
149 pub const SSA_FULLMEASURE: ::DWORD = 0x04000000;
150 pub const SSA_LPKANSIFALLBACK: ::DWORD = 0x08000000;
151 pub const SSA_PIDX: ::DWORD = 0x10000000;
152 pub const SSA_LAYOUTRTL: ::DWORD = 0x20000000;
153 pub const SSA_DONTGLYPH: ::DWORD = 0x40000000;
154 pub const SSA_NOKASHIDA: ::DWORD = 0x80000000;
155 STRUCT!{struct SCRIPT_TABDEF {
156     cTabStops: ::c_int,
157     iScale: ::c_int,
158     pTabStops: *mut ::c_int,
159     iTabOrigin: ::c_int,
160 }}
161 DECLARE_HANDLE!(SCRIPT_STRING_ANALYSIS, SCRIPT_STRING_ANALYSIS__);
162 pub const SIC_COMPLEX: ::DWORD = 1;
163 pub const SIC_ASCIIDIGIT: ::DWORD = 2;
164 pub const SIC_NEUTRAL: ::DWORD = 4;
165 STRUCT!{struct SCRIPT_DIGITSUBSTITUTE {
166     bit_fields1: ::DWORD,
167     bit_fields2: ::DWORD,
168     dwReserved: ::DWORD,
169 }}
170 BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields1: ::DWORD [
171     NationalDigitLanguage set_NationalDigitLanguage[0..16],
172     TraditionalDigitLanguage set_TraditionalDigitLanguage[16..32],
173 ]);
174 BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields2: ::DWORD [
175     DigitSubstitute set_DigitSubstitute[0..8],
176 ]);
177 pub const SCRIPT_DIGITSUBSTITUTE_CONTEXT: ::BYTE = 0;
178 pub const SCRIPT_DIGITSUBSTITUTE_NONE: ::BYTE = 1;
179 pub const SCRIPT_DIGITSUBSTITUTE_NATIONAL: ::BYTE = 2;
180 pub const SCRIPT_DIGITSUBSTITUTE_TRADITIONAL: ::BYTE = 3;
181 pub type OPENTYPE_TAG = ::ULONG;
182 pub const SCRIPT_TAG_UNKNOWN: OPENTYPE_TAG = 0x00000000;
183 STRUCT!{struct OPENTYPE_FEATURE_RECORD {
184     tagFeature: OPENTYPE_TAG,
185     lParameter: ::LONG,
186 }}
187 STRUCT!{struct TEXTRANGE_PROPERTIES {
188     potfRecords: *mut OPENTYPE_FEATURE_RECORD,
189     cotfRecords: ::c_int,
190 }}
191 STRUCT!{struct SCRIPT_CHARPROP {
192     bit_fields: ::WORD,
193 }}
194 BITFIELD!(SCRIPT_CHARPROP bit_fields: ::WORD [
195     fCanGlyphAlone set_fCanGlyphAlone[0..1],
196     reserved set_reserved[1..16],
197 ]);
198 STRUCT!{struct SCRIPT_GLYPHPROP {
199     sva: SCRIPT_VISATTR,
200     reserved: ::WORD,
201 }}
202