usp10.h 10.5 KB
Newer Older
1 2
/*
 * Copyright (C) 2005 Steven Edwards
3
 * Copyright (C) 2005 Vijay Kiran Kamuju
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 21 22
 */

#ifndef __USP10_H
#define __USP10_H

23
#include <windows.h>
24 25
/* FIXME: #include <specstrings.h> */

26 27 28 29
#ifdef __cplusplus
extern "C" {
#endif

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/** ScriptStringAnalyse */
#define  SSA_PASSWORD         0x00000001
#define  SSA_TAB              0x00000002
#define  SSA_CLIP             0x00000004
#define  SSA_FIT              0x00000008
#define  SSA_DZWG             0x00000010
#define  SSA_FALLBACK         0x00000020
#define  SSA_BREAK            0x00000040
#define  SSA_GLYPHS           0x00000080
#define  SSA_RTL              0x00000100
#define  SSA_GCP              0x00000200
#define  SSA_HOTKEY           0x00000400
#define  SSA_METAFILE         0x00000800
#define  SSA_LINK             0x00001000
#define  SSA_HIDEHOTKEY       0x00002000
#define  SSA_HOTKEYONLY       0x00002400
#define  SSA_FULLMEASURE      0x04000000
#define  SSA_LPKANSIFALLBACK  0x08000000
#define  SSA_PIDX             0x10000000
#define  SSA_LAYOUTRTL        0x20000000
#define  SSA_DONTGLYPH        0x40000000 
#define  SSA_NOKASHIDA        0x80000000 

/** StringIsComplex */
#define  SIC_COMPLEX     1
#define  SIC_ASCIIDIGIT  2
#define  SIC_NEUTRAL     4

58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
/** ScriptGetCMap */
#define SGCM_RTL  0x00000001

/** ScriptApplyDigitSubstitution */
#define SCRIPT_DIGITSUBSTITUTE_CONTEXT      0
#define SCRIPT_DIGITSUBSTITUTE_NONE         1
#define SCRIPT_DIGITSUBSTITUTE_NATIONAL     2
#define SCRIPT_DIGITSUBSTITUTE_TRADITIONAL  3

#define SCRIPT_UNDEFINED  0

#define USP_E_SCRIPT_NOT_IN_FONT MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200)

typedef enum tag_SCRIPT_JUSTIFY {
  SCRIPT_JUSTIFY_NONE           = 0,
  SCRIPT_JUSTIFY_ARABIC_BLANK   = 1,
  SCRIPT_JUSTIFY_CHARACTER      = 2,
  SCRIPT_JUSTIFY_RESERVED1      = 3,
  SCRIPT_JUSTIFY_BLANK          = 4,
  SCRIPT_JUSTIFY_RESERVED2      = 5,
  SCRIPT_JUSTIFY_RESERVED3      = 6,
  SCRIPT_JUSTIFY_ARABIC_NORMAL  = 7,
  SCRIPT_JUSTIFY_ARABIC_KASHIDA = 8,
  SCRIPT_JUSTIFY_ARABIC_ALEF    = 9,
  SCRIPT_JUSTIFY_ARABIC_HA      = 10,
  SCRIPT_JUSTIFY_ARABIC_RA      = 11,
  SCRIPT_JUSTIFY_ARABIC_BA      = 12,
  SCRIPT_JUSTIFY_ARABIC_BARA    = 13,
  SCRIPT_JUSTIFY_ARABIC_SEEN    = 14,
87
  SCRIPT_JUSTIFY_ARABIC_SEEN_M  = 15,
88 89
} SCRIPT_JUSTIFY;

90 91 92 93 94 95 96 97 98 99
typedef struct tag_SCRIPT_CONTROL {
  DWORD uDefaultLanguage	:16;
  DWORD fContextDigits		:1;
  DWORD fInvertPreBoundDir	:1;
  DWORD fInvertPostBoundDir	:1;
  DWORD fLinkStringBefore	:1;
  DWORD fLinkStringAfter	:1;
  DWORD fNeutralOverride	:1;
  DWORD fNumericOverride	:1;
  DWORD fLegacyBidiClass	:1;
100 101
  DWORD fMergeNeutralItems	:1;
  DWORD fReserved		:7;
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
} SCRIPT_CONTROL;

typedef struct {
  DWORD langid			:16;
  DWORD fNumeric		:1;
  DWORD fComplex		:1;     
  DWORD fNeedsWordBreaking	:1;     
  DWORD fNeedsCaretInfo		:1;
  DWORD bCharSet		:8;
  DWORD fControl		:1;
  DWORD fPrivateUseArea		:1;
  DWORD fNeedsCharacterJustify	:1;
  DWORD fInvalidGlyph		:1;
  DWORD fInvalidLogAttr		:1;
  DWORD fCDM			:1;
  DWORD fAmbiguousCharSet	:1;
  DWORD fClusterSizeVaries	:1;
  DWORD fRejectInvalid		:1;
} SCRIPT_PROPERTIES;

typedef struct tag_SCRIPT_STATE {
  WORD uBidiLevel		:5;
  WORD fOverrideDirection	:1;
  WORD fInhibitSymSwap		:1;
  WORD fCharShape		:1;
  WORD fDigitSubstitute		:1;
  WORD fInhibitLigate		:1;
  WORD fDisplayZWG		:1;
  WORD fArabicNumContext	:1;
  WORD fGcpClusters		:1;
  WORD fReserved		:1;
  WORD fEngineReserved		:2;
} SCRIPT_STATE;

typedef struct tag_SCRIPT_ANALYSIS {
  WORD eScript			:10;
  WORD fRTL			:1;
  WORD fLayoutRTL		:1;
  WORD fLinkBefore		:1;
  WORD fLinkAfter		:1;
  WORD fLogicalOrder		:1;
  WORD fNoGlyphIndex		:1;
  SCRIPT_STATE 	s;
} SCRIPT_ANALYSIS;

typedef struct tag_SCRIPT_ITEM {
  int iCharPos;
  SCRIPT_ANALYSIS a;
} SCRIPT_ITEM;

typedef struct tag_SCRIPT_DIGITSUBSTITUTE {
  DWORD NationalDigitLanguage		:16;
  DWORD TraditionalDigitLanguage	:16;
  DWORD DigitSubstitute			:8;
  DWORD dwReserved;
} SCRIPT_DIGITSUBSTITUTE;

159 160 161 162 163 164 165 166 167
typedef struct tag_SCRIPT_FONTPROPERTIES {
  int   cBytes;
  WORD wgBlank;
  WORD wgDefault;
  WORD wgInvalid;
  WORD wgKashida;
  int iKashidaWidth;
} SCRIPT_FONTPROPERTIES;

168 169 170 171 172 173 174
typedef struct tag_SCRIPT_TABDEF {
  int cTabStops;
  int iScale;
  int *pTabStops;
  int iTabOrigin;
} SCRIPT_TABDEF;

175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
typedef struct tag_SCRIPT_VISATTR {
  WORD uJustification   :4;
  WORD fClusterStart    :1;
  WORD fDiacritic       :1;
  WORD fZeroWidth       :1;
  WORD fReserved        :1;
  WORD fShapeReserved   :8;
} SCRIPT_VISATTR;

typedef struct tag_SCRIPT_LOGATTR {
  BYTE    fSoftBreak      :1;
  BYTE    fWhiteSpace     :1;
  BYTE    fCharStop       :1;
  BYTE    fWordStop       :1;
  BYTE    fInvalid        :1;
  BYTE    fReserved       :3;
} SCRIPT_LOGATTR;

193
typedef void *SCRIPT_CACHE;
194
typedef void *SCRIPT_STRING_ANALYSIS; 
195

196 197 198 199 200 201 202
#ifndef LSDEFS_DEFINED
typedef struct tagGOFFSET {
  LONG  du;
  LONG  dv;
} GOFFSET;
#endif

203 204 205 206 207 208 209 210
typedef ULONG OPENTYPE_TAG;

typedef struct tagOPENTYPE_FEATURE_RECORD
{
    OPENTYPE_TAG tagFeature;
    LONG         lParameter;
} OPENTYPE_FEATURE_RECORD;

211 212 213 214 215 216 217 218 219 220 221 222
typedef struct tagSCRIPT_GLYPHPROP
{
    SCRIPT_VISATTR sva;
    WORD           reserved;
} SCRIPT_GLYPHPROP;

typedef struct tagSCRIPT_CHARPROP
{
    WORD fCanGlyphAlone  :1;
    WORD reserved        :15;
} SCRIPT_CHARPROP;

223 224 225 226 227 228
typedef struct tagTEXTRANGE_PROPERTIES
{
    OPENTYPE_FEATURE_RECORD *potfRecords;
    INT                     cotfRecords;
} TEXTRANGE_PROPERTIES;

229
/* Function Declarations */
230 231 232

HRESULT WINAPI ScriptApplyDigitSubstitution(const SCRIPT_DIGITSUBSTITUTE* psds, 
                                            SCRIPT_CONTROL* psc, SCRIPT_STATE* pss);
233 234 235 236
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);
HRESULT WINAPI ScriptRecordDigitSubstitution(LCID Locale, SCRIPT_DIGITSUBSTITUTE *psds);
237 238 239
HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItems, 
                             const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, 
                             SCRIPT_ITEM *pItems, int *pcItems);
240 241
HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars,
                             DWORD dwFlags, WORD *pwOutGlyphs);
242
HRESULT WINAPI ScriptGetFontProperties(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp);
243 244 245 246 247
HRESULT WINAPI ScriptGetGlyphABCWidth(HDC hdc, SCRIPT_CACHE *psc, WORD wGlyph, ABC *pABC);
HRESULT WINAPI ScriptGetLogicalWidths(const SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs,
                                      const int *piGlyphWidth, const WORD *pwLogClust,
                                      const SCRIPT_VISATTR *psva, int *piDx);
HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***ppSp, int *piNumScripts);
248 249 250 251 252 253 254 255 256 257 258 259 260
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);
261
HRESULT WINAPI ScriptStringValidate(SCRIPT_STRING_ANALYSIS ssa);
262
HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa);
263
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc);
264
HRESULT WINAPI ScriptIsComplex(const WCHAR* pwcInChars, int cInChars, DWORD dwFlags);
265 266 267 268 269 270 271 272
HRESULT WINAPI ScriptJustify(const SCRIPT_VISATTR *psva, const int *piAdvance, int cGlyphs,
                             int iDx, int iMinKashida, int *piJustify);
HRESULT WINAPI ScriptLayout(int cRuns, const BYTE *pbLevel, int *piVisualToLogical, int *piLogicalToVisual);
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);
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 );
HRESULT WINAPI ScriptBreak(const WCHAR *pwcChars, int cChars, const SCRIPT_ANALYSIS *psa, SCRIPT_LOGATTR *psla);
273
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, LONG *tmHeight);
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
HRESULT WINAPI ScriptCPtoX(int iCP, BOOL fTrailing, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva,
                           const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piX);
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);
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX);
HRESULT WINAPI ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa, int iX, int *piCh , int *piTrailing);
HRESULT WINAPI ScriptStringGetLogicalWidths(SCRIPT_STRING_ANALYSIS ssa, int *piDx);
HRESULT WINAPI ScriptStringGetOrder(SCRIPT_STRING_ANALYSIS ssa, UINT *puOrder);
HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa, int iX, int iY, UINT uOptions, const RECT *prc,
                               int iMinSel, int iMaxSel, BOOL fDisabled);
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);
const int* WINAPI ScriptString_pcOutChars(SCRIPT_STRING_ANALYSIS ssa);
const SCRIPT_LOGATTR* WINAPI ScriptString_pLogAttr(SCRIPT_STRING_ANALYSIS ssa);
const SIZE* WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa);
290

291 292 293 294
#ifdef __cplusplus
} /* extern "C" */
#endif

295
#endif /* __USP10_H */