• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

gr_Win32Uniscribe.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2004 Tomas Frydrych <tomasfrydrych@yahoo.co.uk>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 #ifndef GR_WIN32_UNISCRIBE_H
00021 #define GR_WIN32_UNISCRIBE_H
00022 
00023 #include "ut_types.h"
00024 
00025 #if 0
00026 #include <usp10.h>
00027 #else
00028 #include <windows.h>
00029 
00030 /* opaque types */
00031 typedef void* SCRIPT_STRING_ANALYSIS;
00032 typedef void* SCRIPT_CACHE;
00033 
00034 /* various constants */
00035 #define SGCM_RTL 0x00000001
00036 
00037 #define SSA_PASSWORD        0x00000001
00038 #define SSA_TAB             0x00000002
00039 #define SSA_CLIP            0x00000004
00040 #define SSA_FIT             0x00000008
00041 #define SSA_DZWG            0x00000010
00042 #define SSA_FALLBACK        0x00000020
00043 #define SSA_BREAK           0x00000040
00044 #define SSA_GLYPHS          0x00000080
00045 #define SSA_RTL             0x00000100
00046 #define SSA_GCP             0x00000200
00047 #define SSA_HOTKEY          0x00000400
00048 #define SSA_METAFILE        0x00000800
00049 #define SSA_LINK            0x00001000
00050 #define SSA_HIDEHOTKEY      0x00002000
00051 #define SSA_HOTKEYONLY      0x00002400
00052 #define SSA_FULLMEASURE     0x04000000
00053 #define SSA_LPKANSIFALLBACK 0x08000000
00054 #define SSA_PIDX            0x10000000
00055 #define SSA_LAYOUTRTL       0x20000000
00056 #define SSA_DONTGLYPH       0x40000000
00057 #define SSA_NOKASHIDA       0x80000000
00058 
00059 #define SIC_COMPLEX    1
00060 #define SIC_ASCIIDIGIT 2
00061 #define SIC_NEUTRAL    4
00062 
00063 #define SCRIPT_DIGITSUBSTITUTE_CONTEXT     0
00064 #define SCRIPT_DIGITSUBSTITUTE_NONE        1
00065 #define SCRIPT_DIGITSUBSTITUTE_NATIONAL    2
00066 #define SCRIPT_DIGITSUBSTITUTE_TRADITIONAL 3
00067 
00068 /* enum definitions */
00069 typedef enum _SCRIPT_JUSTIFY
00070 {
00071     SCRIPT_JUSTIFY_NONE           = 0,
00072     SCRIPT_JUSTIFY_ARABIC_BLANK   = 1, //0001
00073     SCRIPT_JUSTIFY_CHARACTER      = 2, //0010
00074     SCRIPT_JUSTIFY_RESERVED1      = 3,
00075     SCRIPT_JUSTIFY_BLANK          = 4, //0100
00076     SCRIPT_JUSTIFY_RESERVED2      = 5, //0101
00077     SCRIPT_JUSTIFY_RESERVED3      = 6, //0110
00078     SCRIPT_JUSTIFY_ARABIC_NORMAL  = 7, //0111
00079     SCRIPT_JUSTIFY_ARABIC_KASHIDA = 8, //1000
00080     SCRIPT_JUSTIFY_ARABIC_ALEF    = 9, //1001
00081     SCRIPT_JUSTIFY_ARABIC_HA      = 10,//1010
00082     SCRIPT_JUSTIFY_ARABIC_RA      = 11,//1011
00083     SCRIPT_JUSTIFY_ARABIC_BA      = 12,//1100
00084     SCRIPT_JUSTIFY_ARABIC_BARA    = 13,//1101
00085     SCRIPT_JUSTIFY_ARABIC_SEEN    = 14,//1110
00086     SCRIPT_JUSTIFY_RESERVED4      = 15 //1111
00087 } SCRIPT_JUSTIFY;
00088 
00089 
00090 /* struct definitions */
00091 typedef struct _SCRIPT_STATE
00092 {
00093     WORD    uBidiLevel         :5;
00094     WORD    fOverrideDirection :1;
00095     WORD    fInhibitSymSwap    :1;
00096     WORD    fCharShape         :1;
00097     WORD    fDigitSubstitute   :1;
00098     WORD    fInhibitLigate     :1;
00099     WORD    fDisplayZWG        :1;
00100     WORD    fArabicNumContext  :1;
00101     WORD    fGcpClusters       :1;
00102     WORD    fReserved          :1;
00103     WORD    fEngineReserved    :2;
00104 } SCRIPT_STATE;
00105 
00106 typedef struct _SCRIPT_CONTROL
00107 {
00108     DWORD   uDefaultLanguage    :16;
00109     DWORD   fContextDigits      :1;
00110     DWORD   fInvertPreBoundDir  :1;
00111     DWORD   fInvertPostBoundDir :1;
00112     DWORD   fLinkStringBefore   :1;
00113     DWORD   fLinkStringAfter    :1;
00114     DWORD   fNeutralOverride    :1;
00115     DWORD   fNumericOverride    :1;
00116     DWORD   fLegacyBidiClass    :1;
00117     DWORD   fReserved           :8;
00118 } SCRIPT_CONTROL;
00119 
00120 typedef struct _SCRIPT_ANALYSIS
00121 {
00122     WORD    eScript       :10;
00123     WORD    fRTL          :1;
00124     WORD    fLayoutRTL    :1;
00125     WORD    fLinkBefore   :1;
00126     WORD    fLinkAfter    :1;
00127     WORD    fLogicalOrder :1;
00128     WORD    fNoGlyphIndex :1;
00129     SCRIPT_STATE s;
00130 } SCRIPT_ANALYSIS;
00131 
00132 typedef struct _SCRIPT_ITEM
00133 {
00134     int iCharPos;
00135     SCRIPT_ANALYSIS a;
00136 } SCRIPT_ITEM;
00137 
00138 typedef struct _SCRIPT_VISATTR
00139 {
00140     WORD           uJustification :4;
00141     WORD           fClusterStart  :1;
00142     WORD           fDiacritic     :1;
00143     WORD           fZeroWidth     :1;
00144     WORD           fReserved      :1;
00145     WORD           fShapeReserved :8;
00146 } SCRIPT_VISATTR;
00147 
00148 typedef struct _GOFFSET
00149 {
00150     LONG  du;
00151     LONG  dv;
00152 } GOFFSET;
00153 
00154 typedef struct _SCRIPT_LOGATTR
00155 {
00156     BYTE    fSoftBreak  :1;
00157     BYTE    fWhiteSpace :1;
00158     BYTE    fCharStop   :1;
00159     BYTE    fWordStop   :1;
00160     BYTE    fInvalid    :1;
00161     BYTE    fReserved   :3;
00162 } SCRIPT_LOGATTR;
00163 
00164 typedef struct _SCRIPT_PROPERTIES
00165 {
00166     DWORD   langid                 :16;
00167     DWORD   fNumeric               :1;
00168     DWORD   fComplex               :1;
00169     DWORD   fNeedsWordBreaking     :1;
00170     DWORD   fNeedsCaretInfo        :1;
00171     DWORD   bCharSet               :8;
00172     DWORD   fControl               :1;
00173     DWORD   fPrivateUseArea        :1;
00174     DWORD   fNeedsCharacterJustify :1;
00175     DWORD   fInvalidGlyph          :1;
00176     DWORD   fInvalidLogAttr        :1;
00177     DWORD   fCDM                   :1;
00178     DWORD   fAmbiguousCharSet      :1;
00179     DWORD   fClusterSizeVaries     :1;
00180     DWORD   fRejectInvalid         :1;
00181 } SCRIPT_PROPERTIES;
00182 
00183 typedef struct _SCRIPT_FONTPROPERTIES
00184 {
00185     int     cBytes;
00186     WORD    wgBlank;
00187     WORD    wgDefault;
00188     WORD    wgInvalid;
00189     WORD    wgKashida;
00190     int     iKashidaWidth;
00191 } SCRIPT_FONTPROPERTIES;
00192 
00193 typedef struct _SCRIPT_TABDEF
00194 {
00195     int   cTabStops;
00196     int   iScale;
00197     int  *pTabStops;
00198     int   iTabOrigin;
00199 } SCRIPT_TABDEF;
00200 
00201 typedef struct _SCRIPT_DIGITSUBSTITUTE
00202 {
00203     DWORD  NationalDigitLanguage    :16;
00204     DWORD  TraditionalDigitLanguage :16;
00205     DWORD  DigitSubstitute          :8;
00206     DWORD  dwReserved;
00207 } SCRIPT_DIGITSUBSTITUTE;
00208 
00209 #endif
00210 
00211 G_BEGIN_DECLS
00212 
00213 /* functions -- we are loading these dynamically, so we define them as
00214    pointers, and prefix t for type */
00215 
00216 typedef HRESULT (WINAPI * tScriptApplyDigitSubstitution) (const SCRIPT_DIGITSUBSTITUTE* psds,
00217                                                           SCRIPT_CONTROL* psc,
00218                                                           SCRIPT_STATE* pss);
00219 
00220 typedef HRESULT (WINAPI * tScriptApplyLogicalWidth) (const int *piDx,
00221                                                     int cChars,
00222                                                     int cGlyphs,
00223                                                     const WORD *pwLogClust,
00224                                                     const SCRIPT_VISATTR *psva,
00225                                                     const int *piAdvance,
00226                                                     const SCRIPT_ANALYSIS *psa,
00227                                                     ABC *pABC,
00228                                                     int *piJustify);
00229 
00230 typedef HRESULT (WINAPI * tScriptBreak) (const WCHAR *pwcChars,
00231                                          int cChars,
00232                                          const SCRIPT_ANALYSIS *psa,
00233                                          SCRIPT_LOGATTR *psla);
00234 
00235 typedef HRESULT (WINAPI * tScriptCacheGetHeight) (HDC hdc,
00236                                                   SCRIPT_CACHE *psc,
00237                                                   long *tmHeight);
00238 
00239 typedef HRESULT (WINAPI * tScriptCPtoX) (int iCP,
00240                                          BOOL fTrailing,
00241                                          int cChars,
00242                                          int cGlyphs,
00243                                          const WORD *pwLogClust,
00244                                          const SCRIPT_VISATTR *psva,
00245                                          const int *piAdvance,
00246                                          const SCRIPT_ANALYSIS *psa,
00247                                          int *piX);
00248 
00249 typedef HRESULT (WINAPI * tScriptFreeCache) (SCRIPT_CACHE *psc);
00250 
00251 typedef HRESULT (WINAPI * tScriptGetCMap) (HDC hdc,
00252                                            SCRIPT_CACHE *psc,
00253                                            const WCHAR *pwcInChars,
00254                                            int cChars,
00255                                            DWORD dwFlags,
00256                                            WORD *pwOutGlyphs);
00257 
00258 typedef HRESULT (WINAPI * tScriptGetFontProperties) (HDC hdc,
00259                                                      SCRIPT_CACHE *psc,
00260                                                      SCRIPT_FONTPROPERTIES *sfp);
00261 
00262 typedef HRESULT (WINAPI * tScriptGetGlyphABCWidth) (HDC hdc,
00263                                                     SCRIPT_CACHE *psc,
00264                                                     WORD wGlyph,
00265                                                     ABC *pABC);
00266 
00267 typedef HRESULT (WINAPI * tScriptGetLogicalWidths) (const SCRIPT_ANALYSIS *psa,
00268                                                     int cChars,
00269                                                     int cGlyphs,
00270                                                     const int *piGlyphWidth,
00271                                                     const WORD *pwLogClust,
00272                                                     const SCRIPT_VISATTR *psva,
00273                                                     int *piDx);
00274 
00275 typedef HRESULT (WINAPI * tScriptGetProperties) (const SCRIPT_PROPERTIES ***ppSp,
00276                                                  int *piNumScripts);
00277 
00278 typedef HRESULT (WINAPI * tScriptIsComplex) (const WCHAR *pwcInChars,
00279                                              int cInChars,
00280                                              DWORD dwFlags);
00281 
00282 typedef HRESULT (WINAPI * tScriptItemize) (const WCHAR *pwcInChars,
00283                                            int cInChars,
00284                                            int cMaxItems,
00285                                            const SCRIPT_CONTROL *psControl,
00286                                            const SCRIPT_STATE *psState,
00287                                            SCRIPT_ITEM *pItems,
00288                                            int *pcItems);
00289 
00290 
00291 typedef HRESULT (WINAPI * tScriptJustify) (const SCRIPT_VISATTR *psva,
00292                                            const int *piAdvance,
00293                                            int cGlyphs,
00294                                            int iDx,
00295                                            int iMinKashida,
00296                                            int *piJustify);
00297 
00298 typedef HRESULT (WINAPI * tScriptLayout) (int cRuns,
00299                                           const BYTE *pbLevel,
00300                                           int *piVisualToLogical,
00301                                           int *piLogicalToVisual);
00302 
00303 typedef HRESULT (WINAPI * tScriptPlace) (HDC hdc,
00304                                          SCRIPT_CACHE *psc,
00305                                          const WORD *pwGlyphs,
00306                                          int cGlyphs,
00307                                          const SCRIPT_VISATTR *psva,
00308                                          SCRIPT_ANALYSIS *psa,
00309                                          int *piAdvance,
00310                                          GOFFSET *pGoffset,
00311                                          ABC *pABC);
00312 
00313 typedef HRESULT (WINAPI * tScriptRecordDigitSubstitution) (LCID Locale,
00314                                                            SCRIPT_DIGITSUBSTITUTE *psds);
00315 
00316 typedef HRESULT (WINAPI * tScriptShape) (HDC hdc,
00317                                          SCRIPT_CACHE *psc,
00318                                          const WCHAR *pwcChars,
00319                                          int cChars,
00320                                          int cMaxGlyphs,
00321                                          SCRIPT_ANALYSIS *psa,
00322                                          WORD *pwOutGlyphs,
00323                                          WORD *pwLogClust,
00324                                          SCRIPT_VISATTR *psva,
00325                                          int *pcGlyphs);
00326 
00327 typedef HRESULT (WINAPI * tScriptStringAnalyse) (HDC hdc,
00328                                                  const void *pString,
00329                                                  int cString,
00330                                                  int cGlyphs,
00331                                                  int iCharset,
00332                                                  DWORD dwFlags,
00333                                                  int iReqWidth,
00334                                                  SCRIPT_CONTROL *psControl,
00335                                                  SCRIPT_STATE *psState,
00336                                                  const int *piDx,
00337                                                  SCRIPT_TABDEF *pTabdef,
00338                                                  const BYTE *pbInClass,
00339                                                  SCRIPT_STRING_ANALYSIS *pssa);
00340 
00341 typedef HRESULT (WINAPI *tScriptStringCPtoX) (SCRIPT_STRING_ANALYSIS ssa,
00342                                               int icp,
00343                                               BOOL fTrailing,
00344                                               int *pX);
00345 
00346 typedef HRESULT (WINAPI * tScriptStringFree) (SCRIPT_STRING_ANALYSIS *pssa);
00347 
00348 typedef HRESULT (WINAPI * tScriptStringGetLogicalWidths) (SCRIPT_STRING_ANALYSIS ssa, int *piDx);
00349 
00350 typedef HRESULT (WINAPI * tScriptStringGetOrder) (SCRIPT_STRING_ANALYSIS ssa, UINT *puOrder);
00351 
00352 typedef HRESULT (WINAPI * tScriptStringOut) (SCRIPT_STRING_ANALYSIS ssa,
00353                                              int iX,
00354                                              int iY,
00355                                              UINT uOptions,
00356                                              const RECT *prc,
00357                                              int iMinSel,
00358                                              int iMaxSel,
00359                                              BOOL fDisabled);
00360 
00361 typedef const int* (WINAPI * tScriptString_pcOutChars) (SCRIPT_STRING_ANALYSIS ssa);
00362 
00363 typedef const SCRIPT_LOGATTR* (WINAPI * tScriptString_pLogAttr) (SCRIPT_STRING_ANALYSIS ssa);
00364 
00365 typedef const SIZE* (WINAPI * tScriptString_pSize) (SCRIPT_STRING_ANALYSIS ssa);
00366 
00367 typedef HRESULT (WINAPI * tScriptStringValidate) (SCRIPT_STRING_ANALYSIS ssa);
00368 
00369 typedef HRESULT (WINAPI * tScriptStringXtoCP) (SCRIPT_STRING_ANALYSIS  ssa,
00370                                                int iX,
00371                                                int *piCh,
00372                                                int *piTrailing);
00373 
00374 typedef HRESULT (WINAPI * tScriptTextOut) (const HDC hdc,
00375                                            SCRIPT_CACHE *psc,
00376                                            int x,
00377                                            int y,
00378                                            UINT fuOptions,
00379                                            const RECT *lprc,
00380                                            const SCRIPT_ANALYSIS *psa,
00381                                            const WCHAR *pwcReserved,
00382                                            int iReserved,
00383                                            const WORD *pwGlyphs,
00384                                            int cGlyphs,
00385                                            const int *piAdvance,
00386                                            const int *piJustify,
00387                                            const GOFFSET *pGoffset);
00388 
00389 typedef HRESULT (WINAPI * tScriptXtoCP) (int iX,
00390                                          int cChars,
00391                                          int cGlyphs,
00392                                          const WORD *pwLogClust,
00393                                          const SCRIPT_VISATTR *psva,
00394                                          const int *piAdvance,
00395                                          const SCRIPT_ANALYSIS *psa,
00396                                          int *piCP,
00397                                          int *piTrailing);
00398 
00399 
00400 G_END_DECLS
00401 #endif

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1