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