atmfonts.h

Go to the documentation of this file.
00001 // $Id: atmfonts.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // header file for ATM Font manager. This font manager provides access and
00099 // control of Type1 fonts
00100 
00101 /*
00102 */
00103 
00104 #ifndef INC_ATMFONTS
00105 #define INC_ATMFONTS
00106 
00107 //#include "atm.h"
00108 #include "fontbase.h"
00109 //#include "pathtype.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 
00111 class CharDescription;
00112 class DocCoord;
00113 
00115 // Our thunk call mappings
00117 
00118 // DLL defined thunk calls
00119 #define XSATM_GetUtilVersion            1
00120 #define XSATM_ATMProperlyLoaded         2
00121 #define XSATM_ATMGetVersion             3
00122 #define XSATM_ATMGetOutline             4
00123 #define XSATM_ATMForceExactWidth        5
00124 #define XSATM_ATMBeginFontChange        6
00125 #define XSATM_ATMEndFontChange          7
00126 #define XSATM_ATMForceFontChange        8
00127 #define XSATM_ATMFontStatus             9
00128 #define XSATM_ATMAddFont                10
00129 #define XSATM_ATMRemoveFont             11
00130 
00131 // Minimum version of calls
00132 #define MinVer_GetVersion               0x0100
00133 #define MinVer_ProperlyLoaded           0x0100
00134 #define MinVer_GetOutline               0x0100
00135 #define MinVer_ForceExactWidth          0x0101
00136 #define MinVer_BeginFontChange          0x0205
00137 #define MinVer_EndFontChange            0x0205
00138 #define MinVer_ForceFontChange          0x0300
00139 #define MinVer_FontStatus               0x0205
00140 #define MinVer_AddFont                  0x0205 
00141 #define MinVer_RemoveFont               0x0205
00142 
00143 // structures of DLL thunk calls
00144 typedef BOOL (FAR PASCAL *LPFNMYCLOSEPATH) (LPSTR lpData);
00145 typedef BOOL (FAR PASCAL *LPFNMYMOVETO) (LPATMFixedPoint lpFixPnt, LPSTR lpData);
00146 typedef BOOL (FAR PASCAL *LPFNMYLINETO) (LPATMFixedPoint lpFixPnt, LPSTR lpData);
00147 typedef BOOL (FAR PASCAL *LPFNMYCURVETO) (LPATMFixedPoint lpFixPnt0,
00148                                           LPATMFixedPoint lpFixPnt1,
00149                                           LPATMFixedPoint lpFixPnt2,
00150                                           LPSTR lpData);
00151 
00152 typedef WORD (FAR *LPFNATMPROPERLYLOADED)(void);
00153 
00154 typedef WORD (FAR *LPFNATMGETUTILVERSION)(void);
00155 
00156 typedef WORD (FAR *LPFNATMGETVERSION)(void);
00157 
00158 typedef INT32  (FAR *LPFNATMGETOUTLINE)(    HDC              hDC,
00159                                         unsigned char    c,
00160                                         LPATMFixedMatrix lpMatrix,
00161                                         LPFNMYMOVETO     lpProcMoveTo,
00162                                         LPFNMYLINETO     lpProcLineTo,
00163                                         LPFNMYCURVETO    lpProcCurveTo,
00164                                         LPFNMYCLOSEPATH  lpProcClosePath,
00165                                         LPSTR            lpData);
00166 
00167 typedef BOOL (FAR *LPFNATMFORCEEXACTWIDTH)(void);
00168 
00169 typedef INT32 (FAR *LPFNATMFONTSTATUS)(LPSTR lpMenuName,
00170                                     WORD  style,
00171                                     LPSTR lpMetricsFile,
00172                                     LPSTR lpFontFile);
00173 
00174 typedef INT32 (FAR *LPFNATMADDFONT)(LPSTR lpMenuName,
00175                                  WORD  style,
00176                                  LPSTR lpMetricsFile,
00177                                  LPSTR lpFontFile);
00178 
00179 typedef INT32 (FAR *LPFNATMREMOVEFONT)(LPSTR lpMenuName, WORD style);
00180 
00181 typedef INT32 (FAR *LPFNATMBEGINFONTCHANGE)();
00182 typedef INT32 (FAR *LPFNATMENDFONTCHANGE)();
00183 
00184 /********************************************************************************************
00185 
00186 >   class ATMFont : public FontBase
00187             
00188     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00189     Created:    14/9/95
00190     Purpose:    A class description of our ATM fonts. Mainly uses all base class functions
00191                 at the moment, apart from the type
00192 
00193 ********************************************************************************************/
00194 
00195 class ATMFont : public FontBase
00196 {
00197     CC_DECLARE_DYNCREATE(ATMFont)
00198 
00199 public:
00200      ATMFont();
00201     ~ATMFont();
00202     
00203     virtual FontClass GetFontClass() { return FC_ATM; };
00204     virtual void Dump();
00205 };
00206 
00207 /********************************************************************************************
00208 
00209 >   class ATMFontMan : public CCObject
00210             
00211     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00212     Created:    14/9/95
00213     Purpose:    A static class to allow access to Type 1 fonts. There are few functions
00214                 in this class which should be called directly. The OILFontMan provides the
00215                 generic interface of font calls within this application.
00216 
00217 ********************************************************************************************/
00218 
00219 class ATMFontMan : public CCObject
00220 {
00221     CC_DECLARE_DYNCREATE(ATMFontMan)
00222 
00223     friend class OILFontMan;
00224 
00225 // constructor
00226 public:
00227     ATMFontMan();
00228 
00229 // Function not supported by the generic OILFontMan, so you need to call them directly (yuk!)
00230 public:
00231     static BOOL     InitDLL();  // Older thunking dll 
00232     static BOOL     InitLib();  // New non-thinking technology
00233     static void     EnumAllFonts(OILEnumFonts* pClass);
00234 
00235     static INT32    FontStatus(TCHAR *pMenuName, WORD Style, TCHAR *lpMetricsFile, TCHAR *lpFontFile);
00236     static INT32    InstallFont(TCHAR *pMenuName, WORD Style, TCHAR *lpMetricsFile, TCHAR *lpFontFile);
00237     static INT32    DeInstallFont(TCHAR *pMenuName, WORD Style);
00238     static BOOL     ForceExactWidth();
00239 
00240     static OUTLINETEXTMETRIC *GetOutlineTextMetric(LOGFONT *pLogFont) { return NULL; }
00241 // The support interface (functions OILFontMan will use)
00242 private:
00243     static BOOL     CacheNamedFont(String_64* pFontName);
00244     static BOOL     CacheCompatibleFont(String_64* pFontName);
00245     static void     ValidateCache();
00246     static void     FindClosestFont();
00247     static ATMFont* CreateNewFont(String_64* pFontName);
00248     static INT32    GetUtilVersion() { return ATMUtilVersion; }
00249     static INT32    GetVersion() { return ATMVersion; }
00250     static BOOL     GetCharOutline( CharDescription& ChDesc, 
00251                                         DocCoord** ppCoords,
00252                                         PathVerb** ppVerbs,
00253                                         UINT32* pNumCoords,
00254                                         CDC* pDC);
00255 
00256 // Utterly private - not even OILFontMan should use these!
00257 private:
00258     static HINSTANCE GetATMDLL();
00259     static BOOL IsOkToCall();
00260     static BOOL CorrectVersion(INT32 version);
00261 
00262     // Older thunking dll
00263     static INT32 ThunkProperlyLoaded();
00264     static INT32    ThunkGetVersion();
00265     static INT32 ThunkGetUtilVersion();
00266 
00267 private:
00268     // New non-thinking technology
00269     static INT32 LibProperlyLoaded();
00270     static INT32    LibGetVersion();
00271 //  static INT32 LibGetUtilVersion();
00272 
00273     // this is NULL if the DLL isn't found on startup
00274     static HINSTANCE DLLHandle;
00275 
00276     // and here are types of ptrs to functions
00277     typedef WORD (FAR PASCAL * PFN_ATMProperlyLoaded)(void);
00278     typedef WORD (FAR PASCAL * PFN_ATMGetVersion)(void);
00279 
00280     typedef INT32  (FAR PASCAL * PFN_ATMGetOutline)(    HDC              hDC,
00281                                                     unsigned char    c,
00282                                                     LPATMFixedMatrix lpMatrix,
00283                                                     LPFNMYMOVETO     lpProcMoveTo,
00284                                                     LPFNMYLINETO     lpProcLineTo,
00285                                                     LPFNMYCURVETO    lpProcCurveTo,
00286                                                     LPFNMYCLOSEPATH  lpProcClosePath,
00287                                                     LPSTR            lpData);
00288 
00289     typedef BOOL (FAR PASCAL * PFN_ATMForceExactWidth)(void);
00290     typedef WORD (FAR PASCAL * PFN_ATMBeginFontChange)(void);
00291     typedef WORD (FAR PASCAL * PFN_ATMEndFontChange)(void);
00292     typedef WORD (FAR PASCAL * PFN_ATMForceFontChange)(void);
00293 
00294     typedef INT32 (FAR PASCAL * PFN_ATMFontStatus)( LPSTR lpMenuName,
00295                                                     WORD  style,
00296                                                     LPSTR lpMetricsFile,
00297                                                     LPSTR lpFontFile);
00298     typedef INT32 (FAR PASCAL * PFN_ATMAddFont)(        LPSTR lpMenuName,
00299                                                     WORD  style,
00300                                                     LPSTR lpMetricsFile,
00301                                                     LPSTR lpFontFile);
00302     typedef INT32 (FAR PASCAL * PFN_ATMRemoveFont)( LPSTR lpMenuName, WORD style);
00303 
00304 
00305     // *******************
00306     // and actual pointers to functions in the DLL
00307     static PFN_ATMProperlyLoaded    pfnATMProperlyLoaded;
00308     static PFN_ATMGetVersion        pfnATMGetVersion;
00309     static PFN_ATMGetOutline        pfnATMGetOutline;
00310     static PFN_ATMForceExactWidth   pfnATMForceExactWidth;
00311     static PFN_ATMBeginFontChange   pfnATMBeginFontChange;
00312     static PFN_ATMEndFontChange     pfnATMEndFontChange;
00313     static PFN_ATMForceFontChange   pfnATMForceFontChange;
00314     static PFN_ATMFontStatus        pfnATMFontStatus;
00315     static PFN_ATMAddFont           pfnATMAddFont;
00316     static PFN_ATMRemoveFont        pfnATMRemoveFont;
00317 
00318     // *******************
00319     // Actual pointers to functions in the thunking DLL
00320     static LPFNATMPROPERLYLOADED    pfnXSATMProperlyLoaded;
00321 //  static LPFNATMGETVERSION        pfnXSATMGetVersion;
00322     static LPFNATMGETOUTLINE        pfnXSATMGetOutline;
00323     static LPFNATMFORCEEXACTWIDTH   pfnXSATMForceExactWidth;
00324     static LPFNATMBEGINFONTCHANGE   pfnXSATMBeginFontChange;
00325     static LPFNATMENDFONTCHANGE     pfnXSATMEndFontChange;
00326 //  static PFN_ATMForceFontChange   pfnXSATMForceFontChange;
00327     static LPFNATMFONTSTATUS        pfnXSATMFontStatus;
00328     static LPFNATMADDFONT           pfnXSATMAddFont;
00329     static LPFNATMREMOVEFONT        pfnXSATMRemoveFont;
00330 
00331 private:
00332     static INT32 BeginFontChange();
00333     static INT32 AddFont(TCHAR *pMenuName, WORD Style, TCHAR *lpMetricsFile, TCHAR *lpFontFile);
00334     static INT32 RemoveFont(TCHAR *pMenuName, WORD Style);
00335     static INT32 EndFontChange();
00336 
00337 private:
00338     static BOOL FAR PASCAL EXPORT MyClosePath(LPSTR lpData);
00339     static BOOL FAR PASCAL EXPORT MyMoveTo(LPATMFixedPoint lpFixPnt, LPSTR lpData);
00340     static BOOL FAR PASCAL EXPORT MyLineTo(LPATMFixedPoint lpFixPnt, LPSTR lpData);
00341     static BOOL FAR PASCAL EXPORT MyCurveTo(LPATMFixedPoint lpFixPnt1,
00342                                             LPATMFixedPoint lpFixPnt2,
00343                                             LPATMFixedPoint lpFixPnt3,
00344                                             LPSTR lpData);
00345 
00346 // finally the class variables.
00347 private:
00348     static BOOL ATMRunning;
00349     static INT32 ATMVersion;
00350     static INT32 ATMUtilVersion;
00351 
00352     static BOOL UseThunking;
00353 };
00354 
00355 // functions called as callbacks from some of the previous functions. The names break one
00356 // of the style rules, but this is to re-enforce the fact that while these functions are
00357 // global they should be treated as members of the ATMFontMan class.
00358 // They can't be member functions, since they are used as callback functions.
00359 
00360 INT32 APIENTRY  ATMFontMan_CallBackCacheNamedFont(ENUMLOGFONT FAR* lpelf,
00361                                                   NEWTEXTMETRIC FAR* lpntm,
00362                                                   INT32 FontType,
00363                                                   LPARAM lParam);
00364 INT32 APIENTRY  ATMFontMan_CallBackValidateFont(ENUMLOGFONT FAR* lpelf,
00365                                                 NEWTEXTMETRIC FAR* lpntm,
00366                                                 INT32 FontType,
00367                                                 LPARAM lParam);
00368 INT32 APIENTRY  ATMFontMan_CallBackDispatchFont(ENUMLOGFONT FAR* lpelf,
00369                                                 NEWTEXTMETRIC FAR* lpntm,
00370                                                 INT32 FontType,
00371                                                 LPARAM lParam);
00372 INT32 APIENTRY  ATMFontMan_CallBackFindClosestFont(ENUMLOGFONT FAR* lpelf,
00373                                                    NEWTEXTMETRIC FAR* lpntm,
00374                                                    INT32 FontType,
00375                                                    LPARAM lParam);
00376 #endif

Generated on Sat Nov 10 03:48:03 2007 for Camelot by  doxygen 1.4.4