Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #pragma once
00018
00019 #include "maxheap.h"
00020 #include <WTypes.h>
00021 #include "coreexp.h"
00022 #include "strclass.h"
00023
00024
00025 class BezFontManager;
00026 class ClassDesc;
00027 class DllDir;
00028 class BezierShape;
00029
00030 class BezFontMetrics: public MaxHeapOperators {
00031 public:
00032 LONG Height;
00033 LONG Ascent;
00034 LONG Descent;
00035 LONG InternalLeading;
00036 LONG ExternalLeading;
00037 LONG AveCharWidth;
00038 LONG MaxCharWidth;
00039 LONG Weight;
00040 LONG Overhang;
00041 LONG DigitizedAspectX;
00042 LONG DigitizedAspectY;
00043 BCHAR FirstChar;
00044 BCHAR LastChar;
00045 BCHAR DefaultChar;
00046 BCHAR BreakChar;
00047 BYTE Italic;
00048 BYTE Underlined;
00049 BYTE StruckOut;
00050 BYTE PitchAndFamily;
00051 BYTE CharSet;
00052 DWORD Flags;
00053 UINT SizeEM;
00054 UINT CellHeight;
00055 UINT AvgWidth;
00056 CoreExport BezFontMetrics() {}
00057 CoreExport BezFontMetrics(NEWTEXTMETRIC *from);
00058 };
00059
00060
00061 #define BEZFONT_TRUETYPE 0
00062 #define BEZFONT_OTHER 1
00063
00064
00065
00066
00067 class BezFontInfo: public MaxHeapOperators {
00068 public:
00069 MSTR name;
00070 MSTR style;
00071 int type;
00072 DWORD flags;
00073 BezFontMetrics metrics;
00074 BezFontInfo() {}
00075 BezFontInfo(MSTR n, MSTR s, int t, DWORD f, BezFontMetrics &m) { name=n; style=s; type=t; flags=f; metrics=m; }
00076 CoreExport BezFontInfo &operator=(BezFontInfo &from);
00077 };
00078
00079
00080 class DllData: public MaxHeapOperators {
00081 public:
00082 DllData() {}
00083 };
00084
00085
00086 class BezFontEnumProc: public MaxHeapOperators {
00087 public:
00088 virtual ~BezFontEnumProc() {}
00089 virtual BOOL CALLBACK Entry(BezFontInfo &info, LPARAM userInfo)=0;
00090 };
00091
00092
00093 class BezFontMgrEnumProc: public MaxHeapOperators {
00094 public:
00095 BezFontManager *mgr;
00096 CoreExport BOOL CALLBACK Entry(BezFontInfo &info, LPARAM userInfo, DllData *dllData);
00097 void SetMgr(BezFontManager *m) { mgr = m; }
00098 };
00099
00100
00101 class BezFontDll: public MaxHeapOperators {
00102 public:
00103 ClassDesc* dll;
00104 BezFontDll() { dll = NULL; }
00105 BezFontDll(ClassDesc* d) { dll = d; }
00106 };
00107
00108 typedef Tab<BezFontDll *> BezFontDllTab;
00109
00110
00111 class FontMgrInterface: public MaxHeapOperators {
00112 public:
00113 virtual ~FontMgrInterface() {}
00114 virtual HINSTANCE AppInst() = 0;
00115 virtual HWND AppWnd() = 0;
00116 virtual DllDir* AppDllDir() = 0;
00117 virtual int GetFontDirCount() = 0;
00118 virtual const MCHAR* GetFontDir (int i) = 0;
00119 };
00120
00121 typedef int BEZFONTHANDLE;
00122
00123
00124 class AvailableFont: public MaxHeapOperators {
00125 public:
00126 BezFontInfo info;
00127 DllData *dllData;
00128 INT_PTR dllIndex;
00129 AvailableFont() { dllData = NULL; }
00130 AvailableFont(BezFontInfo &i, INT_PTR di, DllData *dd=NULL) { info=i; dllIndex=di; dllData=dd; }
00131 CoreExport ~AvailableFont();
00132 };
00133
00134 typedef Tab<AvailableFont *> AvailableFontTab;
00135
00136
00137 class BezFont: public MaxHeapOperators {
00138 public:
00139 CoreExport BezFont() { }
00140 CoreExport virtual ~BezFont();
00141 CoreExport virtual void EnumerateFonts(BezFontMgrEnumProc& proc, LPARAM userInfo)=0;
00142 CoreExport virtual int OpenFont(MSTR name, DWORD flags, DllData *dllData)=0;
00143 CoreExport virtual void CloseFont()=0;
00144 CoreExport virtual BOOL BuildCharacter(UINT index, float height, BezierShape& shape, float& width, int fontShapeVersion=1)=0;
00145 };
00146
00147
00148 class OpenBezFont: public MaxHeapOperators {
00149 public:
00150 int index;
00151 DWORD flags;
00152 BEZFONTHANDLE handle;
00153 int count;
00154 BezFont *loader;
00155 OpenBezFont() {}
00156 OpenBezFont(int i, DWORD f, BEZFONTHANDLE h, BezFont *l) { index=i; flags=f; handle=h; count=1; loader=l; }
00157 ~OpenBezFont();
00158 };
00159
00160 typedef Tab<OpenBezFont *> OpenBezFontTab;
00161
00162
00163
00164
00165
00166
00167
00168
00169 class BezFontManager: public MaxHeapOperators {
00170 friend class BezFontMgrEnumProc;
00171
00172 private:
00173 FontMgrInterface *iface;
00174 BOOL initialized;
00175 BezFontDllTab dllTab;
00176 AvailableFontTab available;
00177 OpenBezFontTab open;
00178 BezFontMgrEnumProc enumProc;
00179 public:
00180 CoreExport BezFontManager();
00181 CoreExport ~BezFontManager();
00182 CoreExport void SetInterface(FontMgrInterface *i) { iface = i; }
00183 CoreExport void Init();
00184 CoreExport void Uninit();
00185 CoreExport void Reinit();
00186 CoreExport void EnumerateFonts(BezFontEnumProc &proc, LPARAM userInfo);
00187 CoreExport BOOL FontExists(MSTR name);
00188 CoreExport BEZFONTHANDLE OpenFont(MSTR name, DWORD flags);
00189 CoreExport BOOL CloseFont(BEZFONTHANDLE handle);
00190 CoreExport BOOL BuildCharacter(BEZFONTHANDLE handle, UINT index, float height, BezierShape& shape, float &width, int fontShapeVersion=1);
00191 CoreExport FontMgrInterface *GetInterface() { return iface; }
00192 CoreExport BOOL GetFontInfo(MSTR name, BezFontInfo &info);
00193 };
00194
00195 extern CoreExport BezFontManager theBezFontManager;
00196