[WIN32SS][FONT] Fix GetTextFace function and related (#829)
[reactos.git] / win32ss / gdi / ntgdi / text.h
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
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
96 TEXTOBJ_UnlockText(PLFONT plfnt)
97 {
98 ExReleasePushLockExclusive(&plfnt->lock);
99 KeLeaveCriticalRegion();
100 LFONT_ShareUnlockFont(plfnt);
101 }
102
103
104 PTEXTOBJ FASTCALL RealizeFontInit(HFONT);
105 NTSTATUS FASTCALL TextIntRealizeFont(HFONT,PTEXTOBJ);
106 NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
107 BYTE FASTCALL IntCharSetFromCodePage(UINT uCodePage);
108 BOOL FASTCALL InitFontSupport(VOID);
109 BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
110 BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
111 VOID FASTCALL IntEnableFontRendering(BOOL Enable);
112 ULONG FASTCALL FontGetObject(PTEXTOBJ TextObj, ULONG Count, PVOID Buffer);
113 VOID FASTCALL IntLoadSystemFonts(VOID);
114 VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID);
115 INT FASTCALL IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics);
116 HANDLE FASTCALL IntGdiAddFontMemResource(PVOID Buffer, DWORD dwSize, PDWORD pNumAdded);
117 BOOL FASTCALL IntGdiRemoveFontMemResource(HANDLE hMMFont);
118 ULONG FASTCALL ftGdiGetGlyphOutline(PDC,WCHAR,UINT,LPGLYPHMETRICS,ULONG,PVOID,LPMAT2,BOOL);
119 INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI,UINT,OUTLINETEXTMETRICW *);
120 BOOL FASTCALL TextIntUpdateSize(PDC,PTEXTOBJ,PFONTGDI,BOOL);
121 BOOL FASTCALL ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS);
122 BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,INT,ULONG,LPINT,LPINT,LPSIZE,FLONG);
123 BOOL FASTCALL ftGdiGetTextMetricsW(HDC,PTMW_INTERNAL);
124 DWORD FASTCALL IntGetFontLanguageInfo(PDC);
125 INT FASTCALL ftGdiGetTextCharsetInfo(PDC,PFONTSIGNATURE,DWORD);
126 DWORD FASTCALL ftGetFontUnicodeRanges(PFONTGDI, PGLYPHSET);
127 DWORD FASTCALL ftGdiGetFontData(PFONTGDI,DWORD,DWORD,PVOID,DWORD);
128 BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING,PVOID,DWORD*,DWORD);
129 BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI,PREALIZATION_INFO);
130 DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI,DWORD,LPKERNINGPAIR);
131 BOOL NTAPI GreExtTextOutW(IN HDC,IN INT,IN INT,IN UINT,IN OPTIONAL RECTL*,
132 IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
133 DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD);
134 BOOL FASTCALL GreGetTextExtentW(HDC,LPCWSTR,INT,LPSIZE,UINT);
135 BOOL FASTCALL GreGetTextExtentExW(HDC,LPCWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG);
136 BOOL FASTCALL GreTextOutW(HDC,int,int,LPCWSTR,int);
137 HFONT FASTCALL GreCreateFontIndirectW( LOGFONTW * );
138 BOOL WINAPI GreGetTextMetricsW( _In_ HDC hdc, _Out_ LPTEXTMETRICW lptm);
139
140 #define IntLockProcessPrivateFonts(W32Process) \
141 ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
142
143 #define IntUnLockProcessPrivateFonts(W32Process) \
144 ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)