cd8b5b22f07fdbb101cb02da4443e45f9e471e84
[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 FullName[LF_FULLFACESIZE];
68 WCHAR Style[LF_FACESIZE];
69 WCHAR FaceName[LF_FACESIZE];
70 DWORD dwOffsetEndArray;
71 // Fixed:
72 ENUMLOGFONTEXDVW logfont;
73 EX_PUSH_LOCK lock;
74 } TEXTOBJ, *PTEXTOBJ, LFONT, *PLFONT;
75
76 /* Internal interface */
77
78 #define LFONT_AllocFontWithHandle() ((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))
79 #define LFONT_ShareLockFont(hfont) (PLFONT)GDIOBJ_ReferenceObjectByHandle(hfont, GDIObjType_LFONT_TYPE)
80 #define LFONT_ShareUnlockFont(plfnt) GDIOBJ_vDereferenceObject((POBJ)plfnt)
81 #define LFONT_UnlockFont(plfnt) GDIOBJ_vUnlockObject((POBJ)plfnt)
82
83 FORCEINLINE
84 PTEXTOBJ
85 TEXTOBJ_LockText(HFONT hfont)
86 {
87 PLFONT plfnt = LFONT_ShareLockFont(hfont);
88 if (plfnt != 0)
89 {
90 KeEnterCriticalRegion();
91 ExAcquirePushLockExclusive(&plfnt->lock);
92 }
93 return plfnt;
94 }
95
96 FORCEINLINE
97 VOID
98 TEXTOBJ_UnlockText(PLFONT plfnt)
99 {
100 ExReleasePushLockExclusive(&plfnt->lock);
101 KeLeaveCriticalRegion();
102 LFONT_ShareUnlockFont(plfnt);
103 }
104
105
106 PTEXTOBJ FASTCALL RealizeFontInit(HFONT);
107 NTSTATUS FASTCALL TextIntRealizeFont(HFONT,PTEXTOBJ);
108 NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
109 BYTE FASTCALL IntCharSetFromCodePage(UINT uCodePage);
110 BOOL FASTCALL InitFontSupport(VOID);
111 BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
112 BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
113 VOID FASTCALL IntEnableFontRendering(BOOL Enable);
114 ULONG FASTCALL FontGetObject(PTEXTOBJ TextObj, ULONG Count, PVOID Buffer);
115 VOID FASTCALL IntLoadSystemFonts(VOID);
116 VOID FASTCALL IntGdiCleanupPrivateFontsForProcess(VOID);
117 INT FASTCALL IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics);
118 HANDLE FASTCALL IntGdiAddFontMemResource(PVOID Buffer, DWORD dwSize, PDWORD pNumAdded);
119 BOOL FASTCALL IntGdiRemoveFontMemResource(HANDLE hMMFont);
120 ULONG FASTCALL ftGdiGetGlyphOutline(PDC,WCHAR,UINT,LPGLYPHMETRICS,ULONG,PVOID,LPMAT2,BOOL);
121 INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI,UINT,OUTLINETEXTMETRICW *);
122 BOOL FASTCALL TextIntUpdateSize(PDC,PTEXTOBJ,PFONTGDI,BOOL);
123 BOOL FASTCALL ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS);
124 BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,INT,ULONG,LPINT,LPINT,LPSIZE,FLONG);
125 BOOL FASTCALL ftGdiGetTextMetricsW(HDC,PTMW_INTERNAL);
126 DWORD FASTCALL IntGetFontLanguageInfo(PDC);
127 INT FASTCALL ftGdiGetTextCharsetInfo(PDC,PFONTSIGNATURE,DWORD);
128 DWORD FASTCALL ftGetFontUnicodeRanges(PFONTGDI, PGLYPHSET);
129 DWORD FASTCALL ftGdiGetFontData(PFONTGDI,DWORD,DWORD,PVOID,DWORD);
130 BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING,PVOID,DWORD*,DWORD);
131 BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI,PREALIZATION_INFO);
132 DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI,DWORD,LPKERNINGPAIR);
133 BOOL NTAPI GreExtTextOutW(IN HDC,IN INT,IN INT,IN UINT,IN OPTIONAL RECTL*,
134 IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
135 DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD);
136 BOOL FASTCALL GreGetTextExtentW(HDC,LPCWSTR,INT,LPSIZE,UINT);
137 BOOL FASTCALL GreGetTextExtentExW(HDC,LPCWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG);
138 BOOL FASTCALL GreTextOutW(HDC,int,int,LPCWSTR,int);
139 HFONT FASTCALL GreCreateFontIndirectW( LOGFONTW * );
140 BOOL WINAPI GreGetTextMetricsW( _In_ HDC hdc, _Out_ LPTEXTMETRICW lptm);
141
142 #define IntLockProcessPrivateFonts(W32Process) \
143 ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
144
145 #define IntUnLockProcessPrivateFonts(W32Process) \
146 ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)