Skip to content

Commit 74731ec

Browse files
committed
[WIN32K]
- Calculate font name hash in GreHfontCreate - Partly implement LFONT_ppfe, which finds a matching PFE for an LFONT - Implement PFE_ulPenalty, that calculates a penalty value from a PFE based on a LOGFONT - Implement HASHBUCKET_ppfeFindBestMatch, that finds the best matching PFE from within a HASHBUCKET - Implement PFT_ppfeFindBestMatch, that finds the best matching PFE from a PFT - Rename PFT_pffFindFont to PFT_pffFindFontByFile - Use bitfields instead of BOOLs in RFONT structure - Add a name hash value to the LFONT structure - Add a FONTSUBSTITUTE structure that will be used for font substitutions svn path=/branches/GSoC_2011/GdiFontDriver/; revision=56006
1 parent aabd3ef commit 74731ec

File tree

3 files changed

+410
-20
lines changed

3 files changed

+410
-20
lines changed

win32ss/gdi/font/font.h

Lines changed: 77 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
#pragma once
22

3+
// FIXME: duplicated from ntoskrnl, should got to NDK or something
4+
#define InterlockedIncrementUL(Addend) \
5+
(ULONG)InterlockedIncrement((PLONG)(Addend))
6+
7+
#define InterlockedDecrementUL(Addend) \
8+
(ULONG)InterlockedDecrement((PLONG)(Addend))
9+
310
#define LFONT_GetObject FontGetObject
411

512
#define ENGAPI
613

14+
#define PENALTY_Max 127979
715
#define PENALTY_CharSet 65000
816
#define PENALTY_OutputPrecision 19000
917
#define PENALTY_FixedPitch 15000
@@ -38,6 +46,14 @@
3846

3947
extern PEPROCESS gpepCSRSS;
4048

49+
typedef struct _FONTSUBSTITUTE
50+
{
51+
WCHAR awcSubstName[LF_FACESIZE];
52+
WCHAR awcCapSubstName[LF_FACESIZE];
53+
ULONG iHashValue;
54+
} FONTSUBSTITUTE, *PFONTSUBSTITUTE;
55+
56+
4157
typedef struct _POINTEF
4258
{
4359
FLOATOBJ x;
@@ -46,11 +62,24 @@ typedef struct _POINTEF
4662

4763
typedef struct _RFONT *PRFONT;
4864

65+
typedef enum _FLPFE
66+
{
67+
PFE_DEVICEFONT = 0x0001,
68+
PFE_DEADSTATE = 0x0002,
69+
PFE_REMOTEFONT = 0x0004,
70+
PFE_EUDC = 0x0008,
71+
PFE_SBCS_SYSTEM = 0x0010,
72+
PFE_UFIMATCH = 0x0020,
73+
PFE_MEMORYFONT = 0x0040,
74+
PFE_DBCS_FONT = 0x0080,
75+
PFE_VERT_FACE = 0x0100,
76+
} FLPFE;
77+
4978
typedef struct _PFE
5079
{
5180
struct _PFF * pPFF;
5281
ULONG_PTR iFont;
53-
FLONG flPFE;
82+
FLPFE flPFE;
5483
FD_GLYPHSET *pfdg;
5584
ULONG_PTR idfdg;
5685
IFIMETRICS * pifi;
@@ -72,6 +101,12 @@ typedef struct _PFE
72101
ULONG aiFamilyName[1];
73102
} PFE, *PPFE;
74103

104+
typedef struct _PFEOBJ
105+
{
106+
BASEOBJECT baseobj;
107+
PPFE ppfe;
108+
} PFEOBJ, *PPFEOBJ;
109+
75110
typedef struct _PFF
76111
{
77112
ULONG sizeofThis;
@@ -215,11 +250,14 @@ typedef struct _RFONT
215250
ULONG iGraphicsMode;
216251
ULONG ulOrientation;
217252
ULONG cBitsPerPel;
218-
BOOL bVertical;
219-
BOOL bDeviceFont;
220-
BOOL bIsSystemFont;
221-
BOOL bNeededPaths;
222-
BOOL bFilledEudcArray;
253+
struct
254+
{
255+
ULONG bVertical:1;
256+
ULONG bDeviceFont:1;
257+
ULONG bIsSystemFont:1;
258+
ULONG bNeededPaths:1;
259+
ULONG bFilledEudcArray:1;
260+
};
223261

224262

225263
FD_XFORM fdx;
@@ -278,6 +316,7 @@ typedef struct _LFONT
278316
FLONG fl;
279317
PPDEVOBJ ppdev;
280318
HGDIOBJ hPFE;
319+
ULONG iNameHash;
281320
WCHAR awchFace[LF_FACESIZE];
282321
ENUMLOGFONTEXDVW elfexw;
283322
} LFONT, *PLFONT;
@@ -332,12 +371,8 @@ typedef struct _ESTROBJ
332371
ULONG acFaceNameGlyphs[8];
333372
} ESTROBJ, *PESTROBJ;
334373

335-
VOID
336-
NTAPI
337-
UpcaseString(
338-
OUT PWSTR pwszDest,
339-
IN PWSTR pwszSource,
340-
IN ULONG cwc);
374+
extern PRFONT gprfntSystemTT;
375+
extern PFT gpftPublic;
341376

342377
FORCEINLINE
343378
PLFONT
@@ -353,11 +388,36 @@ LFONT_ShareUnlockFont(PLFONT plfnt)
353388
GDIOBJ_vDereferenceObject(&plfnt->baseobj);
354389
}
355390

391+
PPFE
392+
NTAPI
393+
LFONT_ppfe(PLFONT plfnt);
394+
395+
VOID
396+
NTAPI
397+
UpcaseString(
398+
OUT PWSTR pwszDest,
399+
IN PWSTR pwszSource,
400+
IN ULONG cwc);
401+
402+
ULONG
403+
NTAPI
404+
CalculateNameHash(
405+
PWSTR pwszName);
406+
356407
BOOL
357408
NTAPI
358409
PFT_bInit(
359410
PFT *ppft);
360411

412+
PPFE
413+
NTAPI
414+
PFT_ppfeFindBestMatch(
415+
_In_ PPFT ppft,
416+
_In_ PWSTR pwszCapName,
417+
_In_ ULONG iHashValue,
418+
_In_ LOGFONTW *plf,
419+
_Inout_ PULONG pulPenalty);
420+
361421
VOID
362422
NTAPI
363423
ESTROBJ_vInit(
@@ -423,3 +483,8 @@ GreGetTextExtentW(
423483
INT cwc,
424484
LPSIZE psize,
425485
UINT flOpts);
486+
487+
PRFONT
488+
NTAPI
489+
RFONT_AllocRFONT(void);
490+

0 commit comments

Comments
 (0)