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