Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

t2embapi.h

00001 /***************************************************************************
00002  * Module: T2EMBAPI.H
00003  *
00004  * Copyright (c) Microsoft Corp., 1996, 1997, 1998
00005  *
00006  * Author: Paul Linnerud (paulli)
00007  * Date:   May 1996
00008  *
00009  * Mods:
00010  *
00011  * Header file for the TrueType embedding services dll (T2EMBED.DLL)
00012  *
00013  **************************************************************************/
00014 
00015 #ifndef _DWFTK_T2EMBED_API_H
00016 #define _DWFTK_T2EMBED_API_H
00017 
00018 #include "dwfcore/Core.h"
00019 
00020 #ifdef  _DWFCORE_WIN32_SYSTEM
00021 
00022 
00023 #if !defined(_T2API_LIB_)
00024 #define T2API __declspec(dllimport)
00025 #else
00026 #define T2API
00027 #endif
00028 
00029 // Charset flags for ulCharSet field of TTEmbedFont
00030 #if !defined(CHARSET_UNICODE)
00031 #define CHARSET_UNICODE                    1
00032 #define CHARSET_DEFAULT                    1
00033 #define CHARSET_SYMBOL                     2
00034 #define CHARSET_GLYPHIDX                   3
00035 #endif
00036 
00037 // Status returned by TTLoadEmbeddedFont
00038 #if !defined(EMBED_PREVIEWPRINT)
00039 #define EMBED_PREVIEWPRINT                 1
00040 #define EMBED_EDITABLE                     2
00041 #define EMBED_INSTALLABLE                  3
00042 #define EMBED_NOEMBEDDING                  4
00043 #endif
00044 
00045 // Use restriction flags
00046 #if !defined(LICENSE_INSTALLABLE)
00047 #define LICENSE_INSTALLABLE             0x0000
00048 #define LICENSE_DEFAULT                 0x0000
00049 #define LICENSE_NOEMBEDDING             0x0002
00050 #define LICENSE_PREVIEWPRINT            0x0004
00051 #define LICENSE_EDITABLE                0x0008
00052 #endif
00053 
00054 // Options given to TTEmbedFont in uFlags parameter
00055 #if !defined(TTEMBED_RAW)
00056 #define TTEMBED_RAW                                                     0x00000000
00057 #define TTEMBED_SUBSET                                          0x00000001
00058 #define TTEMBED_TTCOMPRESSED                            0x00000004
00059 #define TTEMBED_FAILIFVARIATIONSIMULATED        0x00000010
00060 // Embed EUDC font. If there is typeface EUDC embed it otherwise embed system EUDC.
00061 #define TTEMBED_EMBEDEUDC                                       0x00000020
00062 #define TTEMBED_VALIDATIONTESTS                         0x00000040
00063 #define TTEMBED_WEBOBJECT                                       0x00000080
00064 #define TTEMBED_ENCRYPTDATA                                     0x10000000
00065 #endif
00066 
00067 // Bits returned through pulStatus for TTEmbedFont
00068 #if !defined(TTEMBED_VARIATIONSIMULATED)
00069 #define TTEMBED_VARIATIONSIMULATED              0x00000001
00070 // Bit set if EUDC embed success.               
00071 #define TTEMBED_EUDCEMBEDDED                    0x00000002
00072 // Bit set if font embedding permissions indicate no subset and subset requested by client.     
00073 #define TTEMBED_SUBSETCANCEL                    0x00000004              
00074 #endif
00075 
00076 // Flag options for TTLoadEmbeddedFont
00077 #if !defined(TTLOAD_PRIVATE)
00078 #define TTLOAD_PRIVATE                  0x00000001
00079 // If typeface already has EUDC, overwrite setting.
00080 #define TTLOAD_EUDC_OVERWRITE                   0x00000002
00081 #endif
00082 
00083 // Bits returned through pulStatus for TTLoadEmbeddedFont
00084 #if !defined(TTLOAD_FONT_SUBSETTED)
00085 #define TTLOAD_FONT_SUBSETTED           0x00000001
00086 #define TTLOAD_FONT_IN_SYSSTARTUP       0x00000002
00087 #define TTLOAD_EUDC_SET                         0x00000004
00088 #endif
00089 
00090 // Flag options for TTDeleteEmbeddedFont
00091 #if !defined(TTDELETE_DONTREMOVEFONT)
00092 #define TTDELETE_DONTREMOVEFONT         0x00000001      
00093 #endif
00094 
00095 // Error codes
00096 #if !defined(E_NONE)
00097 #define E_NONE                      0x0000L
00098 #endif
00099 
00100 // Top level error codes
00101 #if !defined(E_CHARCODECOUNTINVALID)
00102 #define E_CHARCODECOUNTINVALID      0x0002L
00103 #define E_CHARCODESETINVALID        0x0003L
00104 #define E_DEVICETRUETYPEFONT        0x0004L
00105 #define E_HDCINVALID                0x0006L
00106 #define E_NOFREEMEMORY              0x0007L
00107 #define E_FONTREFERENCEINVALID      0x0008L
00108 #define E_NOTATRUETYPEFONT          0x000AL
00109 #define E_ERRORACCESSINGFONTDATA    0x000CL
00110 #define E_ERRORACCESSINGFACENAME    0x000DL
00111 #define E_ERRORUNICODECONVERSION    0x0011L
00112 #define E_ERRORCONVERTINGCHARS      0x0012L
00113 #define E_EXCEPTION                                     0x0013L
00114 #define E_RESERVEDPARAMNOTNULL          0x0014L 
00115 #define E_CHARSETINVALID                        0x0015L
00116 #define E_WIN32S_NOTSUPPORTED           0x0016L
00117 #define E_FILE_NOT_FOUND                        0x0017L
00118 #define E_TTC_INDEX_OUT_OF_RANGE        0x0018L
00119 #define E_INPUTPARAMINVALID                     0x0019L
00120 #endif
00121 
00122 // Indep level error codes
00123 #if !defined(E_ERRORCOMPRESSINGFONTDATA)
00124 #define E_ERRORCOMPRESSINGFONTDATA    0x0100L
00125 #define E_FONTDATAINVALID             0x0102L
00126 #define E_NAMECHANGEFAILED            0x0103L
00127 #define E_FONTNOTEMBEDDABLE           0x0104L
00128 #define E_PRIVSINVALID                0x0105L
00129 #define E_SUBSETTINGFAILED            0x0106L
00130 #define E_READFROMSTREAMFAILED        0x0107L
00131 #define E_SAVETOSTREAMFAILED          0x0108L
00132 #define E_NOOS2                       0x0109L
00133 #define E_T2NOFREEMEMORY              0x010AL
00134 #define E_ERRORREADINGFONTDATA        0x010BL
00135 #define E_FLAGSINVALID                0x010CL
00136 #define E_ERRORCREATINGFONTFILE       0x010DL
00137 #define E_FONTALREADYEXISTS           0x010EL
00138 #define E_FONTNAMEALREADYEXISTS       0x010FL
00139 #define E_FONTINSTALLFAILED           0x0110L
00140 #define E_ERRORDECOMPRESSINGFONTDATA  0x0111L
00141 #define E_ERRORACCESSINGEXCLUDELIST   0x0112L
00142 #define E_FACENAMEINVALID                         0x0113L
00143 #define E_STREAMINVALID               0x0114L
00144 #define E_STATUSINVALID                           0x0115L
00145 #define E_PRIVSTATUSINVALID                       0x0116L
00146 #define E_PERMISSIONSINVALID              0x0117L
00147 #define E_PBENABLEDINVALID                        0x0118L
00148 #define E_SUBSETTINGEXCEPTION             0x0119L
00149 #define E_SUBSTRING_TEST_FAIL             0x011AL
00150 #define E_FONTVARIATIONSIMULATED          0x011BL
00151 #define E_FONTVALIDATEFAIL                        0x011CL
00152 #define E_FONTFAMILYNAMENOTINFULL         0x011DL
00153 #endif
00154 
00155 // Bottom level error codes
00156 #if !defined(E_ADDFONTFAILED)
00157 #define E_ADDFONTFAILED             0x0200L
00158 #define E_COULDNTCREATETEMPFILE     0x0201L
00159 #define E_FONTFILECREATEFAILED      0x0203L
00160 #define E_WINDOWSAPI                0x0204L
00161 #define E_FONTFILENOTFOUND          0x0205L
00162 #define E_RESOURCEFILECREATEFAILED  0x0206L
00163 #define E_ERROREXPANDINGFONTDATA    0x0207L
00164 #define E_ERRORGETTINGDC            0x0208L
00165 #define E_EXCEPTIONINDECOMPRESSION      0x0209L
00166 #define E_EXCEPTIONINCOMPRESSION        0x020AL
00167 #endif
00168 
00169 #ifdef __cplusplus
00170 extern "C" {
00171 #endif
00172 
00173 // 1st argument - Stream identifier (file handle or other) (dwStream) */
00174 // 2nd argument - Address of buffer with data to read or write */
00175 // 3rd argument - Number of bytes to read or write */
00176 typedef unsigned long( __cdecl *READEMBEDPROC ) ( void*, void*, const unsigned long );
00177 typedef unsigned long( __cdecl *WRITEEMBEDPROC ) ( void*, const void*, const unsigned long );
00178 
00179 #if !defined(_TTLOADINFO_DEFINED)
00180 typedef struct
00181 {
00182         unsigned short usStructSize;    // size in bytes of structure client should set to sizeof(TTLOADINFO)
00183         unsigned short usRefStrSize;    // size in wide characters of pusRefStr including NULL terminator
00184         unsigned short *pusRefStr;              // reference or actual string.
00185 }TTLOADINFO;
00186 #define _TTLOADINFO_DEFINED
00187 #endif
00188 
00189 #if !defined(_TTEMBEDINFO_DEFINED)
00190 typedef struct
00191 {
00192         unsigned short usStructSize;    // size in bytes of structure client should set to sizeof(TTEMBEDINFO)
00193         unsigned short usRootStrSize;   // size in wide chars of pusSubStr including NULL terminator(s)
00194         unsigned short *pusRootStr;             // substring(s) of strings given at load time. can have multiple strings separated
00195                                                                         //  by a NULL terminator.
00196 }TTEMBEDINFO;
00197 #define _TTEMBEDINFO_DEFINED
00198 #endif
00199 
00200 #if !defined(_TTVALIDATIONTESTSPARAMS_DEFINED)
00201 typedef struct
00202 {
00203         unsigned long ulStructSize;
00204         long lTestFromSize;
00205         long lTestToSize;
00206         unsigned long ulCharSet; // Same as ulCharSet param to TTEmbedFont.
00207         unsigned short usReserved1;
00208         unsigned short usCharCodeCount; // If zero, we test over all glyphs.
00209         unsigned short* pusCharCodeSet; // Pointer to array of Unicode chars. 
00210 }TTVALIDATIONTESTSPARAMS;
00211 #define _TTVALIDATIONTESTSPARAMS_DEFINED
00212 #endif
00213 
00214 /* Font Embedding APIs ----------------------------------------------------*/
00215 
00216 T2API LONG WINAPI TTEmbedFont
00217 (
00218         HDC       hDC,                    // device-context handle
00219         ULONG     ulFlags,                // flags specifying the request
00220         ULONG     ulCharSet,              // flags specifying char set
00221         ULONG*    pulPrivStatus,          // upon completion contains embedding priv of font
00222         ULONG*    pulStatus,              // on completion may contain status flags for request
00223         WRITEEMBEDPROC lpfnWriteToStream, // callback function for doc/disk writes
00224         LPVOID    lpvWriteStream,         // the output stream tokin
00225         USHORT*   pusCharCodeSet,         // address of buffer containing optional
00226                                                                           // character codes for subsetting
00227         USHORT    usCharCodeCount,        // number of characters in the
00228                                                                           // lpvCharCodeSet buffer
00229         USHORT    usLanguage,             // specifies the language in the name table to keep
00230                                                                           //  set to 0 to keep all
00231         TTEMBEDINFO* pTTEmbedInfo         // optional security
00232 );
00233 
00234 typedef LONG (WINAPI* fpTTEmbedFont)
00235 (
00236         HDC       hDC,                    // device-context handle
00237         ULONG     ulFlags,                // flags specifying the request
00238         ULONG     ulCharSet,              // flags specifying char set
00239         ULONG*    pulPrivStatus,          // upon completion contains embedding priv of font
00240         ULONG*    pulStatus,              // on completion may contain status flags for request
00241         WRITEEMBEDPROC lpfnWriteToStream, // callback function for doc/disk writes
00242         LPVOID    lpvWriteStream,         // the output stream tokin
00243         USHORT*   pusCharCodeSet,         // address of buffer containing optional
00244                                                                           // character codes for subsetting
00245         USHORT    usCharCodeCount,        // number of characters in the
00246                                                                           // lpvCharCodeSet buffer
00247         USHORT    usLanguage,             // specifies the language in the name table to keep
00248                                                                           //  set to 0 to keep all
00249         TTEMBEDINFO* pTTEmbedInfo         // optional security
00250 );
00251 
00252 T2API LONG WINAPI TTLoadEmbeddedFont
00253 (
00254         HANDLE*   phFontReference,                      // on completion, contains handle to identify embedded font installed
00255                                                                                 // on system
00256         ULONG     ulFlags,                                      // flags specifying the request
00257         ULONG*    pulPrivStatus,                        // on completion, contains the embedding status
00258         ULONG     ulPrivs,                                      // allows for the reduction of licensing privileges
00259         ULONG*    pulStatus,                            // on completion, may contain status flags for request
00260         READEMBEDPROC lpfnReadFromStream,       // callback function for doc/disk reads
00261         LPVOID    lpvReadStream,                        // the input stream tokin
00262         LPWSTR    szWinFamilyName,                      // the new 16 bit windows family name can be NULL
00263         LPSTR     szMacFamilyName,                      // the new 8 bit mac family name can be NULL
00264         TTLOADINFO* pTTLoadInfo                         // optional security
00265 );
00266 
00267 typedef LONG (WINAPI* fpTTLoadEmbeddedFont)
00268 (
00269         HANDLE*   phFontReference,                      // on completion, contains handle to identify embedded font installed
00270                                                                                 // on system
00271         ULONG     ulFlags,                                      // flags specifying the request
00272         ULONG*    pulPrivStatus,                        // on completion, contains the embedding status
00273         ULONG     ulPrivs,                                      // allows for the reduction of licensing privileges
00274         ULONG*    pulStatus,                            // on completion, may contain status flags for request
00275         READEMBEDPROC lpfnReadFromStream,       // callback function for doc/disk reads
00276         LPVOID    lpvReadStream,                        // the input stream tokin
00277         LPWSTR    szWinFamilyName,                      // the new 16 bit windows family name can be NULL
00278         LPSTR     szMacFamilyName,                      // the new 8 bit mac family name can be NULL
00279         TTLOADINFO* pTTLoadInfo                         // optional security
00280 );
00281 
00282 T2API LONG WINAPI TTGetEmbeddedFontInfo
00283 (       
00284         ULONG     ulFlags,                                      // flags specifying the request
00285         ULONG*    pulPrivStatus,                        // on completion, contains the embedding status
00286         ULONG     ulPrivs,                                      // allows for the reduction of licensing privileges
00287         ULONG*    pulStatus,                            // on completion, may contain status flags for request
00288         READEMBEDPROC lpfnReadFromStream,       // callback function for doc/disk reads
00289         LPVOID    lpvReadStream,                        // the input stream tokin       
00290         TTLOADINFO* pTTLoadInfo                         // optional security
00291 );
00292 
00293 T2API LONG WINAPI TTDeleteEmbeddedFont
00294 (
00295         HANDLE    hFontReference,       // Reference to font value provided by load functions                                                                           
00296         ULONG     ulFlags,
00297         ULONG*    pulStatus
00298 );
00299 
00300 typedef LONG (WINAPI* fpTTDeleteEmbeddedFont)
00301 (
00302         HANDLE    hFontReference,       // Reference to font value provided by load functions                                                                           
00303         ULONG     ulFlags,
00304         ULONG*    pulStatus
00305 );
00306 
00307 T2API LONG WINAPI TTGetEmbeddingType
00308 (
00309         HDC         hDC,                   // device context handle
00310         ULONG*      pulEmbedType           // upon completion, contains the
00311                                                                            // embedding status
00312 );
00313 
00314 T2API LONG WINAPI TTCharToUnicode
00315 (       
00316         HDC                     hDC,                            // device context handle
00317         UCHAR*          pucCharCodes,           // array of 8 bit character codes to convert
00318         ULONG           ulCharCodeSize,         // size of 8 bit character code array
00319         USHORT*     pusShortCodes,              // buffer to recieve Unicode code points
00320         ULONG           ulShortCodeSize,        // size in wide characters of 16 bit character code array
00321         ULONG           ulFlags                         // Control flags
00322 );
00323 
00324 T2API LONG WINAPI TTRunValidationTests
00325 (
00326         HDC                                                     hDC,            // device context handle
00327         TTVALIDATIONTESTSPARAMS*        pTestParam      // 
00328 );
00329 
00330 
00331 /* Font Enabling APIs -----------------------------------------------------*/
00332 
00333 T2API LONG WINAPI TTIsEmbeddingEnabled
00334 (
00335         HDC                     hDC,            // device context handle
00336         BOOL*           pbEnabled       // upon completion will indicate if enabled
00337 );
00338 
00339 T2API LONG WINAPI TTIsEmbeddingEnabledForFacename
00340 (
00341         LPSTR           lpszFacename,   // facename
00342         BOOL*           pbEnabled       // upon completion will indicate if enabled
00343 );
00344 
00345 T2API LONG WINAPI TTEnableEmbeddingForFacename
00346 (                                   // If fEnable != 0, it removes the indicated
00347         LPSTR           lpszFacename,   // typeface name from the "embedding
00348         BOOL            bEnable         // exclusion list".  Else, it enters the
00349 );                                  // indicated typeface name in the "embedding
00350                                                                         // exclusion list".
00351 
00352 #ifdef __cplusplus
00353 }
00354 #endif
00355 
00356 
00357 
00358 #else
00359 #error  This is a Win32 header file and is incompatible with your current system configuration
00360 #endif  
00361 
00362 
00363 #endif

Generated on Sat May 7 10:48:24 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1