ReactOS  0.4.14-dev-293-g2b39b42
font.c File Reference
#include "bmfd.h"
Include dependency graph for font.c:

Go to the source code of this file.

Functions

static BOOLEAN IsValidPtr (PVOID p, ULONG cjSize, PVOID pStart, PVOID pEnd, ULONG cjAlign)
 
static BOOL FillFaceInfo (PBMFD_FACE pface, PFONTINFO16 pFontInfo)
 
static PVOID ParseFntFile (PVOID pvView, ULONG cjView)
 
static PVOID ParseFonFile (PVOID pvView, ULONG cjView)
 
ULONG_PTR APIENTRY BmfdLoadFontFile (ULONG cFiles, ULONG_PTR *piFile, PVOID *ppvView, ULONG *pcjView, DESIGNVECTOR *pdv, ULONG ulLangID, ULONG ulFastCheckSum)
 
BOOL APIENTRY BmfdUnloadFontFile (IN ULONG_PTR iFile)
 
LONG APIENTRY BmfdQueryFontFile (ULONG_PTR iFile, ULONG ulMode, ULONG cjBuf, ULONG *pulBuf)
 
LONG APIENTRY BmfdQueryFontCaps (ULONG culCaps, ULONG *pulCaps)
 
PVOID APIENTRY BmfdQueryFontTree (DHPDEV dhpdev, ULONG_PTR iFile, ULONG iFace, ULONG iMode, ULONG_PTR *pid)
 
PIFIMETRICS APIENTRY BmfdQueryFont (IN DHPDEV dhpdev, IN ULONG_PTR iFile, IN ULONG iFace, IN ULONG_PTR *pid)
 
VOID APIENTRY BmfdFree (PVOID pv, ULONG_PTR id)
 
VOID APIENTRY BmfdDestroyFont (IN FONTOBJ *pfo)
 

Function Documentation

◆ BmfdDestroyFont()

VOID APIENTRY BmfdDestroyFont ( IN FONTOBJ pfo)

Definition at line 683 of file font.c.

685 {
686  /* Free the font realization info */
687  EngFreeMem(pfo->pvProducer);
688  pfo->pvProducer = NULL;
689 }
#define EngFreeMem
Definition: polytest.cpp:56
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ FONTOBJ * pfo
Definition: winddi.h:3603

◆ BmfdFree()

VOID APIENTRY BmfdFree ( PVOID  pv,
ULONG_PTR  id 
)

Definition at line 669 of file font.c.

672 {
673  DbgPrint("BmfdFree()\n");
674  if (id)
675  {
676  EngFreeMem((PVOID)id);
677  }
678 }
#define DbgPrint
Definition: loader.c:25
#define EngFreeMem
Definition: polytest.cpp:56

◆ BmfdLoadFontFile()

ULONG_PTR APIENTRY BmfdLoadFontFile ( ULONG  cFiles,
ULONG_PTR piFile,
PVOID ppvView,
ULONG pcjView,
DESIGNVECTOR pdv,
ULONG  ulLangID,
ULONG  ulFastCheckSum 
)

Public Interface

Definition at line 236 of file font.c.

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 }
#define HFF_INVALID
Definition: winddi.h:156
#define DbgPrint
Definition: loader.c:25
static PVOID ParseFonFile(PVOID pvView, ULONG cjView)
Definition: font.c:117
ULONG_PTR iFile
Definition: bmfd.h:236
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
uint32_t ULONG_PTR
Definition: typedefs.h:63
PVOID pvView
Definition: bmfd.h:235
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG_PTR * piFile
Definition: winddi.h:3720
ENGAPI VOID APIENTRY EngUnmapFontFileFD(_In_ ULONG_PTR iFile)
Definition: mapping.c:564
static PVOID ParseFntFile(PVOID pvView, ULONG cjView)
Definition: font.c:106
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1

◆ BmfdQueryFont()

PIFIMETRICS APIENTRY BmfdQueryFont ( IN DHPDEV  dhpdev,
IN ULONG_PTR  iFile,
IN ULONG  iFace,
IN ULONG_PTR pid 
)

Definition at line 510 of file font.c.

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 
617  if (pface->flInfo & FM_INFO_CONSTANT_WIDTH)
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  {
659  pifi->fsSelection |= FM_SEL_STRIKEOUT;
660  wcscat(pifiX->wszStyleName, L"Strikeout ");
661  }
662 
663  return pifi;
664 }
WCHAR wcFirstChar
Definition: winddi.h:1094
#define FM_SEL_STRIKEOUT
Definition: winddi.h:698
BYTE dfDefaultChar
Definition: bmfd.h:159
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
BYTE achVendId[4]
Definition: winddi.h:1102
WCHAR wcBreakChar
Definition: winddi.h:1097
#define LF_FACESIZE
Definition: dimm.idl:39
BMFD_FACE aface[1]
Definition: bmfd.h:240
#define DbgPrint
Definition: loader.c:25
FLONG flInfo
Definition: bmfd.h:230
#define FM_SEL_UNDERSCORE
Definition: winddi.h:695
BYTE dfStrikeOut
Definition: bmfd.h:149
POINTL ptlAspect
Definition: winddi.h:1099
long bottom
Definition: polytest.cpp:53
WCHAR wcDefaultChar
Definition: winddi.h:1096
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)
PTRDIFF dpwszStyleName
Definition: winddi.h:1050
BYTE dfFirstChar
Definition: bmfd.h:157
PANOSE panose
Definition: winddi.h:1105
#define DEFAULT_CHARSET
Definition: wingdi.h:383
FWORD fwdTypoLineGap
Definition: winddi.h:1073
FWORD fwdSubscriptYOffset
Definition: winddi.h:1081
LONG lItalicAngle
Definition: winddi.h:1055
FWORD fwdSubscriptXOffset
Definition: winddi.h:1080
ULONG ulPanoseCulture
Definition: winddi.h:1104
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
FWORD fwdSuperscriptYSize
Definition: winddi.h:1083
USHORT fsType
Definition: winddi.h:1063
BYTE ajCharSet[16]
Definition: bmfd.h:257
#define FM_PANOSE_CULTURE_LATIN
Definition: winddi.h:1044
PTRDIFF dpCharSets
Definition: winddi.h:1057
#define FIXED_PITCH
Definition: wingdi.h:443
#define FW_REGULAR
Definition: wingdi.h:373
long top
Definition: polytest.cpp:53
BYTE dfCharSet
Definition: bmfd.h:151
struct BMFD_FILE * PBMFD_FILE
WORD dfAscent
Definition: bmfd.h:144
PTRDIFF dpwszFamilyName
Definition: winddi.h:1049
smooth NULL
Definition: ftsmooth.c:416
FWORD fwdSuperscriptXSize
Definition: winddi.h:1082
RECTL rclFontBox
Definition: winddi.h:1101
PTRDIFF dpFontSim
Definition: winddi.h:1053
WCHAR wcBreakChar
Definition: bmfd.h:221
WCHAR wszFamilyName[LF_FACESIZE]
Definition: bmfd.h:258
WCHAR wszFaceName[LF_FACESIZE]
Definition: bmfd.h:259
FWORD fwdSuperscriptXOffset
Definition: winddi.h:1084
long left
Definition: polytest.cpp:53
ULONG cjThis
Definition: winddi.h:1047
FWORD fwdWinAscender
Definition: winddi.h:1066
PTRDIFF dpwszUniqueName
Definition: winddi.h:1052
WCHAR wszStyleName[MAX_STYLESIZE]
Definition: bmfd.h:260
FWORD fwdAveCharWidth
Definition: winddi.h:1074
WORD dfVertRes
Definition: bmfd.h:142
#define FW_SEMIBOLD
Definition: wingdi.h:375
BYTE dfLastChar
Definition: bmfd.h:158
FWORD fwdCapHeight
Definition: winddi.h:1076
FWORD fwdUnderscoreSize
Definition: winddi.h:1086
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
BYTE dfPitchAndFamily
Definition: bmfd.h:154
BYTE jWinCharSet
Definition: winddi.h:1058
WCHAR wcDefaultChar
Definition: bmfd.h:220
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:314
PFONTINFO16 pFontInfo
Definition: bmfd.h:209
POINTL ptlBaseline
Definition: winddi.h:1098
WORD dfAvgWidth
Definition: bmfd.h:155
_In_ ULONG_PTR _In_ ULONG iFace
Definition: winddi.h:3835
WORD dfMaxWidth
Definition: bmfd.h:156
FWORD fwdMacDescender
Definition: winddi.h:1069
BYTE chLastChar
Definition: winddi.h:1091
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
WCHAR wcLastChar
Definition: bmfd.h:219
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
IFIMETRICS ifim
Definition: bmfd.h:256
BYTE chDefaultChar
Definition: winddi.h:1092
static const WCHAR L[]
Definition: oid.c:1250
#define FM_INFO_CONSTANT_WIDTH
Definition: winddi.h:1020
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
POINTL ptlCaret
Definition: winddi.h:1100
WORD dfPixHeight
Definition: bmfd.h:153
#define FM_SEL_BOLD
Definition: winddi.h:699
FWORD fwdWinDescender
Definition: winddi.h:1067
FWORD fwdMaxCharInc
Definition: winddi.h:1075
BYTE dfUnderline
Definition: bmfd.h:148
FWORD fwdMacAscender
Definition: winddi.h:1068
FWORD fwdLowestPPEm
Definition: winddi.h:1065
#define GETVAL(x)
Definition: bmfd.h:21
BYTE dfBreakChar
Definition: bmfd.h:160
BYTE jWinPitchAndFamily
Definition: winddi.h:1059
USHORT usWinWeight
Definition: winddi.h:1060
FWORD fwdSuperscriptYOffset
Definition: winddi.h:1085
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
FWORD fwdXHeight
Definition: winddi.h:1077
#define TAG_IFIMETRICS
Definition: bmfd.h:43
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ULONG cNumFaces
Definition: bmfd.h:239
FWORD fwdSubscriptYSize
Definition: winddi.h:1079
BYTE chBreakChar
Definition: winddi.h:1093
FWORD fwdMacLineGap
Definition: winddi.h:1070
LONG lEmbedId
Definition: winddi.h:1054
FWORD fwdTypoDescender
Definition: winddi.h:1072
ULONG flInfo
Definition: winddi.h:1061
FWORD fwdStrikeoutPosition
Definition: winddi.h:1089
USHORT fsSelection
Definition: winddi.h:1062
ULONG cjIfiExtra
Definition: winddi.h:1048
ULONG cKerningPairs
Definition: winddi.h:1103
WORD dfWeight
Definition: bmfd.h:150
BYTE dfItalic
Definition: bmfd.h:147
BYTE chFirstChar
Definition: winddi.h:1090
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
FWORD fwdTypoAscender
Definition: winddi.h:1071
FWORD fwdUnderscorePosition
Definition: winddi.h:1087
FWORD fwdSubscriptXSize
Definition: winddi.h:1078
#define ULONG_PTR
Definition: config.h:101
WCHAR wcLastChar
Definition: winddi.h:1095
WORD dfHorizRes
Definition: bmfd.h:143
#define FM_SEL_ITALIC
Definition: winddi.h:694
LONG lCharBias
Definition: winddi.h:1056
#define FW_LIGHT
Definition: wingdi.h:371
FWORD fwdStrikeoutSize
Definition: winddi.h:1088
PTRDIFF dpwszFaceName
Definition: winddi.h:1051
FWORD fwdUnitsPerEm
Definition: winddi.h:1064
WCHAR wcFirstChar
Definition: bmfd.h:218

◆ BmfdQueryFontCaps()

LONG APIENTRY BmfdQueryFontCaps ( ULONG  culCaps,
ULONG pulCaps 
)

Definition at line 361 of file font.c.

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 }
#define DbgPrint
Definition: loader.c:25
#define FD_ERROR
Definition: winddi.h:153
#define QC_1BIT
Definition: winddi.h:3843

◆ BmfdQueryFontFile()

LONG APIENTRY BmfdQueryFontFile ( ULONG_PTR  iFile,
ULONG  ulMode,
ULONG  cjBuf,
ULONG pulBuf 
)

Definition at line 317 of file font.c.

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 }
signed char * PCHAR
Definition: retypes.h:7
#define LF_FACESIZE
Definition: dimm.idl:39
BMFD_FACE aface[1]
Definition: bmfd.h:240
#define DbgPrint
Definition: loader.c:25
PCHAR pszFaceName
Definition: bmfd.h:213
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 FD_ERROR
Definition: winddi.h:153
#define QFF_DESCRIPTION
Definition: winddi.h:3879
struct BMFD_FILE * PBMFD_FILE
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ DWORD cjBuf
Definition: winddi.h:3827
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL _In_ ULONG ulMode
Definition: winddi.h:3649
ULONG cNumFaces
Definition: bmfd.h:239
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
unsigned int ULONG
Definition: retypes.h:1
#define QFF_NUMFACES
Definition: winddi.h:3880
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ BmfdQueryFontTree()

PVOID APIENTRY BmfdQueryFontTree ( DHPDEV  dhpdev,
ULONG_PTR  iFile,
ULONG  iFace,
ULONG  iMode,
ULONG_PTR pid 
)

Definition at line 383 of file font.c.

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 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
struct _FD_GLYPHSET FD_GLYPHSET
BMFD_FACE aface[1]
Definition: bmfd.h:240
_In_ ULONG iMode
Definition: winddi.h:3520
#define DbgPrint
Definition: loader.c:25
Definition: winddi.h:634
ULONG cRuns
Definition: winddi.h:644
char CHAR
Definition: xmlstorage.h:175
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
ULONG cGlyphs
Definition: bmfd.h:215
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)
BYTE dfFirstChar
Definition: bmfd.h:157
#define QFT_GLYPHSET
Definition: winddi.h:3895
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
WCHAR wcLow
Definition: winddi.h:635
HGLYPH * phg
Definition: winddi.h:637
struct BMFD_FILE * PBMFD_FILE
smooth NULL
Definition: ftsmooth.c:416
HGLYPH * PHGLYPH
Definition: winddi.h:131
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
USHORT cGlyphs
Definition: winddi.h:636
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define for
Definition: utility.h:88
PFONTINFO16 pFontInfo
Definition: bmfd.h:209
_In_ ULONG_PTR _In_ ULONG iFace
Definition: winddi.h:3835
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
#define TAG_GLYPHSET
Definition: bmfd.h:42
struct _WCRUN WCRUN
ULONG cNumFaces
Definition: bmfd.h:239
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
ULONG cjThis
Definition: winddi.h:641
#define ULONG_PTR
Definition: config.h:101
ULONG cGlyphsSupported
Definition: winddi.h:643
FLONG flAccel
Definition: winddi.h:642
ULONG cjEntrySize
Definition: bmfd.h:211

◆ BmfdUnloadFontFile()

BOOL APIENTRY BmfdUnloadFontFile ( IN ULONG_PTR  iFile)

Definition at line 298 of file font.c.

300 {
301  PBMFD_FILE pfile = (PBMFD_FILE)iFile;
302 
303  DbgPrint("BmfdUnloadFontFile()\n");
304 
305  /* Unmap the font file */
306  EngUnmapFontFileFD(pfile->iFile);
307 
308  /* Free the memory that was allocated for the font */
309  EngFreeMem(pfile);
310 
311  return TRUE;
312 }
#define TRUE
Definition: types.h:120
#define DbgPrint
Definition: loader.c:25
#define EngFreeMem
Definition: polytest.cpp:56
ULONG_PTR iFile
Definition: bmfd.h:236
struct BMFD_FILE * PBMFD_FILE
ENGAPI VOID APIENTRY EngUnmapFontFileFD(_In_ ULONG_PTR iFile)
Definition: mapping.c:564
_In_ ULONG_PTR iFile
Definition: winddi.h:3835

◆ FillFaceInfo()

static BOOL FillFaceInfo ( PBMFD_FACE  pface,
PFONTINFO16  pFontInfo 
)
static

Definition at line 30 of file font.c.

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 }
WORD dfBspace
Definition: bmfd.h:170
WORD dfPixWidth
Definition: bmfd.h:152
BYTE dfDefaultChar
Definition: bmfd.h:159
#define TRUE
Definition: types.h:120
ULONG ulVersion
Definition: bmfd.h:212
WORD wPixWidth
Definition: bmfd.h:223
FLONG flInfo
Definition: bmfd.h:230
WORD wB
Definition: bmfd.h:226
char CHAR
Definition: xmlstorage.h:175
ULONG cGlyphs
Definition: bmfd.h:215
WORD wWidthBytes
Definition: bmfd.h:224
#define FM_INFO_8BPP
Definition: winddi.h:1015
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)
BYTE dfFirstChar
Definition: bmfd.h:157
#define DFF_256COLOR
Definition: bmfd.h:85
#define DFF_1COLOR
Definition: bmfd.h:83
BYTE dfReserved
Definition: bmfd.h:166
#define FM_INFO_24BPP
Definition: winddi.h:1017
#define FM_INFO_4BPP
Definition: winddi.h:1014
DWORD dfFlags
Definition: bmfd.h:168
BYTE dfCharTable[1]
Definition: bmfd.h:174
WORD dfAscent
Definition: bmfd.h:144
WCHAR wcBreakChar
Definition: bmfd.h:221
WORD dfVersion
Definition: bmfd.h:137
PBYTE pCharTable
Definition: bmfd.h:210
#define FM_INFO_1BPP
Definition: winddi.h:1013
WORD dfAspace
Definition: bmfd.h:169
BYTE dfLastChar
Definition: bmfd.h:158
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FM_INFO_MASK
Definition: bmfd.h:34
WCHAR wcDefaultChar
Definition: bmfd.h:220
unsigned long DWORD
Definition: ntddk_ex.h:95
WORD dfWidthBytes
Definition: bmfd.h:161
PFONTINFO16 pFontInfo
Definition: bmfd.h:209
WORD wC
Definition: bmfd.h:227
WCHAR wcLastChar
Definition: bmfd.h:219
#define FM_INFO_CONSTANT_WIDTH
Definition: winddi.h:1020
WORD wAscent
Definition: bmfd.h:228
WORD dfCspace
Definition: bmfd.h:171
WORD dfPixHeight
Definition: bmfd.h:153
#define GETVAL(x)
Definition: bmfd.h:21
WORD wA
Definition: bmfd.h:225
BYTE dfBreakChar
Definition: bmfd.h:160
WORD wDescent
Definition: bmfd.h:229
unsigned int ULONG
Definition: retypes.h:1
#define DFF_FIXED
Definition: bmfd.h:79
#define DFF_RGBCOLOR
Definition: bmfd.h:86
#define DFF_16COLOR
Definition: bmfd.h:84
WORD wPixHeight
Definition: bmfd.h:222
ULONG cjEntrySize
Definition: bmfd.h:211
WCHAR wcFirstChar
Definition: bmfd.h:218

Referenced by ParseFonFile().

◆ IsValidPtr()

static BOOLEAN IsValidPtr ( PVOID  p,
ULONG  cjSize,
PVOID  pStart,
PVOID  pEnd,
ULONG  cjAlign 
)
static

Definition at line 12 of file font.c.

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 }
#define TRUE
Definition: types.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ ULONG cjSize
Definition: winddi.h:3634
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ParseFonFile().

◆ ParseFntFile()

static PVOID ParseFntFile ( PVOID  pvView,
ULONG  cjView 
)
static

Definition at line 106 of file font.c.

109 {
110  /* unimplemented */
111  return NULL;
112 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by BmfdLoadFontFile().

◆ ParseFonFile()

static PVOID ParseFonFile ( PVOID  pvView,
ULONG  cjView 
)
static

Definition at line 117 of file font.c.

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 }
signed char * PCHAR
Definition: retypes.h:7
WORD offset
Definition: typelib.c:84
BMFD_FACE aface[1]
Definition: bmfd.h:240
#define DbgPrint
Definition: loader.c:25
#define EngFreeMem
Definition: polytest.cpp:56
GLuint GLuint GLsizei count
Definition: gl.h:1545
NE_TYPEINFO typeinfo[1]
Definition: bmfd.h:75
NE_NAMEINFO nameinfo[1]
Definition: bmfd.h:69
static BOOLEAN IsValidPtr(PVOID p, ULONG cjSize, PVOID pStart, PVOID pEnd, ULONG cjAlign)
Definition: font.c:12
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
static BOOL FillFaceInfo(PBMFD_FACE pface, PFONTINFO16 pFontInfo)
Definition: font.c:30
smooth NULL
Definition: ftsmooth.c:416
#define PCHAR
Definition: match.c:90
#define IMAGE_DOS_MAGIC
Definition: pecoff.h:6
if(!(yy_init))
Definition: macro.lex.yy.c:714
static UINT UINT count
Definition: font.c:44
unsigned short WORD
Definition: ntddk_ex.h:93
type_id
WORD size_shift
Definition: bmfd.h:74
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
WORD length
Definition: typelib.c:85
#define GETVAL(x)
Definition: bmfd.h:21
static PVOID
Definition: font.c:57
WORD count
Definition: typelib.c:95
WORD type_id
Definition: typelib.c:94
ULONG cNumFaces
Definition: bmfd.h:239
#define NE_RSCTYPE_FONT
Definition: winbase16.h:310
#define TAG_FONTINFO
Definition: bmfd.h:44
unsigned int ULONG
Definition: retypes.h:1

Referenced by BmfdLoadFontFile().