ReactOS 0.4.15-dev-7924-g5949c20
font.c
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#include "bmfd.h"
9
10static
13 PVOID p,
15 PVOID pStart,
16 PVOID pEnd,
17 ULONG cjAlign)
18{
19 if ((ULONG_PTR)p < (ULONG_PTR)pStart ||
20 (ULONG_PTR)p + cjSize >= (ULONG_PTR)pEnd ||
21 (ULONG_PTR)p & (cjAlign -1))
22 {
23 return FALSE;
24 }
25 return TRUE;
26}
27
28static
29BOOL
31 PBMFD_FACE pface,
32 PFONTINFO16 pFontInfo)
33{
34 CHAR ansi[4];
35 WCHAR unicode[4];
36 ULONG written;
37 DWORD dfFlags;
38
39 pface->pFontInfo = pFontInfo;
40 pface->ulVersion = GETVAL(pFontInfo->dfVersion);
41 pface->cGlyphs = pFontInfo->dfLastChar - pFontInfo->dfFirstChar + 1;
42
43 /* Convert chars to unicode */
44 ansi[0] = pFontInfo->dfFirstChar;
45 ansi[1] = pFontInfo->dfLastChar;
46 ansi[2] = pFontInfo->dfFirstChar + pFontInfo->dfDefaultChar;
47 ansi[3] = pFontInfo->dfFirstChar + pFontInfo->dfBreakChar;
48 EngMultiByteToUnicodeN(unicode, 4 * sizeof(WCHAR), &written, ansi, 4);
49 pface->wcFirstChar = unicode[0];
50 pface->wcLastChar = unicode[1];
51 pface->wcDefaultChar = unicode[2];
52 pface->wcBreakChar = unicode[3];
53
54 /* Copy some values */
55 pface->wPixHeight = GETVAL(pFontInfo->dfPixHeight);
56 pface->wPixWidth = GETVAL(pFontInfo->dfPixWidth);
57 pface->wWidthBytes = GETVAL(pFontInfo->dfWidthBytes);
58 pface->wAscent = GETVAL(pFontInfo->dfAscent);
59 pface->wDescent = pface->wPixHeight - pface->wAscent;
60
61 /* Some version specific members */
62 if (pface->ulVersion >= 0x300)
63 {
64 dfFlags = GETVAL(pFontInfo->dfFlags);
65 pface->wA = GETVAL(pFontInfo->dfAspace);
66 pface->wB = GETVAL(pFontInfo->dfBspace);
67 pface->wC = GETVAL(pFontInfo->dfCspace);
68 pface->pCharTable = pFontInfo->dfCharTable;
69 pface->cjEntrySize = sizeof(GLYPHENTRY30);
70 }
71 else
72 {
73 dfFlags = DFF_1COLOR;
74 pface->wA = 0;
75 pface->wB = 0;
76 pface->wC = 0;
77 pface->pCharTable = &pFontInfo->dfReserved + 1;
78 pface->cjEntrySize = sizeof(GLYPHENTRY20);
79 }
80
81 pface->flInfo = FM_INFO_MASK;
82
83 /* If dfWidth is non-null, we have a fixed width font */
84 if (dfFlags & DFF_FIXED || pface->wPixWidth)
86
87 /* Initialize color depth flags */
88 if (dfFlags & DFF_1COLOR)
89 pface->flInfo |= FM_INFO_1BPP;
90 else if (dfFlags & DFF_16COLOR)
91 pface->flInfo |= FM_INFO_4BPP;
92 else if (dfFlags & DFF_256COLOR)
93 pface->flInfo |= FM_INFO_8BPP;
94 else if (dfFlags & DFF_RGBCOLOR)
95 pface->flInfo |= FM_INFO_24BPP;
96
97 // TODO: walk through all glyphs and veryfy them and calculate max values
98
99 // FIXME: After this point, the whole font data should be verified!
100
101 return TRUE;
102}
103
104static
105PVOID
107 PVOID pvView,
108 ULONG cjView)
109{
110 /* unimplemented */
111 return NULL;
112}
113
114
115static
116PVOID
118 PVOID pvView,
119 ULONG cjView)
120{
121 PIMAGE_DOS_HEADER pDosHeader = pvView;
122 PIMAGE_OS2_HEADER pOs2Header;
123 PNE_RESTABLE pResTable;
124 PNE_TYPEINFO pTInfo;
125 PFONTINFO16 pFontInfo;
126 PCHAR pStart, pEnd;
127 PBMFD_FILE pfile = NULL;
128 WORD wShift;
129 ULONG i, cjOffset, cjLength;
131
132 /* Initial margins for valid pointers */
133 pStart = pvView;
134 pEnd = pStart + cjView;
135
136 /* Check for image dos header */
137 if (GETVAL(pDosHeader->e_magic) != IMAGE_DOS_MAGIC)
138 {
139 return NULL;
140 }
141
142 /* Get pointer to OS2 header and veryfy it is valid */
143 pOs2Header = (PVOID)((PCHAR)pDosHeader + GETVAL(pDosHeader->e_lfanew));
144 pStart += sizeof(IMAGE_DOS_HEADER);
145 if (!IsValidPtr(pOs2Header, sizeof(IMAGE_OS2_HEADER), pStart, pEnd, 4))
146 {
147 DbgPrint("e_lfanew is invalid: 0x%lx\n", pDosHeader->e_lfanew);
148 return NULL;
149 }
150
151 /* Get pointer to resource table and verify it is valid */
152 pResTable = (PVOID)((PCHAR)pOs2Header + GETVAL(pOs2Header->ne_rsrctab));
153 pStart = (PCHAR)pOs2Header;
154 if (!IsValidPtr(pResTable, sizeof(NE_RESTABLE), pStart, pEnd, 1))
155 {
156 DbgPrint("pTInfo is invalid: 0x%p\n", pResTable);
157 return NULL;
158 }
159
160 wShift = GETVAL(pResTable->size_shift);
161 pTInfo = pResTable->typeinfo;
162 type_id = GETVAL(pTInfo->type_id);
163
164 /* Loop the resource table to find a font resource */
165 while (type_id)
166 {
167 /* Get number of nameinfo entries */
168 count = GETVAL(pTInfo->count);
169
170 /* Look for a font resource */
171 if (type_id == NE_RSCTYPE_FONT && count > 0)
172 {
173 DbgPrint("Found NE_RSCTYPE_FONT\n");
174
175 /* Allocate an info structure for this font and all faces */
176 cjLength = sizeof(BMFD_FILE) + (count-1) * sizeof(BMFD_FACE);
177 pfile = EngAllocMem(0, cjLength, TAG_FONTINFO);
178 if (!pfile)
179 {
180 DbgPrint("Not enough memory: %ld\n", cjLength);
181 return NULL;
182 }
183
184 pfile->cNumFaces = count;
185
186 /* Fill all face info structures */
187 for (i = 0; i < count; i++)
188 {
189 cjOffset = GETVAL(pTInfo->nameinfo[i].offset) << wShift;
190 cjLength = GETVAL(pTInfo->nameinfo[i].length) << wShift;
191 pFontInfo = (PVOID)((PCHAR)pDosHeader + cjOffset);
192
193 if (!IsValidPtr(pFontInfo, cjLength, pStart, pEnd, 1))
194 {
195 DbgPrint("pFontInfo is invalid: 0x%p\n", pFontInfo);
196 EngFreeMem(pfile);
197 return NULL;
198 }
199
200 /* Validate FONTINFO and fill face info */
201 if (!FillFaceInfo(&pfile->aface[i], pFontInfo))
202 {
203 DbgPrint("pFontInfo is invalid: 0x%p\n", pFontInfo);
204 EngFreeMem(pfile);
205 return NULL;
206 }
207 }
208
209 /* Break out of the loop */
210 break;
211 }
212
213 /* Following pointers must be bigger than this */
214 pStart = (PCHAR)pTInfo;
215
216 /* Goto next entry in resource table */
217 pTInfo = (PVOID)&pTInfo->nameinfo[count];
218
219 /* Verify that the new pTInfo pointer is valid */
220 if (!IsValidPtr(pTInfo, sizeof(NE_TYPEINFO), pStart, pEnd, 1))
221 {
222 DbgPrint("pTInfo is invalid: 0x%p\n", pTInfo);
223 return NULL;
224 }
225
226 type_id = GETVAL(pTInfo->type_id);
227 }
228
229 return pfile;
230}
231
237 ULONG cFiles,
239 PVOID *ppvView,
240 ULONG *pcjView,
244{
245 PBMFD_FILE pfile = NULL;
246 PVOID pvView;
247 ULONG cjView;
248
249 DbgPrint("BmfdLoadFontFile()\n");
250 __debugbreak();
251
252 /* Check parameters */
253 if (cFiles != 1)
254 {
255 DbgPrint("Only 1 File is allowed, got %ld!\n", cFiles);
256 return HFF_INVALID;
257 }
258
259 /* Map the font file */
260 if (!EngMapFontFileFD(*piFile, (PULONG*)&pvView, &cjView))
261 {
262 DbgPrint("Could not map font file!\n", cFiles);
263 return HFF_INVALID;
264 }
265
266 DbgPrint("mapped font file to %p, site if %ld\n", pvView, cjView);
267
268 /* Try to parse a .fon file */
269 pfile = ParseFonFile(pvView, cjView);
270
271 if (!pfile)
272 {
273 /* Could be a .fnt file */
274 pfile = ParseFntFile(pvView, cjView);
275 }
276
277 /* Check whether we succeeded finding a font */
278 if (!pfile)
279 {
280 DbgPrint("No font data found\n");
281
282 /* Unmap the file */
284
285 /* Failure! */
286 return HFF_INVALID;
287 }
288
289 pfile->iFile = *piFile;
290 pfile->pvView = pvView;
291
292 /* Success, return the pointer to font info structure */
293 return (ULONG_PTR)pfile;
294}
295
296BOOL
300{
301 PBMFD_FILE pfile = (PBMFD_FILE)iFile;
302
303 DbgPrint("BmfdUnloadFontFile()\n");
304
305 /* Unmap the font file */
307
308 /* Free the memory that was allocated for the font */
309 EngFreeMem(pfile);
310
311 return TRUE;
312}
313
314
315LONG
320 ULONG cjBuf,
321 ULONG *pulBuf)
322{
323 PBMFD_FILE pfile = (PBMFD_FILE)iFile;
324
325 DbgPrint("BmfdQueryFontFile()\n");
326// __debugbreak();
327
328 switch (ulMode)
329 {
330 case QFF_DESCRIPTION:
331 {
332 /* We copy the face name of the 1st face */
333 PCHAR pDesc = pfile->aface[0].pszFaceName;
334 ULONG cOutSize;
335 if (pulBuf)
336 {
338 cjBuf,
339 &cOutSize,
340 pDesc,
341 strnlen(pDesc, LF_FACESIZE));
342 }
343 else
344 {
345 cOutSize = (strnlen(pDesc, LF_FACESIZE) + 1) * sizeof(WCHAR);
346 }
347 return cOutSize;
348 }
349
350 case QFF_NUMFACES:
351 /* return the number of faces in the file */
352 return pfile->cNumFaces;
353
354 default:
355 return FD_ERROR;
356 }
357}
358
359LONG
362 ULONG culCaps,
363 ULONG *pulCaps)
364{
365 DbgPrint("BmfdQueryFontCaps()\n");
366
367 /* We need room for 2 ULONGs */
368 if (culCaps < 2)
369 {
370 return FD_ERROR;
371 }
372
373 /* We only support 1 bpp */
374 pulCaps[0] = 2;
375 pulCaps[1] = QC_1BIT;
376
377 return 2;
378}
379
380
381PVOID
384 DHPDEV dhpdev,
386 ULONG iFace,
387 ULONG iMode,
388 ULONG_PTR *pid)
389{
390 PBMFD_FILE pfile = (PBMFD_FILE)iFile;
391 PBMFD_FACE pface;
392 ULONG i, j, cjSize, cGlyphs, cRuns;
393 CHAR ch, chFirst, ach[256];
394 WCHAR wc, awc[256];
395 PFD_GLYPHSET pGlyphSet;
396 WCRUN *pwcrun;
397 HGLYPH * phglyphs;
398
399 DbgPrint("DrvQueryFontTree(iMode=%ld)\n", iMode);
400// __debugbreak();
401
402 /* Check parameters, we only support QFT_GLYPHSET */
403 if (!iFace || iFace > pfile->cNumFaces || iMode != QFT_GLYPHSET)
404 {
405 DbgPrint("iFace = %ld, cNumFaces = %ld\n", iFace, pfile->cNumFaces);
406 return NULL;
407 }
408
409 /* Get a pointer to the face data */
410 pface = &pfile->aface[iFace - 1];
411
412 /* Get the number of characters in the face */
413 cGlyphs = pface->cGlyphs;
414
415 chFirst = pface->pFontInfo->dfFirstChar;
416
417 /* Build array of supported chars */
418 for (i = 0; i < cGlyphs; i++)
419 {
420 ach[i] = chFirst + i;
421 }
422
423 /* Convert the chars to unicode */
424 EngMultiByteToUnicodeN(awc, sizeof(awc), NULL, ach, cGlyphs);
425
426 /* Sort both arrays in wchar order */
427 for (i = 0; i < cGlyphs - 1; i++)
428 {
429 wc = awc[i];
430 for (j = i + 1; j < cGlyphs; j++)
431 {
432 if (awc[j] < wc)
433 {
434 awc[i] = awc[j];
435 awc[j] = wc;
436 wc = awc[i];
437 ch = ach[i];
438 ach[i] = ach[j];
439 ach[j] = ch;
440 }
441 }
442 }
443
444 /* Find number of WCRUNs */
445 cRuns = 1;
446 for (i = 1; i < cGlyphs; i++)
447 {
448 if (awc[i] != awc[i - 1] + 1)
449 {
450 cRuns++;
451 }
452 }
453
454 /* Calculate FD_GLYPHSET size */
455 cjSize = sizeof(FD_GLYPHSET)
456 + (cRuns - 1) * sizeof(WCRUN)
457 + cGlyphs * sizeof(HGLYPH);
458
459 /* Allocate the FD_GLYPHSET structure */
460 pGlyphSet = EngAllocMem(0, cjSize, TAG_GLYPHSET);
461 if (!pGlyphSet)
462 {
463 return NULL;
464 }
465
466 /* Initialize FD_GLYPHSET */
467 pGlyphSet->cjThis = cjSize;
468 pGlyphSet->flAccel = 0;
469 pGlyphSet->cGlyphsSupported = cGlyphs;
470 pGlyphSet->cRuns = cRuns;
471
472 /* Initialize 1st WCRUN */
473 pwcrun = pGlyphSet->awcrun;
474 phglyphs = (PHGLYPH)&pGlyphSet->awcrun[cRuns];
475 pwcrun[0].wcLow = awc[0];
476 pwcrun[0].cGlyphs = 1;
477 pwcrun[0].phg = phglyphs;
478 phglyphs[0] = 0;
479
480 /* Walk through all supported chars */
481 for (i = 1, j = 0; i < cGlyphs; i++)
482 {
483 /* Use offset to glyph entry as hglyph */
484 phglyphs[i] = (ach[i] - chFirst) * pface->cjEntrySize;
485
486 /* Check whether we can append the wchar to a run */
487 if (awc[i] == awc[i - 1] + 1)
488 {
489 /* Append to current WCRUN */
490 pwcrun[j].cGlyphs++;
491 }
492 else
493 {
494 /* Add a new WCRUN */
495 j++;
496 pwcrun[j].wcLow = awc[i];
497 pwcrun[j].cGlyphs = 1;
498 pwcrun[j].phg = &phglyphs[i];
499 }
500 }
501
502 /* Set *pid to the allocated structure for use in BmfdFree */
503 *pid = (ULONG_PTR)pGlyphSet;
504
505 return pGlyphSet;
506}
507
511 IN DHPDEV dhpdev,
513 IN ULONG iFace,
515{
516 PBMFD_FILE pfile = (PBMFD_FILE)iFile;
517 PBMFD_FACE pface;
518 PFONTINFO16 pFontInfo;
519 PIFIMETRICS pifi;
520 PBMFD_IFIMETRICS pifiX;
521 PANOSE panose = {0};
522
523 DbgPrint("BmfdQueryFont()\n");
524// __debugbreak();
525
526 /* Validate parameters */
527 if (iFace > pfile->cNumFaces || !pid)
528 {
529 return NULL;
530 }
531
532 pface = &pfile->aface[iFace - 1];
533 pFontInfo = pface->pFontInfo;
534
535 /* Allocate the structure */
537 if (!pifiX)
538 {
539 return NULL;
540 }
541
542 /* Return a pointer to free it later */
543 *pid = (ULONG_PTR)pifiX;
544
545 /* Fill IFIMETRICS */
546 pifi = &pifiX->ifim;
547 pifi->cjThis = sizeof(BMFD_IFIMETRICS);
548 pifi->cjIfiExtra = 0;
549 pifi->dpwszFamilyName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFamilyName);
550 pifi->dpwszStyleName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFamilyName);
551 pifi->dpwszFaceName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFaceName);
552 pifi->dpwszUniqueName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFaceName);
553 pifi->dpFontSim = 0;
554 pifi->lEmbedId = 0;
555 pifi->lItalicAngle = 0;
556 pifi->lCharBias = 0;
557 pifi->dpCharSets = 0;
558 pifi->jWinCharSet = pFontInfo->dfCharSet;
559 pifi->jWinPitchAndFamily = pFontInfo->dfPitchAndFamily;
560 pifi->usWinWeight = GETVAL(pFontInfo->dfWeight);
561 pifi->flInfo = pface->flInfo;
562 pifi->fsSelection = 0;
563 pifi->fsType = 0;
564 pifi->fwdUnitsPerEm = GETVAL(pFontInfo->dfPixHeight);
565 pifi->fwdLowestPPEm = 0;
566 pifi->fwdWinAscender = GETVAL(pFontInfo->dfAscent);
567 pifi->fwdWinDescender = pifi->fwdUnitsPerEm - pifi->fwdWinAscender;
568 pifi->fwdMacAscender = pifi->fwdWinAscender;
569 pifi->fwdMacDescender = - pifi->fwdWinDescender;
570 pifi->fwdMacLineGap = 0;
571 pifi->fwdTypoAscender = pifi->fwdWinAscender;
572 pifi->fwdTypoDescender = - pifi->fwdWinDescender;
573 pifi->fwdTypoLineGap = 0;
574 pifi->fwdAveCharWidth = GETVAL(pFontInfo->dfAvgWidth);
575 pifi->fwdMaxCharInc = GETVAL(pFontInfo->dfMaxWidth);
576 pifi->fwdCapHeight = pifi->fwdUnitsPerEm / 2;
577 pifi->fwdXHeight = pifi->fwdUnitsPerEm / 4;
578 pifi->fwdSubscriptXSize = 0;
579 pifi->fwdSubscriptYSize = 0;
580 pifi->fwdSubscriptXOffset = 0;
581 pifi->fwdSubscriptYOffset = 0;
582 pifi->fwdSuperscriptXSize = 0;
583 pifi->fwdSuperscriptYSize = 0;
584 pifi->fwdSuperscriptXOffset = 0;
585 pifi->fwdSuperscriptYOffset = 0;
586 pifi->fwdUnderscoreSize = 01;
587 pifi->fwdUnderscorePosition = -1;
588 pifi->fwdStrikeoutSize = 1;
589 pifi->fwdStrikeoutPosition = pifi->fwdXHeight + 1;
590 pifi->chFirstChar = pFontInfo->dfFirstChar;
591 pifi->chLastChar = pFontInfo->dfLastChar;
592 pifi->chDefaultChar = pFontInfo->dfFirstChar + pFontInfo->dfDefaultChar;
593 pifi->chBreakChar = pFontInfo->dfFirstChar + pFontInfo->dfBreakChar;
594 pifi->wcFirstChar = pface->wcFirstChar;
595 pifi->wcLastChar = pface->wcLastChar;
596 pifi->wcDefaultChar = pface->wcDefaultChar;
597 pifi->wcBreakChar = pface->wcBreakChar;
598 pifi->ptlBaseline.x = 1;
599 pifi->ptlBaseline.y = 0;
600 pifi->ptlAspect.x = pFontInfo->dfVertRes; // CHECKME
601 pifi->ptlAspect.y = pFontInfo->dfHorizRes;
602 pifi->ptlCaret.x = 0;
603 pifi->ptlCaret.y = 1;
604 pifi->rclFontBox.left = 0;
605 pifi->rclFontBox.right = pifi->fwdAveCharWidth;
606 pifi->rclFontBox.top = pifi->fwdWinAscender;
607 pifi->rclFontBox.bottom = - pifi->fwdWinDescender;
608 *(DWORD*)&pifi->achVendId = 0x30303030; // FIXME
609 pifi->cKerningPairs = 0;
611 pifi->panose = panose;
612
613 /* Set char sets */
614 pifiX->ajCharSet[0] = pifi->jWinCharSet;
615 pifiX->ajCharSet[1] = DEFAULT_CHARSET;
616
619
620#if 0
622 LF_FACESIZE * sizeof(WCHAR),
623 NULL,
624 pFontInfo->,
625 strnlen(pDesc, LF_FACESIZE));
626#endif
627 wcscpy(pifiX->wszFaceName, L"Courier-X");
628 wcscpy(pifiX->wszFamilyName, L"Courier-X");
629
630 /* Initialize font weight style flags and string */
631 if (pifi->usWinWeight == FW_REGULAR)
632 {
633 // pifi->fsSelection |= FM_SEL_REGULAR;
634 }
635 else if (pifi->usWinWeight > FW_SEMIBOLD)
636 {
637 pifi->fsSelection |= FM_SEL_BOLD;
638 wcscat(pifiX->wszStyleName, L"Bold ");
639 }
640 else if (pifi->usWinWeight <= FW_LIGHT)
641 {
642 wcscat(pifiX->wszStyleName, L"Light ");
643 }
644
645 if (pFontInfo->dfItalic)
646 {
647 pifi->fsSelection |= FM_SEL_ITALIC;
648 wcscat(pifiX->wszStyleName, L"Italic ");
649 }
650
651 if (pFontInfo->dfUnderline)
652 {
654 wcscat(pifiX->wszStyleName, L"Underscore ");
655 }
656
657 if (pFontInfo->dfStrikeOut)
658 {
660 wcscat(pifiX->wszStyleName, L"Strikeout ");
661 }
662
663 return pifi;
664}
665
666
667VOID
670 PVOID pv,
671 ULONG_PTR id)
672{
673 DbgPrint("BmfdFree()\n");
674 if (id)
675 {
676 EngFreeMem((PVOID)id);
677 }
678}
679
680
681VOID
684 IN FONTOBJ *pfo)
685{
686 /* Free the font realization info */
687 EngFreeMem(pfo->pvProducer);
688 pfo->pvProducer = NULL;
689}
unsigned char BOOLEAN
#define DFF_1COLOR
Definition: bmfd.h:83
#define GETVAL(x)
Definition: bmfd.h:21
#define FM_INFO_MASK
Definition: bmfd.h:34
#define TAG_FONTINFO
Definition: bmfd.h:44
#define DFF_RGBCOLOR
Definition: bmfd.h:86
#define TAG_GLYPHSET
Definition: bmfd.h:42
#define DFF_16COLOR
Definition: bmfd.h:84
#define DFF_256COLOR
Definition: bmfd.h:85
struct BMFD_FILE * PBMFD_FILE
#define TAG_IFIMETRICS
Definition: bmfd.h:43
#define DFF_FIXED
Definition: bmfd.h:79
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define ULONG_PTR
Definition: config.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define DbgPrint
Definition: hal.h:12
type_id
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
if(dx< 0)
Definition: linetemp.h:194
#define PCHAR
Definition: match.c:90
#define for
Definition: utility.h:88
static PVOID
Definition: font.c:57
#define L(x)
Definition: ntvdm.h:50
#define IMAGE_DOS_MAGIC
Definition: pecoff.h:6
long LONG
Definition: pedump.c:60
#define EngFreeMem
Definition: polytest.cpp:56
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
WORD wWidthBytes
Definition: bmfd.h:224
WCHAR wcFirstChar
Definition: bmfd.h:218
ULONG ulVersion
Definition: bmfd.h:212
WORD wPixWidth
Definition: bmfd.h:223
ULONG cjEntrySize
Definition: bmfd.h:211
WCHAR wcLastChar
Definition: bmfd.h:219
WORD wPixHeight
Definition: bmfd.h:222
WORD wAscent
Definition: bmfd.h:228
FLONG flInfo
Definition: bmfd.h:230
PBYTE pCharTable
Definition: bmfd.h:210
WORD wDescent
Definition: bmfd.h:229
ULONG cGlyphs
Definition: bmfd.h:215
PFONTINFO16 pFontInfo
Definition: bmfd.h:209
WORD wA
Definition: bmfd.h:225
WCHAR wcBreakChar
Definition: bmfd.h:221
WORD wC
Definition: bmfd.h:227
PCHAR pszFaceName
Definition: bmfd.h:213
WORD wB
Definition: bmfd.h:226
WCHAR wcDefaultChar
Definition: bmfd.h:220
PVOID pvView
Definition: bmfd.h:235
ULONG cNumFaces
Definition: bmfd.h:239
ULONG_PTR iFile
Definition: bmfd.h:236
BMFD_FACE aface[1]
Definition: bmfd.h:240
WCHAR wszFamilyName[LF_FACESIZE]
Definition: bmfd.h:258
WCHAR wszStyleName[MAX_STYLESIZE]
Definition: bmfd.h:260
IFIMETRICS ifim
Definition: bmfd.h:256
BYTE ajCharSet[16]
Definition: bmfd.h:257
WCHAR wszFaceName[LF_FACESIZE]
Definition: bmfd.h:259
BYTE dfDefaultChar
Definition: bmfd.h:159
BYTE dfItalic
Definition: bmfd.h:147
WORD dfWidthBytes
Definition: bmfd.h:161
BYTE dfCharTable[1]
Definition: bmfd.h:174
BYTE dfCharSet
Definition: bmfd.h:151
BYTE dfBreakChar
Definition: bmfd.h:160
WORD dfAspace
Definition: bmfd.h:169
WORD dfPixHeight
Definition: bmfd.h:153
WORD dfMaxWidth
Definition: bmfd.h:156
WORD dfVertRes
Definition: bmfd.h:142
BYTE dfReserved
Definition: bmfd.h:166
WORD dfCspace
Definition: bmfd.h:171
WORD dfWeight
Definition: bmfd.h:150
DWORD dfFlags
Definition: bmfd.h:168
BYTE dfPitchAndFamily
Definition: bmfd.h:154
WORD dfAscent
Definition: bmfd.h:144
WORD dfPixWidth
Definition: bmfd.h:152
WORD dfAvgWidth
Definition: bmfd.h:155
WORD dfBspace
Definition: bmfd.h:170
BYTE dfStrikeOut
Definition: bmfd.h:149
BYTE dfUnderline
Definition: bmfd.h:148
BYTE dfFirstChar
Definition: bmfd.h:157
WORD dfHorizRes
Definition: bmfd.h:143
BYTE dfLastChar
Definition: bmfd.h:158
WORD dfVersion
Definition: bmfd.h:137
WORD offset
Definition: typelib.c:81
WORD length
Definition: typelib.c:82
NE_TYPEINFO typeinfo[1]
Definition: bmfd.h:75
WORD size_shift
Definition: bmfd.h:74
NE_NAMEINFO nameinfo[1]
Definition: bmfd.h:69
WORD type_id
Definition: typelib.c:91
WORD count
Definition: typelib.c:92
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
ULONG cjThis
Definition: winddi.h:641
ULONG cRuns
Definition: winddi.h:644
ULONG cGlyphsSupported
Definition: winddi.h:643
FLONG flAccel
Definition: winddi.h:642
FWORD fwdWinDescender
Definition: winddi.h:1067
PTRDIFF dpCharSets
Definition: winddi.h:1057
ULONG cjThis
Definition: winddi.h:1047
FWORD fwdUnderscoreSize
Definition: winddi.h:1086
BYTE chDefaultChar
Definition: winddi.h:1092
BYTE chFirstChar
Definition: winddi.h:1090
ULONG cjIfiExtra
Definition: winddi.h:1048
BYTE chBreakChar
Definition: winddi.h:1093
FWORD fwdTypoAscender
Definition: winddi.h:1071
ULONG ulPanoseCulture
Definition: winddi.h:1104
USHORT fsSelection
Definition: winddi.h:1062
PTRDIFF dpwszUniqueName
Definition: winddi.h:1052
PTRDIFF dpwszFamilyName
Definition: winddi.h:1049
FWORD fwdStrikeoutPosition
Definition: winddi.h:1089
PTRDIFF dpwszStyleName
Definition: winddi.h:1050
FWORD fwdSubscriptYSize
Definition: winddi.h:1079
FWORD fwdSubscriptXSize
Definition: winddi.h:1078
FWORD fwdSuperscriptYSize
Definition: winddi.h:1083
POINTL ptlAspect
Definition: winddi.h:1099
WCHAR wcLastChar
Definition: winddi.h:1095
FWORD fwdMacDescender
Definition: winddi.h:1069
LONG lCharBias
Definition: winddi.h:1056
FWORD fwdUnitsPerEm
Definition: winddi.h:1064
FWORD fwdAveCharWidth
Definition: winddi.h:1074
ULONG flInfo
Definition: winddi.h:1061
FWORD fwdCapHeight
Definition: winddi.h:1076
FWORD fwdTypoDescender
Definition: winddi.h:1072
FWORD fwdUnderscorePosition
Definition: winddi.h:1087
POINTL ptlBaseline
Definition: winddi.h:1098
FWORD fwdMacAscender
Definition: winddi.h:1068
FWORD fwdSubscriptYOffset
Definition: winddi.h:1081
BYTE jWinPitchAndFamily
Definition: winddi.h:1059
FWORD fwdTypoLineGap
Definition: winddi.h:1073
FWORD fwdSuperscriptXSize
Definition: winddi.h:1082
FWORD fwdXHeight
Definition: winddi.h:1077
FWORD fwdSuperscriptYOffset
Definition: winddi.h:1085
FWORD fwdMacLineGap
Definition: winddi.h:1070
BYTE chLastChar
Definition: winddi.h:1091
PANOSE panose
Definition: winddi.h:1105
BYTE jWinCharSet
Definition: winddi.h:1058
LONG lItalicAngle
Definition: winddi.h:1055
USHORT usWinWeight
Definition: winddi.h:1060
FWORD fwdLowestPPEm
Definition: winddi.h:1065
PTRDIFF dpwszFaceName
Definition: winddi.h:1051
BYTE achVendId[4]
Definition: winddi.h:1102
RECTL rclFontBox
Definition: winddi.h:1101
WCHAR wcBreakChar
Definition: winddi.h:1097
FWORD fwdMaxCharInc
Definition: winddi.h:1075
USHORT fsType
Definition: winddi.h:1063
FWORD fwdStrikeoutSize
Definition: winddi.h:1088
LONG lEmbedId
Definition: winddi.h:1054
FWORD fwdSubscriptXOffset
Definition: winddi.h:1080
PTRDIFF dpFontSim
Definition: winddi.h:1053
ULONG cKerningPairs
Definition: winddi.h:1103
WCHAR wcFirstChar
Definition: winddi.h:1094
FWORD fwdWinAscender
Definition: winddi.h:1066
POINTL ptlCaret
Definition: winddi.h:1100
FWORD fwdSuperscriptXOffset
Definition: winddi.h:1084
WCHAR wcDefaultChar
Definition: winddi.h:1096
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
Definition: winddi.h:634
HGLYPH * phg
Definition: winddi.h:637
WCHAR wcLow
Definition: winddi.h:635
USHORT cGlyphs
Definition: winddi.h:636
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
BOOL APIENTRY BmfdUnloadFontFile(IN ULONG_PTR iFile)
Definition: font.c:298
static BOOL FillFaceInfo(PBMFD_FACE pface, PFONTINFO16 pFontInfo)
Definition: font.c:30
VOID APIENTRY BmfdDestroyFont(IN FONTOBJ *pfo)
Definition: font.c:683
VOID APIENTRY BmfdFree(PVOID pv, ULONG_PTR id)
Definition: font.c:669
static PVOID ParseFntFile(PVOID pvView, ULONG cjView)
Definition: font.c:106
PVOID APIENTRY BmfdQueryFontTree(DHPDEV dhpdev, ULONG_PTR iFile, ULONG iFace, ULONG iMode, ULONG_PTR *pid)
Definition: font.c:383
static BOOLEAN IsValidPtr(PVOID p, ULONG cjSize, PVOID pStart, PVOID pEnd, ULONG cjAlign)
Definition: font.c:12
LONG APIENTRY BmfdQueryFontFile(ULONG_PTR iFile, ULONG ulMode, ULONG cjBuf, ULONG *pulBuf)
Definition: font.c:317
LONG APIENTRY BmfdQueryFontCaps(ULONG culCaps, ULONG *pulCaps)
Definition: font.c:361
ULONG_PTR APIENTRY BmfdLoadFontFile(ULONG cFiles, ULONG_PTR *piFile, PVOID *ppvView, ULONG *pcjView, DESIGNVECTOR *pdv, ULONG ulLangID, ULONG ulFastCheckSum)
Definition: font.c:236
PIFIMETRICS APIENTRY BmfdQueryFont(IN DHPDEV dhpdev, IN ULONG_PTR iFile, IN ULONG iFace, IN ULONG_PTR *pid)
Definition: font.c:510
static PVOID ParseFonFile(PVOID pvView, ULONG cjView)
Definition: font.c:117
#define NE_RSCTYPE_FONT
Definition: winbase16.h:310
#define FD_ERROR
Definition: winddi.h:153
#define FM_INFO_4BPP
Definition: winddi.h:1014
struct _WCRUN WCRUN
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR _In_ ULONG ulLangID
Definition: winddi.h:3724
_In_ DWORD cjBuf
Definition: winddi.h:3827
#define QFT_GLYPHSET
Definition: winddi.h:3895
#define FM_SEL_ITALIC
Definition: winddi.h:694
struct _FD_GLYPHSET FD_GLYPHSET
_In_ ULONG_PTR _In_ ULONG iFace
Definition: winddi.h:3836
#define FM_INFO_8BPP
Definition: winddi.h:1015
#define FM_INFO_CONSTANT_WIDTH
Definition: winddi.h:1020
ENGAPI VOID APIENTRY EngMultiByteToUnicodeN(_Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) LPWSTR UnicodeString, _In_ ULONG MaxBytesInUnicodeString, _Out_opt_ PULONG BytesInUnicodeString, _In_reads_bytes_(BytesInMultiByteString) PCHAR MultiByteString, _In_ ULONG BytesInMultiByteString)
#define FM_INFO_1BPP
Definition: winddi.h:1013
#define QFF_DESCRIPTION
Definition: winddi.h:3879
_In_ ULONG iMode
Definition: winddi.h:3520
HGLYPH * PHGLYPH
Definition: winddi.h:131
_In_opt_ FONTOBJ * pfo
Definition: winddi.h:3603
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
#define HFF_INVALID
Definition: winddi.h:156
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL _In_ ULONG ulMode
Definition: winddi.h:3657
ENGAPI VOID APIENTRY EngUnmapFontFileFD(_In_ ULONG_PTR iFile)
Definition: mapping.c:564
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR * pdv
Definition: winddi.h:3723
#define FM_INFO_24BPP
Definition: winddi.h:1017
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR _In_ ULONG _In_ ULONG ulFastCheckSum
Definition: winddi.h:3725
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define FM_SEL_BOLD
Definition: winddi.h:699
#define FM_SEL_STRIKEOUT
Definition: winddi.h:698
_In_ ULONG cjSize
Definition: winddi.h:3634
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
#define FM_PANOSE_CULTURE_LATIN
Definition: winddi.h:1044
#define QFF_NUMFACES
Definition: winddi.h:3880
#define FM_SEL_UNDERSCORE
Definition: winddi.h:695
_In_ ULONG_PTR * piFile
Definition: winddi.h:3720
#define QC_1BIT
Definition: winddi.h:3843
#define FIXED_PITCH
Definition: wingdi.h:444
#define FW_REGULAR
Definition: wingdi.h:374
#define FW_LIGHT
Definition: wingdi.h:372
#define FW_SEMIBOLD
Definition: wingdi.h:376
#define DEFAULT_CHARSET
Definition: wingdi.h:384
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char CHAR
Definition: xmlstorage.h:175