ReactOS  0.4.14-dev-337-gf981a68
bmfd.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS win32 subsystem
3  * LICENSE: GPL - See COPYING in the top level directory
4  * PURPOSE: GDI font driver for bitmap fonts
5  * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
6  */
7 
8 #ifndef _BMFD_PCH_
9 #define _BMFD_PCH_
10 
11 #include <stdarg.h>
12 #include <windef.h>
13 #include <wingdi.h>
14 #include <winddi.h>
15 
16 #if defined(_M_IX86) || defined(_M_AMD64)
17 /* on x86 and x64, unaligned access is allowed, byteorder is LE */
18 #define GETVAL(x) (x)
19 #else
20 // FIXME: BE
21 #define GETVAL(x) \
22  (sizeof(x) == 1) ? (x) : \
23  (sizeof(x) == 2) ? (((PCHAR)&(x))[0] + (((PCHAR)&(x))[1] << 8)) : \
24  (((PCHAR)&(x))[0] + (((PCHAR)&(x))[1] << 8) + (((PCHAR)&(x))[2] << 16) + \
25  (((PCHAR)&(x))[3] << 24))
26 
27 #endif
28 
29 #define FDM_MASK \
30  FDM_TYPE_CONST_BEARINGS | FDM_TYPE_ZERO_BEARINGS | \
31  FDM_TYPE_CHAR_INC_EQUAL_BM_BASE | FDM_TYPE_MAXEXT_EQUAL_BM_SIDE | \
32  FDM_TYPE_BM_SIDE_CONST
33 
34 #define FM_INFO_MASK \
35  FM_INFO_TECH_BITMAP | FM_INFO_1BPP | FM_INFO_INTEGER_WIDTH | \
36  FM_INFO_RETURNS_BITMAPS | FM_INFO_RIGHT_HANDED | FM_INFO_INTEGRAL_SCALING |\
37  FM_INFO_90DEGREE_ROTATIONS | FM_INFO_OPTICALLY_FIXED_PITCH | FM_INFO_NONNEGATIVE_AC
38 
39 #define FLOATL_1 0x3f800000
40 
41 #define TAG_PDEV 'veDP'
42 #define TAG_GLYPHSET 'GlSt'
43 #define TAG_IFIMETRICS 'Ifim'
44 #define TAG_FONTINFO 'Font'
45 
46 
49 #define IMAGE_DOS_MAGIC 0x594D // FIXME: hack hack hack
50 
51 #include <pshpack1.h>
52 typedef struct
53 {
54  WORD offset;
55  WORD length;
56  WORD flags;
57  WORD id;
58  WORD handle;
59  WORD usage;
61 
62 #define NE_RSCTYPE_FONT 0x8008
63 #define NE_RSCTYPE_FONTDIR 0x8007
64 typedef struct
65 {
66  WORD type_id;
67  WORD count;
68  DWORD resloader;
69  NE_NAMEINFO nameinfo[1];
71 
72 typedef struct
73 {
77 
78 // Values of dfFlags:
79 #define DFF_FIXED 0x0001
80 #define DFF_PROPORTIONAL 0x0002
81 #define DFF_ABCFIXED 0x0004
82 #define DFF_ABCPROPORTIONAL 0x0008
83 #define DFF_1COLOR 0x0010
84 #define DFF_16COLOR 0x0020
85 #define DFF_256COLOR 0x0040
86 #define DFF_RGBCOLOR 0x0080
87 
88 // see http://msdn.microsoft.com/en-us/library/ms648014(VS.85).aspx
89 typedef struct _FONTDIRENTRY
90 {
93  char dfCopyright[60];
119  char szDeviceName[1];
120  char szFaceName[1];
122 
123 typedef struct _DIRENTRY
124 {
127 } DIRENTRY, *PDIRENTRY;
128 
129 typedef struct _FONTGROUPHDR
130 {
134 
135 typedef struct
136 {
139  CHAR dfCopyright[60];
167  /* Version 3.00: */
173  DWORD dfReserved1[4];
174  BYTE dfCharTable[1];
176 
177 typedef struct
178 {
182 
183 typedef struct
184 {
188 
189 typedef union
190 {
194 
195 #include <poppack.h>
196 
197 
200 typedef enum
201 {
204 } FONTTYPE;
205 
206 typedef struct
207 {
232 
233 typedef struct
234 {
240  BMFD_FACE aface[1];
242 
243 typedef struct
244 {
251 
252 //"Bold Italic Underline Strikeout"
253 #define MAX_STYLESIZE 35
254 typedef struct
255 {
257  BYTE ajCharSet[16];
258  WCHAR wszFamilyName[LF_FACESIZE];
259  WCHAR wszFaceName[LF_FACESIZE];
260  WCHAR wszStyleName[MAX_STYLESIZE];
262 
263 
266 ULONG
267 DbgPrint(IN PCHAR Format, IN ...);
268 
269 DHPDEV
270 APIENTRY
272  IN DEVMODEW *pdm,
274  IN ULONG cPat,
275  OUT HSURF *phsurfPatterns,
276  IN ULONG cjCaps,
277  OUT ULONG *pdevcaps,
279  OUT DEVINFO *pdi,
280  IN HDEV hdev,
282  IN HANDLE hDriver);
283 
284 VOID
285 APIENTRY
287  IN DHPDEV dhpdev,
288  IN HDEV hdev);
289 
290 VOID
291 APIENTRY
293  IN DHPDEV dhpdev);
294 
295 ULONG_PTR
296 APIENTRY
298  ULONG cFiles,
299  ULONG_PTR *piFile,
300  PVOID *ppvView,
301  ULONG *pcjView,
302  DESIGNVECTOR *pdv,
303  ULONG ulLangID,
305 
306 BOOL
307 APIENTRY
309  IN ULONG_PTR iFile);
310 
311 LONG
312 APIENTRY
315  ULONG ulMode,
316  ULONG cjBuf,
317  ULONG *pulBuf);
318 
319 LONG
320 APIENTRY
322  ULONG culCaps,
323  ULONG *pulCaps);
324 
325 PVOID
326 APIENTRY
328  DHPDEV dhpdev,
330  ULONG iFace,
331  ULONG iMode,
332  ULONG_PTR *pid);
333 
335 APIENTRY
337  IN DHPDEV dhpdev,
339  IN ULONG iFace,
340  IN ULONG_PTR *pid);
341 
342 VOID
343 APIENTRY
344 BmfdFree(
345  PVOID pv,
346  ULONG_PTR id);
347 
349 APIENTRY
351  FONTOBJ *pfo,
352  ULONG iMode);
353 
354 LONG
355 APIENTRY
357  DHPDEV dhpdev,
358  FONTOBJ *pfo,
359  ULONG iMode,
360  HGLYPH hg,
361  OUT GLYPHDATA *pgd,
362  PVOID pv,
363  ULONG cjSize);
364 
365 VOID
366 APIENTRY
368  IN FONTOBJ *pfo);
369 
370 #endif /* _BMFD_PCH_ */
WORD dfBspace
Definition: bmfd.h:170
WORD dfPixWidth
Definition: bmfd.h:152
signed char * PCHAR
Definition: retypes.h:7
CHAR chFirstChar
Definition: bmfd.h:216
BYTE dfDefaultChar
Definition: bmfd.h:159
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define IN
Definition: typedefs.h:38
DWORD dfFace
Definition: bmfd.h:117
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
VOID APIENTRY BmfdDestroyFont(IN FONTOBJ *pfo)
Definition: font.c:683
union GLYPHENTRY * PGLYPHENTRY
WORD fontOrdinal
Definition: bmfd.h:125
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR * pdv
Definition: winddi.h:3723
#define LF_FACESIZE
Definition: dimm.idl:39
CHAR chLastChar
Definition: bmfd.h:217
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm
char szDeviceName[1]
Definition: bmfd.h:119
struct _FONTGROUPHDR * PFONTGROUPHDR
PVOID APIENTRY BmfdQueryFontTree(DHPDEV dhpdev, ULONG_PTR iFile, ULONG iFace, ULONG iMode, ULONG_PTR *pid)
Definition: font.c:383
_In_ ULONG iMode
Definition: winddi.h:3520
LONG APIENTRY BmfdQueryFontData(DHPDEV dhpdev, FONTOBJ *pfo, ULONG iMode, HGLYPH hg, OUT GLYPHDATA *pgd, PVOID pv, ULONG cjSize)
Definition: glyph.c:316
BYTE dfStrikeOut
Definition: bmfd.h:103
WORD dfHorizRes
Definition: bmfd.h:97
ULONG ulVersion
Definition: bmfd.h:212
WORD wPixWidth
Definition: bmfd.h:223
PCHAR pszFaceName
Definition: bmfd.h:213
DWORD dfDevice
Definition: bmfd.h:116
DWORD geOffset
Definition: bmfd.h:186
WORD dfAvgWidth
Definition: bmfd.h:109
FLONG flInfo
Definition: bmfd.h:230
WORD wB
Definition: bmfd.h:226
struct BMFD_IFIMETRICS * PBMFD_IFIMETRICS
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL APIENTRY BmfdUnloadFontFile(IN ULONG_PTR iFile)
Definition: font.c:298
char CHAR
Definition: xmlstorage.h:175
FONTOBJ * pfo
Definition: bmfd.h:245
LONG APIENTRY BmfdQueryFontCaps(ULONG culCaps, ULONG *pulCaps)
Definition: font.c:361
ULONG_PTR iFile
Definition: bmfd.h:236
BYTE dfStrikeOut
Definition: bmfd.h:149
ULONG cGlyphs
Definition: bmfd.h:215
WORD dfExternalLeading
Definition: bmfd.h:146
WORD wWidthBytes
Definition: bmfd.h:224
BYTE dfUnderline
Definition: bmfd.h:102
GLintptr offset
Definition: glext.h:5920
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR _In_ ULONG ulLangID
Definition: winddi.h:3723
GLYPHENTRY20 ge20
Definition: bmfd.h:191
WORD dfInternalLeading
Definition: bmfd.h:145
WORD dfMaxWidth
Definition: bmfd.h:110
PIFIMETRICS APIENTRY BmfdQueryFont(IN DHPDEV dhpdev, IN ULONG_PTR iFile, IN ULONG iFace, IN ULONG_PTR *pid)
Definition: font.c:510
#define MAX_STYLESIZE
Definition: bmfd.h:253
struct BMFD_FONT * PBMFD_FONT
DWORD dfFace
Definition: bmfd.h:163
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3553
PCHAR pszCopyright
Definition: bmfd.h:214
FONTTYPE
Definition: bmfd.h:200
VOID APIENTRY BmfdCompletePDEV(IN DHPDEV dhpdev, IN HDEV hdev)
Definition: enable.c:89
struct NE_NAMEINFO * PNE_NAMEINFO
FONTDIRENTRY fde
Definition: bmfd.h:126
WORD dfWeight
Definition: bmfd.h:104
BYTE dfFirstChar
Definition: bmfd.h:157
struct FONTINFO16 * PFONTINFO16
ULONG DbgPrint(IN PCHAR Format, IN ...)
Definition: enable.c:29
BYTE dfReserved
Definition: bmfd.h:166
FONTTYPE ulFontType
Definition: bmfd.h:238
BYTE dfBreakChar
Definition: bmfd.h:114
PBMFD_FACE pface
Definition: bmfd.h:246
WORD geWidth
Definition: bmfd.h:179
BYTE dfPitchAndFamily
Definition: bmfd.h:108
uint32_t ULONG_PTR
Definition: typedefs.h:63
PVOID pvView
Definition: bmfd.h:235
WORD dfWidthBytes
Definition: bmfd.h:115
WORD dfPoints
Definition: bmfd.h:141
struct BMFD_FACE * PBMFD_FACE
DWORD dfBitsOffset
Definition: bmfd.h:165
struct NE_TYPEINFO * PNE_TYPEINFO
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DWORD dfFlags
Definition: bmfd.h:168
LONG xScale
Definition: bmfd.h:247
BYTE dfCharSet
Definition: bmfd.h:151
PFONTGROUPHDR pFontDir
Definition: bmfd.h:237
struct BMFD_FILE * PBMFD_FILE
struct _FONTDIRENTRY FONTDIRENTRY
WORD dfAscent
Definition: bmfd.h:144
WCHAR wcBreakChar
Definition: bmfd.h:221
_In_ ULONG_PTR * piFile
Definition: winddi.h:3720
DWORD dfSize
Definition: bmfd.h:92
DWORD dfBitsPointer
Definition: bmfd.h:164
unsigned long FLONG
Definition: ntbasedef.h:373
WORD dfVersion
Definition: bmfd.h:137
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
WORD dfType
Definition: bmfd.h:140
PBYTE pCharTable
Definition: bmfd.h:210
VOID APIENTRY BmfdDisablePDEV(IN DHPDEV dhpdev)
Definition: enable.c:100
_In_opt_ FONTOBJ * pfo
Definition: winddi.h:3603
WORD dfAspace
Definition: bmfd.h:169
WORD dfVertRes
Definition: bmfd.h:142
_In_ FONTOBJ _In_ ULONG _In_ HGLYPH hg
Definition: winddi.h:3869
BYTE dfLastChar
Definition: bmfd.h:158
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLYPHENTRY30 ge30
Definition: bmfd.h:192
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
BYTE dfPitchAndFamily
Definition: bmfd.h:154
WORD dfPixWidth
Definition: bmfd.h:106
BYTE dfDefaultChar
Definition: bmfd.h:113
WCHAR wcDefaultChar
Definition: bmfd.h:220
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
WORD dfWidthBytes
Definition: bmfd.h:161
PFONTINFO16 pFontInfo
Definition: bmfd.h:209
LONG APIENTRY BmfdQueryFontFile(ULONG_PTR iFile, ULONG ulMode, ULONG cjBuf, ULONG *pulBuf)
Definition: font.c:317
WORD dfAvgWidth
Definition: bmfd.h:155
struct _DIRENTRY * PDIRENTRY
_In_ ULONG_PTR _In_ ULONG iFace
Definition: winddi.h:3835
_In_ LPWSTR pwszLogAddress
Definition: winddi.h:3548
PFD_GLYPHATTR APIENTRY BmfdQueryGlyphAttrs(FONTOBJ *pfo, ULONG iMode)
Definition: glyph.c:305
WORD dfMaxWidth
Definition: bmfd.h:156
GLbitfield flags
Definition: glext.h:7161
type_id
WORD size_shift
Definition: bmfd.h:74
struct GLYPHENTRY30 * PGLYPHENTRY30
WORD wC
Definition: bmfd.h:227
_In_ DWORD cjBuf
Definition: winddi.h:3827
WCHAR wcLastChar
Definition: bmfd.h:219
struct GLYPHENTRY20 * PGLYPHENTRY20
IFIMETRICS ifim
Definition: bmfd.h:256
WORD dfVertRes
Definition: bmfd.h:96
DHPDEV APIENTRY BmfdEnablePDEV(IN DEVMODEW *pdm, IN LPWSTR pwszLogAddress, IN ULONG cPat, OUT HSURF *phsurfPatterns, IN ULONG cjCaps, OUT ULONG *pdevcaps, IN ULONG cjDevInfo, OUT DEVINFO *pdi, IN HDEV hdev, IN LPWSTR pwszDeviceName, IN HANDLE hDriver)
Definition: enable.c:67
WORD wAscent
Definition: bmfd.h:228
char dfCopyright[60]
Definition: bmfd.h:93
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR _In_ ULONG _In_ ULONG ulFastCheckSum
Definition: winddi.h:3723
PFONTDIRENTRY pFontDirEntry
Definition: bmfd.h:208
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
unsigned char BYTE
Definition: mem.h:68
VOID APIENTRY BmfdFree(PVOID pv, ULONG_PTR id)
Definition: font.c:669
Definition: fat.h:102
BYTE dfItalic
Definition: bmfd.h:101
WORD dfCspace
Definition: bmfd.h:171
WORD dfPixHeight
Definition: bmfd.h:153
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR pwszDeviceName
Definition: winddi.h:3553
WORD dfInternalLeading
Definition: bmfd.h:99
_In_ FONTOBJ _In_ ULONG _In_ HGLYPH _In_opt_ GLYPHDATA * pgd
Definition: winddi.h:3869
struct _FONTGROUPHDR FONTGROUPHDR
BYTE dfUnderline
Definition: bmfd.h:148
DIRENTRY ade[1]
Definition: bmfd.h:132
struct NE_RESTABLE * PNE_RESTABLE
BYTE dfCharSet
Definition: bmfd.h:105
DWORD dfDevice
Definition: bmfd.h:162
WORD dfExternalLeading
Definition: bmfd.h:100
WORD dfType
Definition: bmfd.h:94
BYTE dfLastChar
Definition: bmfd.h:112
WORD wA
Definition: bmfd.h:225
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL _In_ ULONG ulMode
Definition: winddi.h:3649
struct _FONTDIRENTRY * PFONTDIRENTRY
BYTE dfBreakChar
Definition: bmfd.h:160
BYTE dfFirstChar
Definition: bmfd.h:111
WORD geOffset
Definition: bmfd.h:180
_In_ LPWSTR _In_ ULONG cPat
Definition: winddi.h:3548
WORD geWidth
Definition: bmfd.h:185
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG cjDevInfo
Definition: winddi.h:3553
struct _DIRENTRY DIRENTRY
LONG yScale
Definition: bmfd.h:248
ULONG cNumFaces
Definition: bmfd.h:239
WORD dfVersion
Definition: bmfd.h:91
WORD dfAscent
Definition: bmfd.h:98
WORD dfWeight
Definition: bmfd.h:150
BYTE dfItalic
Definition: bmfd.h:147
DWORD dfColorPointer
Definition: bmfd.h:172
struct FONTINFO16 * LPFONTINFO16
_In_ LPWSTR _In_ ULONG _In_ ULONG cjCaps
Definition: winddi.h:3551
WORD wDescent
Definition: bmfd.h:229
WORD dfPixHeight
Definition: bmfd.h:107
#define OUT
Definition: typedefs.h:39
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
_In_ ULONG cjSize
Definition: winddi.h:3634
WORD dfPoints
Definition: bmfd.h:95
WORD dfHorizRes
Definition: bmfd.h:143
char szFaceName[1]
Definition: bmfd.h:120
DWORD dfSize
Definition: bmfd.h:138
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BYTE * PBYTE
Definition: pedump.c:66
WORD NumberOfFonts
Definition: bmfd.h:131
WORD wPixHeight
Definition: bmfd.h:222
_In_ HDEV hdev
Definition: winddi.h:3449
DWORD dfReserved
Definition: bmfd.h:118
ULONG_PTR APIENTRY BmfdLoadFontFile(ULONG cFiles, ULONG_PTR *piFile, PVOID *ppvView, ULONG *pcjView, DESIGNVECTOR *pdv, ULONG ulLangID, ULONG ulFastCheckSum)
Definition: font.c:236
#define APIENTRY
Definition: api.h:79
ULONG cjEntrySize
Definition: bmfd.h:211
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3553
WCHAR wcFirstChar
Definition: bmfd.h:218
ULONG ulAngle
Definition: bmfd.h:249