Reactos
1/*
2 * Copyright (C) 2005 Steven Edwards
3 * Copyright (C) 2005 Vijay Kiran Kamuju
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#ifndef __USP10_H
21#define __USP10_H
22
23#ifndef __WINESRC__
24# include <windows.h>
25#endif
26/* FIXME: #include <specstrings.h> */
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/** ScriptStringAnalyse */
33#define SSA_PASSWORD 0x00000001
34#define SSA_TAB 0x00000002
35#define SSA_CLIP 0x00000004
36#define SSA_FIT 0x00000008
37#define SSA_DZWG 0x00000010
38#define SSA_FALLBACK 0x00000020
39#define SSA_BREAK 0x00000040
40#define SSA_GLYPHS 0x00000080
41#define SSA_RTL 0x00000100
42#define SSA_GCP 0x00000200
43#define SSA_HOTKEY 0x00000400
44#define SSA_METAFILE 0x00000800
45#define SSA_LINK 0x00001000
46#define SSA_HIDEHOTKEY 0x00002000
47#define SSA_HOTKEYONLY 0x00002400
48#define SSA_FULLMEASURE 0x04000000
49#define SSA_LPKANSIFALLBACK 0x08000000
50#define SSA_PIDX 0x10000000
51#define SSA_LAYOUTRTL 0x20000000
52#define SSA_DONTGLYPH 0x40000000
53#define SSA_NOKASHIDA 0x80000000
54
55/** StringIsComplex */
56#define SIC_COMPLEX 1
57#define SIC_ASCIIDIGIT 2
58#define SIC_NEUTRAL 4
59
60/** ScriptGetCMap */
61#define SGCM_RTL 0x00000001
62
63/** ScriptApplyDigitSubstitution */
64#define SCRIPT_DIGITSUBSTITUTE_CONTEXT 0
65#define SCRIPT_DIGITSUBSTITUTE_NONE 1
66#define SCRIPT_DIGITSUBSTITUTE_NATIONAL 2
67#define SCRIPT_DIGITSUBSTITUTE_TRADITIONAL 3
68
69#define SCRIPT_UNDEFINED 0
70
71#define USP_E_SCRIPT_NOT_IN_FONT MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200)
72
73typedef enum tag_SCRIPT_JUSTIFY {
74 SCRIPT_JUSTIFY_NONE = 0,
75 SCRIPT_JUSTIFY_ARABIC_BLANK = 1,
76 SCRIPT_JUSTIFY_CHARACTER = 2,
77 SCRIPT_JUSTIFY_RESERVED1 = 3,
78 SCRIPT_JUSTIFY_BLANK = 4,
79 SCRIPT_JUSTIFY_RESERVED2 = 5,
80 SCRIPT_JUSTIFY_RESERVED3 = 6,
81 SCRIPT_JUSTIFY_ARABIC_NORMAL = 7,
82 SCRIPT_JUSTIFY_ARABIC_KASHIDA = 8,
83 SCRIPT_JUSTIFY_ARABIC_ALEF = 9,
84 SCRIPT_JUSTIFY_ARABIC_HA = 10,
85 SCRIPT_JUSTIFY_ARABIC_RA = 11,
86 SCRIPT_JUSTIFY_ARABIC_BA = 12,
87 SCRIPT_JUSTIFY_ARABIC_BARA = 13,
88 SCRIPT_JUSTIFY_ARABIC_SEEN = 14,
89 SCRIPT_JUSTIFY_ARABIC_SEEN_M = 15,
90} SCRIPT_JUSTIFY;
91
92typedef struct tag_SCRIPT_CONTROL {
93 DWORD uDefaultLanguage :16;
94 DWORD fContextDigits :1;
95 DWORD fInvertPreBoundDir :1;
96 DWORD fInvertPostBoundDir :1;
97 DWORD fLinkStringBefore :1;
98 DWORD fLinkStringAfter :1;
99 DWORD fNeutralOverride :1;
100 DWORD fNumericOverride :1;
101 DWORD fLegacyBidiClass :1;
102 DWORD fMergeNeutralItems :1;
103 DWORD fReserved :7;
104} SCRIPT_CONTROL;
105
106typedef struct {
107 DWORD langid :16;
108 DWORD fNumeric :1;
109 DWORD fComplex :1;
110 DWORD fNeedsWordBreaking :1;
111 DWORD fNeedsCaretInfo :1;
112 DWORD bCharSet :8;
113 DWORD fControl :1;
114 DWORD fPrivateUseArea :1;
115 DWORD fNeedsCharacterJustify :1;
116 DWORD fInvalidGlyph :1;
117 DWORD fInvalidLogAttr :1;
118 DWORD fCDM :1;
119 DWORD fAmbiguousCharSet :1;
120 DWORD fClusterSizeVaries :1;
121 DWORD fRejectInvalid :1;
122} SCRIPT_PROPERTIES;
123
124typedef struct tag_SCRIPT_STATE {
125 WORD uBidiLevel :5;
126 WORD fOverrideDirection :1;
127 WORD fInhibitSymSwap :1;
128 WORD fCharShape :1;
129 WORD fDigitSubstitute :1;
130 WORD fInhibitLigate :1;
131 WORD fDisplayZWG :1;
132 WORD fArabicNumContext :1;
133 WORD fGcpClusters :1;
134 WORD fReserved :1;
135 WORD fEngineReserved :2;
136} SCRIPT_STATE;
137
138typedef struct tag_SCRIPT_ANALYSIS {
139 WORD eScript :10;
140 WORD fRTL :1;
141 WORD fLayoutRTL :1;
142 WORD fLinkBefore :1;
143 WORD fLinkAfter :1;
144 WORD fLogicalOrder :1;
145 WORD fNoGlyphIndex :1;
146 SCRIPT_STATE s;
147} SCRIPT_ANALYSIS;
148
149typedef struct tag_SCRIPT_ITEM {
150 int iCharPos;
151 SCRIPT_ANALYSIS a;
152} SCRIPT_ITEM;
153
154typedef struct tag_SCRIPT_DIGITSUBSTITUTE {
155 DWORD NationalDigitLanguage :16;
156 DWORD TraditionalDigitLanguage :16;
157 DWORD DigitSubstitute :8;
158 DWORD dwReserved;
159} SCRIPT_DIGITSUBSTITUTE;
160
161typedef struct tag_SCRIPT_FONTPROPERTIES {
162 int cBytes;
163 WORD wgBlank;
164 WORD wgDefault;
165 WORD wgInvalid;
166 WORD wgKashida;
167 int iKashidaWidth;
168} SCRIPT_FONTPROPERTIES;
169
170typedef struct tag_SCRIPT_TABDEF {
171 int cTabStops;
172 int iScale;
173 int *pTabStops;
174 int iTabOrigin;
175} SCRIPT_TABDEF;
176
177typedef struct tag_SCRIPT_VISATTR {
178 WORD uJustification :4;
179 WORD fClusterStart :1;
180 WORD fDiacritic :1;
181 WORD fZeroWidth :1;
182 WORD fReserved :1;
183 WORD fShapeReserved :8;
184} SCRIPT_VISATTR;
185
186typedef struct tag_SCRIPT_LOGATTR {
187 BYTE fSoftBreak :1;
188 BYTE fWhiteSpace :1;
189 BYTE fCharStop :1;
190 BYTE fWordStop :1;
191 BYTE fInvalid :1;
192 BYTE fReserved :3;
193} SCRIPT_LOGATTR;
194
195typedef void *SCRIPT_CACHE;
196typedef void *SCRIPT_STRING_ANALYSIS;
197
198#ifndef LSDEFS_DEFINED
199typedef struct tagGOFFSET {
200 LONG du;
201 LONG dv;
202} GOFFSET;
203#endif
204
205typedef ULONG OPENTYPE_TAG;
206
207typedef struct tagOPENTYPE_FEATURE_RECORD
208{
209 OPENTYPE_TAG tagFeature;
210 LONG lParameter;
211} OPENTYPE_FEATURE_RECORD;
212
213typedef struct tagSCRIPT_GLYPHPROP
214{
215 SCRIPT_VISATTR sva;
216 WORD reserved;
217} SCRIPT_GLYPHPROP;
218
219typedef struct tagSCRIPT_CHARPROP
220{
221 WORD fCanGlyphAlone :1;
222 WORD reserved :15;
223} SCRIPT_CHARPROP;
224
225typedef struct tagTEXTRANGE_PROPERTIES
226{
227 OPENTYPE_FEATURE_RECORD *potfRecords;
228 INT cotfRecords;
229} TEXTRANGE_PROPERTIES;
230
231/* Function Declarations */
232
233_Check_return_
234HRESULT
235WINAPI
236ScriptApplyDigitSubstitution(
237 _In_reads_(1) const SCRIPT_DIGITSUBSTITUTE* psds,
238 _Out_writes_(1) SCRIPT_CONTROL* psc,
239 _Out_writes_(1) SCRIPT_STATE* pss);
240
241_Check_return_
242HRESULT
243WINAPI
244ScriptApplyLogicalWidth(
245 _In_reads_(cChars) const int *piDx,
246 _In_ int cChars,
247 _In_ int cGlyphs,
248 _In_reads_(cChars) const WORD *pwLogClust,
249 _In_reads_(cGlyphs) const SCRIPT_VISATTR *psva,
250 _In_reads_(cGlyphs) const int *piAdvance,
251 _In_reads_(1) const SCRIPT_ANALYSIS *psa,
252 _Inout_updates_opt_(1) ABC *pABC,
253 _Out_writes_all_(cGlyphs) int *piJustify);
254
255_Check_return_
256HRESULT
257WINAPI
258ScriptRecordDigitSubstitution(
259 _In_ LCID Locale,
260 _Out_writes_(1) SCRIPT_DIGITSUBSTITUTE *psds);
261
262_Check_return_
263HRESULT
264WINAPI
265ScriptItemize(
266 _In_reads_(cInChars) const WCHAR *pwcInChars,
267 _In_ int cInChars,
268 _In_ int cMaxItems,
269 _In_reads_opt_(1) const SCRIPT_CONTROL *psControl,
270 _In_reads_opt_(1) const SCRIPT_STATE *psState,
271 _Out_writes_to_(cMaxItems, *pcItems) SCRIPT_ITEM *pItems,
272 _Out_writes_(1) int *pcItems);
273
274_Check_return_
275HRESULT
276WINAPI
277ScriptGetCMap(
278 _In_ HDC hdc,
279 _Inout_updates_(1) SCRIPT_CACHE *psc,
280 _In_reads_(cChars) const WCHAR *pwcInChars,
281 _In_ int cChars,
282 _In_ DWORD dwFlags,
283 _Out_writes_(cChars) WORD *pwOutGlyphs);
284
285_Check_return_
286HRESULT
287WINAPI
288ScriptGetFontProperties(
289 _In_ HDC hdc,
290 _Inout_updates_(1) SCRIPT_CACHE *psc,
291 _Out_writes_(1) SCRIPT_FONTPROPERTIES *sfp);
292
293_Check_return_
294HRESULT
295WINAPI
296ScriptGetGlyphABCWidth(
297 _In_ HDC hdc,
298 _Inout_updates_(1) SCRIPT_CACHE *psc,
299 _In_ WORD wGlyph,
300 _Out_writes_(1) ABC *pABC);
301
302_Check_return_
303HRESULT
304WINAPI
305ScriptGetLogicalWidths(
306 _In_reads_(1) const SCRIPT_ANALYSIS *psa,
307 _In_ int cChars,
308 _In_ int cGlyphs,
309 _In_reads_(cGlyphs) const int *piGlyphWidth,
310 _In_reads_(cChars) const WORD *pwLogClust,
311 _In_reads_(cGlyphs) const SCRIPT_VISATTR *psva,
312 _In_reads_(cChars) int *piDx);
313
314_Check_return_
315HRESULT
316WINAPI
317ScriptGetProperties(
318 _Outptr_result_buffer_(*piNumScripts) const SCRIPT_PROPERTIES ***ppSp,
319 _Out_ int *piNumScripts);
320
321_Check_return_
322HRESULT
323WINAPI
324ScriptStringAnalyse(
325 _In_ HDC hdc,
326 _In_ const void *pString,
327 _In_ int cString,
328 _In_ int cGlyphs,
329 _In_ int iCharset,
330 _In_ DWORD dwFlags,
331 _In_ int iReqWidth,
332 _In_reads_opt_(1) SCRIPT_CONTROL *psControl,
333 _In_reads_opt_(1) SCRIPT_STATE *psState,
334 _In_reads_opt_(cString) const int *piDx,
335 _In_reads_opt_(1) SCRIPT_TABDEF *pTabdef,
336 _In_ const BYTE *pbInClass,
337 _Outptr_result_buffer_(1) SCRIPT_STRING_ANALYSIS *pssa);
338
339_Check_return_
340HRESULT
341WINAPI
342ScriptStringValidate(
343 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa);
344
345_Check_return_
346HRESULT
347WINAPI
348ScriptStringFree(
349 _Inout_updates_(1) SCRIPT_STRING_ANALYSIS *pssa);
350
351_Check_return_
352HRESULT
353WINAPI
354ScriptFreeCache(
355 _Inout_updates_(1) _At_(*psc, _Post_null_) SCRIPT_CACHE *psc);
356
357_Check_return_
358HRESULT
359WINAPI
360ScriptIsComplex(
361 _In_reads_(cInChars) const WCHAR *pwcInChars,
362 _In_ int cInChars,
363 _In_ DWORD dwFlags);
364
365_Check_return_
366HRESULT
367WINAPI
368ScriptJustify(
369 _In_reads_(cGlyphs) const SCRIPT_VISATTR *psva,
370 _In_reads_(cGlyphs) const int *piAdvance,
371 _In_ int cGlyphs,
372 _In_ int iDx,
373 _In_ int iMinKashida,
374 _Out_writes_all_(cGlyphs) int *piJustify);
375
376_Check_return_
377HRESULT
378WINAPI
379ScriptLayout(
380 int cRuns,
381 _In_reads_(cRuns) const BYTE *pbLevel,
382 _Out_writes_all_opt_(cRuns) int *piVisualToLogical,
383 _Out_writes_all_opt_(cRuns) int *piLogicalToVisual);
384
385_Check_return_
386HRESULT
387WINAPI
388ScriptShape(
389 _In_ HDC hdc,
390 _Inout_updates_(1) SCRIPT_CACHE *psc,
391 _In_reads_(cChars) const WCHAR *pwcChars,
392 _In_ int cChars,
393 _In_ int cMaxGlyphs,
394 _Inout_updates_(1) SCRIPT_ANALYSIS *psa,
395 _Out_writes_to_(cMaxGlyphs, *pcGlyphs) WORD *pwOutGlyphs,
396 _Out_writes_all_(cChars) WORD *pwLogClust,
397 _Out_writes_to_(cMaxGlyphs, *pcGlyphs) SCRIPT_VISATTR *psva,
398 _Out_writes_(1) int *pcGlyphs);
399
400_Check_return_
401HRESULT
402WINAPI
403ScriptPlace(
404 _In_ HDC hdc,
405 _Inout_updates_(1) SCRIPT_CACHE *psc,
406 _In_reads_(cGlyphs) const WORD *pwGlyphs,
407 _In_ int cGlyphs,
408 _In_reads_(cGlyphs) const SCRIPT_VISATTR *psva,
409 _Inout_updates_(1) SCRIPT_ANALYSIS *psa,
410 _Out_writes_all_(cGlyphs) int *piAdvance,
411 _Out_writes_all_opt_(cGlyphs) GOFFSET *pGoffset,
412 _Out_writes_(1) ABC *pABC);
413
414_Check_return_
415HRESULT
416WINAPI
417ScriptBreak(
418 _In_reads_(cChars) const WCHAR *pwcChars,
419 _In_ int cChars,
420 _In_reads_(1) const SCRIPT_ANALYSIS *psa,
421 _Out_writes_all_(cChars) SCRIPT_LOGATTR *psla);
422
423_Check_return_
424HRESULT
425WINAPI
426ScriptCacheGetHeight(
427 _In_ HDC hdc,
428 _Inout_updates_(1) SCRIPT_CACHE *psc,
429 _Out_writes_(1) LONG *tmHeight);
430
431_Check_return_
432HRESULT
433WINAPI
434ScriptCPtoX(
435 _In_ int iCP,
436 _In_ BOOL fTrailing,
437 _In_ int cChars,
438 _In_ int cGlyphs,
439 _In_reads_(cChars) const WORD *pwLogClust,
440 _In_reads_(cGlyphs) const SCRIPT_VISATTR *psva,
441 _In_reads_(cGlyphs) const int *piAdvance,
442 _In_reads_(1) const SCRIPT_ANALYSIS *psa,
443 _Out_ int *piX);
444
445_Check_return_
446HRESULT
447WINAPI
448ScriptXtoCP(
449 _In_ int iX,
450 _In_ int cChars,
451 _In_ int cGlyphs,
452 _In_reads_(cChars) const WORD *pwLogClust,
453 _In_reads_(cGlyphs) const SCRIPT_VISATTR *psva,
454 _In_reads_(cGlyphs) const int *piAdvance,
455 _In_reads_(1) const SCRIPT_ANALYSIS *psa,
456 _Out_writes_(1) int *piCP,
457 _Out_writes_(1) int *piTrailing);
458
459_Check_return_
460HRESULT
461WINAPI
462ScriptStringCPtoX(
463 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa,
464 _In_ int icp,
465 _In_ BOOL fTrailing,
466 _Out_writes_(1) int *pX);
467
468_Check_return_
469HRESULT
470WINAPI
471ScriptStringXtoCP(
472 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa,
473 _In_ int iX,
474 _Out_writes_(1) int *piCh,
475 _Out_writes_(1) int *piTrailing);
476
477_Check_return_
478HRESULT
479WINAPI
480ScriptStringGetLogicalWidths(
481 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa,
482 _Out_ int *piDx);
483
484_Check_return_
485HRESULT
486WINAPI
487ScriptStringGetOrder(
488 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa,
489 _Out_ UINT *puOrder);
490
491_Check_return_
492HRESULT
493WINAPI
494ScriptStringOut(
495 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa,
496 _In_ int iX,
497 _In_ int iY,
498 _In_ UINT uOptions,
499 _In_reads_opt_(1) const RECT *prc,
500 _In_ int iMinSel,
501 _In_ int iMaxSel,
502 _In_ BOOL fDisabled);
503
504_Check_return_
505HRESULT
506WINAPI
507ScriptTextOut(
508 _In_ const HDC hdc,
509 _Inout_updates_(1) SCRIPT_CACHE *psc,
510 _In_ int x,
511 _In_ int y,
512 _In_ UINT fuOptions,
513 _In_reads_opt_(1) const RECT *lprc,
514 _In_reads_(1) const SCRIPT_ANALYSIS *psa,
515 _Reserved_ const WCHAR *pwcReserved,
516 _Reserved_ int iReserved,
517 _In_reads_(cGlyphs) const WORD *pwGlyphs,
518 _In_ int cGlyphs,
519 _In_reads_(cGlyphs) const int *piAdvance,
520 _In_reads_opt_(cGlyphs) const int *piJustify,
521 _In_reads_(cGlyphs) const GOFFSET *pGoffset);
522
523const int*
524WINAPI
525ScriptString_pcOutChars(
526 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa);
527
528const SCRIPT_LOGATTR*
529WINAPI
530ScriptString_pLogAttr(
531 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa);
532
533const SIZE*
534WINAPI
535ScriptString_pSize(
536 _In_reads_(1) SCRIPT_STRING_ANALYSIS ssa);
537
538#ifdef __cplusplus
539} /* extern "C" */
540#endif
541
542#endif /* __USP10_H */