• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file is part of the mingw-w64 runtime package.
3  * No warranty is given; refer to the file DISCLAIMER within this package.
4  */
5 
6 #ifndef __usp10__
7 #define __usp10__
8 
9 #include <winapifamily.h>
10 
11 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
12 
13 #include <windows.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #define USPBUILD 0400
20 #define SCRIPT_UNDEFINED 0
21 
22 #if !defined (UNISCRIBE_OPENTYPE) && (_WIN32_WINNT >= 0x0600)
23 #define UNISCRIBE_OPENTYPE 0x0100
24 #endif
25 
26 #if UNISCRIBE_OPENTYPE >= 0x0100
27 #define SCRIPT_TAG_UNKNOWN 0x00000000
28 #endif
29 
30 #define USP_E_SCRIPT_NOT_IN_FONT MAKE_HRESULT (SEVERITY_ERROR, FACILITY_ITF, 0x200)
31 
32 #define SGCM_RTL 0x00000001
33 
34 #define SSA_PASSWORD 0x00000001
35 #define SSA_TAB 0x00000002
36 #define SSA_CLIP 0x00000004
37 #define SSA_FIT 0x00000008
38 #define SSA_DZWG 0x00000010
39 #define SSA_FALLBACK 0x00000020
40 #define SSA_BREAK 0x00000040
41 #define SSA_GLYPHS 0x00000080
42 #define SSA_RTL 0x00000100
43 #define SSA_GCP 0x00000200
44 #define SSA_HOTKEY 0x00000400
45 #define SSA_METAFILE 0x00000800
46 #define SSA_LINK 0x00001000
47 #define SSA_HIDEHOTKEY 0x00002000
48 #define SSA_HOTKEYONLY 0x00002400
49 #define SSA_FULLMEASURE 0x04000000
50 #define SSA_LPKANSIFALLBACK 0x08000000
51 #define SSA_PIDX 0x10000000
52 #define SSA_LAYOUTRTL 0x20000000
53 #define SSA_DONTGLYPH 0x40000000
54 #define SSA_NOKASHIDA 0x80000000
55 
56 #define SIC_COMPLEX 1
57 #define SIC_ASCIIDIGIT 2
58 #define SIC_NEUTRAL 4
59 
60 #define SCRIPT_DIGITSUBSTITUTE_CONTEXT 0
61 #define SCRIPT_DIGITSUBSTITUTE_NONE 1
62 #define SCRIPT_DIGITSUBSTITUTE_NATIONAL 2
63 #define SCRIPT_DIGITSUBSTITUTE_TRADITIONAL 3
64 
65   typedef void *SCRIPT_CACHE;
66   typedef void *SCRIPT_STRING_ANALYSIS;
67 #if UNISCRIBE_OPENTYPE >= 0x0100
68   typedef ULONG OPENTYPE_TAG;
69 #endif
70 
71   typedef struct tag_SCRIPT_CONTROL {
72     DWORD uDefaultLanguage :16;
73     DWORD fContextDigits :1;
74     DWORD fInvertPreBoundDir :1;
75     DWORD fInvertPostBoundDir :1;
76     DWORD fLinkStringBefore :1;
77     DWORD fLinkStringAfter :1;
78     DWORD fNeutralOverride :1;
79     DWORD fNumericOverride :1;
80     DWORD fLegacyBidiClass :1;
81     DWORD fMergeNeutralItems :1;
82     DWORD fUseStandardBidi :1;
83     DWORD fReserved :6;
84   } SCRIPT_CONTROL;
85 
86   typedef struct tag_SCRIPT_STATE {
87     WORD uBidiLevel :5;
88     WORD fOverrideDirection :1;
89     WORD fInhibitSymSwap :1;
90     WORD fCharShape :1;
91     WORD fDigitSubstitute :1;
92     WORD fInhibitLigate :1;
93     WORD fDisplayZWG :1;
94     WORD fArabicNumContext :1;
95     WORD fGcpClusters :1;
96     WORD fReserved :1;
97     WORD fEngineReserved :2;
98   } SCRIPT_STATE;
99 
100   typedef struct tag_SCRIPT_ANALYSIS {
101     WORD eScript :10;
102     WORD fRTL :1;
103     WORD fLayoutRTL :1;
104     WORD fLinkBefore :1;
105     WORD fLinkAfter :1;
106     WORD fLogicalOrder :1;
107     WORD fNoGlyphIndex :1;
108     SCRIPT_STATE s;
109   } SCRIPT_ANALYSIS;
110 
111   typedef struct tag_SCRIPT_ITEM {
112     int iCharPos;
113     SCRIPT_ANALYSIS a;
114   } SCRIPT_ITEM;
115 
116   typedef enum tag_SCRIPT_JUSTIFY {
117     SCRIPT_JUSTIFY_NONE = 0,
118     SCRIPT_JUSTIFY_ARABIC_BLANK = 1,
119     SCRIPT_JUSTIFY_CHARACTER = 2,
120     SCRIPT_JUSTIFY_RESERVED1 = 3,
121     SCRIPT_JUSTIFY_BLANK = 4,
122     SCRIPT_JUSTIFY_RESERVED2 = 5,
123     SCRIPT_JUSTIFY_RESERVED3 = 6,
124     SCRIPT_JUSTIFY_ARABIC_NORMAL = 7,
125     SCRIPT_JUSTIFY_ARABIC_KASHIDA = 8,
126     SCRIPT_JUSTIFY_ARABIC_ALEF = 9,
127     SCRIPT_JUSTIFY_ARABIC_HA = 10,
128     SCRIPT_JUSTIFY_ARABIC_RA = 11,
129     SCRIPT_JUSTIFY_ARABIC_BA = 12,
130     SCRIPT_JUSTIFY_ARABIC_BARA = 13,
131     SCRIPT_JUSTIFY_ARABIC_SEEN = 14,
132     SCRIPT_JUSTIFY_ARABIC_SEEN_M = 15,
133   } SCRIPT_JUSTIFY;
134 
135   typedef struct tag_SCRIPT_VISATTR {
136     WORD uJustification :4;
137     WORD fClusterStart :1;
138     WORD fDiacritic :1;
139     WORD fZeroWidth :1;
140     WORD fReserved :1;
141     WORD fShapeReserved :8;
142   } SCRIPT_VISATTR;
143 
144 #ifndef LSDEFS_DEFINED
145   typedef struct tagGOFFSET {
146     LONG du;
147     LONG dv;
148   } GOFFSET;
149 #endif
150 
151   typedef struct tag_SCRIPT_LOGATTR {
152     BYTE fSoftBreak :1;
153     BYTE fWhiteSpace :1;
154     BYTE fCharStop :1;
155     BYTE fWordStop :1;
156     BYTE fInvalid :1;
157     BYTE fReserved :3;
158   } SCRIPT_LOGATTR;
159 
160   typedef struct {
161     DWORD langid :16;
162     DWORD fNumeric :1;
163     DWORD fComplex :1;
164     DWORD fNeedsWordBreaking :1;
165     DWORD fNeedsCaretInfo :1;
166     DWORD bCharSet :8;
167     DWORD fControl :1;
168     DWORD fPrivateUseArea :1;
169     DWORD fNeedsCharacterJustify :1;
170     DWORD fInvalidGlyph :1;
171     DWORD fInvalidLogAttr :1;
172     DWORD fCDM :1;
173     DWORD fAmbiguousCharSet :1;
174     DWORD fClusterSizeVaries :1;
175     DWORD fRejectInvalid :1;
176   } SCRIPT_PROPERTIES;
177 
178   typedef struct {
179     int cBytes;
180     WORD wgBlank;
181     WORD wgDefault;
182     WORD wgInvalid;
183     WORD wgKashida;
184     int iKashidaWidth;
185   } SCRIPT_FONTPROPERTIES;
186 
187   typedef struct tag_SCRIPT_TABDEF {
188     int cTabStops;
189     int iScale;
190     int *pTabStops;
191     int iTabOrigin;
192   } SCRIPT_TABDEF;
193 
194   typedef struct tag_SCRIPT_DIGITSUBSTITUTE {
195     DWORD NationalDigitLanguage :16;
196     DWORD TraditionalDigitLanguage :16;
197     DWORD DigitSubstitute :8;
198     DWORD dwReserved;
199   } SCRIPT_DIGITSUBSTITUTE;
200 
201 #if UNISCRIBE_OPENTYPE >= 0x0100
202   typedef struct opentype_feature_record {
203     OPENTYPE_TAG tagFeature;
204     LONG lParameter;
205   } OPENTYPE_FEATURE_RECORD;
206 
207   typedef struct textrange_properties {
208     OPENTYPE_FEATURE_RECORD *potfRecords;
209     int cotfRecords;
210   } TEXTRANGE_PROPERTIES;
211 
212   typedef struct script_charprop {
213     WORD fCanGlyphAlone : 1;
214     WORD reserved : 15;
215   } SCRIPT_CHARPROP;
216 
217   typedef struct script_glyphprop {
218     SCRIPT_VISATTR sva;
219     WORD reserved;
220   } SCRIPT_GLYPHPROP;
221 #endif
222 
223   HRESULT WINAPI ScriptFreeCache (SCRIPT_CACHE *psc);
224   HRESULT WINAPI ScriptItemize (const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, int *pcItems);
225   HRESULT WINAPI ScriptLayout (int cRuns, const BYTE *pbLevel, int *piVisualToLogical, int *piLogicalToVisual);
226   HRESULT WINAPI ScriptShape (HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars, int cChars, int cMaxGlyphs, SCRIPT_ANALYSIS *psa, WORD *pwOutGlyphs, WORD *pwLogClust, SCRIPT_VISATTR *psva, int *pcGlyphs);
227   HRESULT WINAPI ScriptPlace (HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs, int cGlyphs, const SCRIPT_VISATTR *psva, SCRIPT_ANALYSIS *psa, int *piAdvance, GOFFSET *pGoffset, ABC *pABC);
228   HRESULT WINAPI ScriptTextOut (const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UINT fuOptions, const RECT *lprc, const SCRIPT_ANALYSIS *psa, const WCHAR *pwcReserved, int iReserved, const WORD *pwGlyphs, int cGlyphs, const int *piAdvance, const int *piJustify, const GOFFSET *pGoffset);
229   HRESULT WINAPI ScriptJustify (const SCRIPT_VISATTR *psva, const int *piAdvance, int cGlyphs, int iDx, int iMinKashida, int *piJustify);
230   HRESULT WINAPI ScriptBreak (const WCHAR *pwcChars, int cChars, const SCRIPT_ANALYSIS *psa, SCRIPT_LOGATTR *psla);
231   HRESULT WINAPI ScriptCPtoX (int iCP, WINBOOL fTrailing, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piX);
232   HRESULT WINAPI ScriptXtoCP (int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piCP, int *piTrailing);
233   HRESULT WINAPI ScriptGetLogicalWidths (const SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, const int *piGlyphWidth, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, int *piDx);
234   HRESULT WINAPI ScriptApplyLogicalWidth (const int *piDx, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, ABC *pABC, int *piJustify);
235   HRESULT WINAPI ScriptGetCMap (HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs);
236   HRESULT WINAPI ScriptGetGlyphABCWidth (HDC hdc, SCRIPT_CACHE *psc, WORD wGlyph, ABC *pABC);
237   HRESULT WINAPI ScriptGetProperties (const SCRIPT_PROPERTIES ***ppSp, int *piNumScripts);
238   HRESULT WINAPI ScriptGetFontProperties (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp);
239   HRESULT WINAPI ScriptCacheGetHeight (HDC hdc, SCRIPT_CACHE *psc, long *tmHeight);
240   HRESULT WINAPI ScriptStringAnalyse (HDC hdc, const void *pString, int cString, int cGlyphs, int iCharset, DWORD dwFlags, int iReqWidth, SCRIPT_CONTROL *psControl, SCRIPT_STATE *psState, const int *piDx, SCRIPT_TABDEF *pTabdef, const BYTE *pbInClass, SCRIPT_STRING_ANALYSIS *pssa);
241   HRESULT WINAPI ScriptStringFree (SCRIPT_STRING_ANALYSIS *pssa);
242   const SIZE *WINAPI ScriptString_pSize (SCRIPT_STRING_ANALYSIS ssa);
243   const int *WINAPI ScriptString_pcOutChars (SCRIPT_STRING_ANALYSIS ssa);
244   const SCRIPT_LOGATTR *WINAPI ScriptString_pLogAttr (SCRIPT_STRING_ANALYSIS ssa);
245   HRESULT WINAPI ScriptStringGetOrder (SCRIPT_STRING_ANALYSIS ssa, UINT *puOrder);
246   HRESULT WINAPI ScriptStringCPtoX (SCRIPT_STRING_ANALYSIS ssa, int icp, WINBOOL fTrailing, int *pX);
247   HRESULT WINAPI ScriptStringXtoCP (SCRIPT_STRING_ANALYSIS ssa, int iX, int *piCh, int *piTrailing);
248   HRESULT WINAPI ScriptStringGetLogicalWidths (SCRIPT_STRING_ANALYSIS ssa, int *piDx);
249   HRESULT WINAPI ScriptStringValidate (SCRIPT_STRING_ANALYSIS ssa);
250   HRESULT WINAPI ScriptStringOut (SCRIPT_STRING_ANALYSIS ssa, int iX, int iY, UINT uOptions, const RECT *prc, int iMinSel, int iMaxSel, WINBOOL fDisabled);
251   HRESULT WINAPI ScriptIsComplex (const WCHAR *pwcInChars, int cInChars, DWORD dwFlags);
252   HRESULT WINAPI ScriptRecordDigitSubstitution (LCID Locale, SCRIPT_DIGITSUBSTITUTE *psds);
253   HRESULT WINAPI ScriptApplyDigitSubstitution (const SCRIPT_DIGITSUBSTITUTE *psds, SCRIPT_CONTROL *psc, SCRIPT_STATE *pss);
254 #if UNISCRIBE_OPENTYPE >= 0x0100
255   HRESULT WINAPI ScriptShapeOpenType (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, int cChars, int cMaxGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, WORD *pwOutGlyphs, SCRIPT_GLYPHPROP *pOutGlyphProps, int *pcGlyphs);
256   HRESULT WINAPI ScriptPlaceOpenType (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, int cChars, const WORD *pwGlyphs, const SCRIPT_GLYPHPROP *pGlyphProps, int cGlyphs, int *piAdvance, GOFFSET *pGoffset, ABC *pABC);
257   HRESULT WINAPI ScriptItemizeOpenType (const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, OPENTYPE_TAG *pScriptTags, int *pcItems);
258   HRESULT WINAPI ScriptGetFontScriptTags (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags);
259   HRESULT WINAPI ScriptGetFontLanguageTags (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangsysTags, int *pcTags);
260   HRESULT WINAPI ScriptGetFontFeatureTags (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags);
261   HRESULT WINAPI ScriptGetFontAlternateGlyphs (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, OPENTYPE_TAG tagFeature, WORD wGlyphId, int cMaxAlternates, WORD *pAlternateGlyphs, int *pcAlternates);
262   HRESULT WINAPI ScriptSubstituteSingleGlyph (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, OPENTYPE_TAG tagFeature, LONG lParameter, WORD wGlyphId, WORD *pwOutGlyphId);
263   HRESULT WINAPI ScriptPositionSingleGlyph (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, OPENTYPE_TAG tagFeature, LONG lParameter, WORD wGlyphId, int iAdvance, GOFFSET GOffset, int *piOutAdvance, GOFFSET *pOutGoffset);
264 #endif
265 
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 #endif
271 
272 #endif
273