1 #pragma once
2
3 #define TAG_FINF 'FNIF'
4 //
5 // EXSTROBJ flags.
6 //
7 #define TO_MEM_ALLOCATED 0x0001
8 #define TO_ALL_PTRS_VALID 0x0002
9 #define TO_VALID 0x0004
10 #define TO_ESC_NOT_ORIENT 0x0008
11 #define TO_PWSZ_ALLOCATED 0x0010
12 #define TSIM_UNDERLINE1 0x0020
13 #define TSIM_UNDERLINE2 0x0040
14 #define TSIM_STRIKEOUT 0x0080
15 #define TO_HIGHRESTEXT 0x0100
16 #define TO_BITMAPS 0x0200
17 #define TO_PARTITION_INIT 0x0400
18 #define TO_ALLOC_FACENAME 0x0800
19 #define TO_SYS_PARTITION 0x1000
20 //
21 // Extended STROBJ
22 //
23 typedef struct _STRGDI
24 {
25 STROBJ StrObj; // Text string object header.
26 FLONG flTO;
27 INT cgposCopied;
28 INT cgposPositionsEnumerated;
29 PVOID prfo; // PRFONT -> PFONTGDI
30 PGLYPHPOS pgpos;
31 POINTFIX ptfxRef;
32 POINTFIX ptfxUpdate;
33 POINTFIX ptfxEscapement;
34 RECTFX rcfx;
35 FIX fxExtent;
36 FIX fxExtra;
37 FIX fxBreakExtra;
38 DWORD dwCodePage;
39 INT cExtraRects;
40 RECTL arclExtra[3];
41 RECTL rclBackGroundSave;
42 PWCHAR pwcPartition;
43 PLONG plPartition;
44 PLONG plNext;
45 PGLYPHPOS pgpNext;
46 PLONG plCurrentFont;
47 POINTL ptlBaseLineAdjust;
48 INT cTTSysGlyphs;
49 INT cSysGlyphs;
50 INT cDefGlyphs;
51 INT cNumFaceNameGlyphs;
52 PVOID pacFaceNameGlyphs;
53 ULONG acFaceNameGlyphs[8];
54 } STRGDI, *PSTRGDI;
55
56 #define TEXTOBJECT_INIT 0x00010000
57
58 /* GDI logical font object */
59 typedef struct _LFONT
60 {
61 /* Header for all gdi objects in the handle table.
62 Do not (re)move this. */
63 BASEOBJECT BaseObject;
64 LFTYPE lft;
65 FLONG fl;
66 FONTOBJ *Font;
67 WCHAR TextFace[LF_FACESIZE];
68 DWORD dwOffsetEndArray;
69 // Fixed:
70 ENUMLOGFONTEXDVW logfont;
71 EX_PUSH_LOCK lock;
72 } TEXTOBJ, *PTEXTOBJ, LFONT, *PLFONT;
73
74 /* Internal interface */
75
76 #define LFONT_AllocFontWithHandle() ((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))
77 #define LFONT_ShareLockFont(hfont) (PLFONT)GDIOBJ_ReferenceObjectByHandle(hfont, GDIObjType_LFONT_TYPE)
78 #define LFONT_ShareUnlockFont(plfnt) GDIOBJ_vDereferenceObject((POBJ)plfnt)
79 #define LFONT_UnlockFont(plfnt) GDIOBJ_vUnlockObject((POBJ)plfnt)
80
81 FORCEINLINE
82 PTEXTOBJ
TEXTOBJ_LockText(HFONT hfont)83 TEXTOBJ_LockText(HFONT hfont)
84 {
85 PLFONT plfnt = LFONT_ShareLockFont(hfont);
86 if (plfnt != 0)
87 {
88 KeEnterCriticalRegion();
89 ExAcquirePushLockExclusive(&plfnt->lock);
90 }
91 return plfnt;
92 }
93
94 FORCEINLINE
95 VOID
TEXTOBJ_UnlockText(PLFONT plfnt)96 TEXTOBJ_UnlockText(PLFONT plfnt)
97 {
98 ExReleasePushLockExclusive(&plfnt->lock);
99 KeLeaveCriticalRegion();
100 LFONT_ShareUnlockFont(plfnt);
101 }
102
103 /* dwFlags for IntGdiAddFontResourceEx */
104 #define AFRX_WRITE_REGISTRY 0x1
105 #define AFRX_ALTERNATIVE_PATH 0x2
106 #define AFRX_DOS_DEVICE_PATH 0x4
107
108 PTEXTOBJ FASTCALL RealizeFontInit(HFONT);
109 NTSTATUS FASTCALL TextIntRealizeFont(HFONT,PTEXTOBJ);
110 NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
111 BYTE FASTCALL IntCharSetFromCodePage(UINT uCodePage);
112 BOOL FASTCALL InitFontSupport(VOID);
113 VOID FASTCALL FreeFontSupport(VOID);
114 BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
115 BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
116 VOID FASTCALL IntEnableFontRendering(BOOL Enable);
117 ULONG FASTCALL FontGetObject(PTEXTOBJ TextObj, ULONG Count, PVOID Buffer);
118 VOID FASTCALL IntLoadSystemFonts(VOID);
119 BOOL FASTCALL IntLoadFontsInRegistry(VOID);
120 VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID);
121 INT FASTCALL IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics);
122 INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics,
123 DWORD dwFlags);
124 HANDLE FASTCALL IntGdiAddFontMemResource(PVOID Buffer, DWORD dwSize, PDWORD pNumAdded);
125 BOOL FASTCALL IntGdiRemoveFontMemResource(HANDLE hMMFont);
126 ULONG FASTCALL ftGdiGetGlyphOutline(PDC,WCHAR,UINT,LPGLYPHMETRICS,ULONG,PVOID,LPMAT2,BOOL);
127 INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI, UINT, OUTLINETEXTMETRICW*, BOOL);
128 BOOL FASTCALL TextIntUpdateSize(PDC,PTEXTOBJ,PFONTGDI,BOOL);
129 BOOL FASTCALL ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS);
130 BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,INT,ULONG,LPINT,LPINT,LPSIZE,FLONG);
131 BOOL FASTCALL ftGdiGetTextMetricsW(HDC,PTMW_INTERNAL);
132 DWORD FASTCALL IntGetFontLanguageInfo(PDC);
133 INT FASTCALL ftGdiGetTextCharsetInfo(PDC,PFONTSIGNATURE,DWORD);
134 DWORD FASTCALL ftGetFontUnicodeRanges(PFONTGDI, PGLYPHSET);
135 DWORD FASTCALL ftGdiGetFontData(PFONTGDI,DWORD,DWORD,PVOID,DWORD);
136 BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING,PVOID,DWORD*,DWORD);
137 BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI,PREALIZATION_INFO);
138 DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI,DWORD,LPKERNINGPAIR);
139 BOOL NTAPI GreExtTextOutW(IN HDC,IN INT,IN INT,IN UINT,IN OPTIONAL RECTL*,
140 IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
141 DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD);
142 BOOL FASTCALL GreGetTextExtentW(HDC,LPCWSTR,INT,LPSIZE,UINT);
143 BOOL FASTCALL GreGetTextExtentExW(HDC,LPCWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG);
144 BOOL FASTCALL GreTextOutW(HDC,int,int,LPCWSTR,int);
145 HFONT FASTCALL GreCreateFontIndirectW( LOGFONTW * );
146 BOOL WINAPI GreGetTextMetricsW( _In_ HDC hdc, _Out_ LPTEXTMETRICW lptm);
147
148 #define IntLockProcessPrivateFonts(W32Process) \
149 ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
150
151 #define IntUnLockProcessPrivateFonts(W32Process) \
152 ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)
153