ReactOS 0.4.15-dev-7842-g558ab78
CreateFontIndirect.c File Reference
#include "precomp.h"
Include dependency graph for CreateFontIndirect.c:

Go to the source code of this file.

Classes

struct  FONT_SEL_TEST
 

Macros

#define trace_if(val, msg)   do { if (!(val)) trace(msg); } while (0)
 
#define _TMPF_VAR_PITCH   TMPF_FIXED_PITCH
 
#define _TMPF_VAR_PITCH   TMPF_FIXED_PITCH
 

Typedefs

typedef enum TRISTATE TRISTATE
 
typedef struct FONT_SEL_TEST FONT_SEL_TEST
 

Enumerations

enum  TRISTATE { TS_UNKNOWN , TS_TRUE , TS_FALSE }
 

Functions

void Test_CreateFontIndirectA (void)
 
void Test_CreateFontIndirectW (void)
 
void Test_CreateFontIndirectExA (void)
 
void Test_CreateFontIndirectExW (void)
 
static INT CALLBACK is_truetype_font_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_truetype_font_installed (HDC hDC, const char *name)
 
static INT CALLBACK is_charset_font_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_charset_font_installed (HDC hDC, BYTE CharSet)
 
static INT CALLBACK is_fixed_charset_font_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_fixed_charset_font_installed (HDC hDC, BYTE CharSet)
 
static void Test_FontPresence (void)
 
static void Test_FontSelectionEntry (HDC hDC, UINT nIndex, FONT_SEL_TEST *Entry)
 
static void Test_FontSelection (void)
 
 START_TEST (CreateFontIndirect)
 

Variables

static FONT_SEL_TEST g_Entries []
 

Macro Definition Documentation

◆ _TMPF_VAR_PITCH [1/2]

#define _TMPF_VAR_PITCH   TMPF_FIXED_PITCH

Definition at line 288 of file CreateFontIndirect.c.

◆ _TMPF_VAR_PITCH [2/2]

#define _TMPF_VAR_PITCH   TMPF_FIXED_PITCH

Definition at line 288 of file CreateFontIndirect.c.

◆ trace_if

#define trace_if (   val,
  msg 
)    do { if (!(val)) trace(msg); } while (0)

Definition at line 11 of file CreateFontIndirect.c.

Typedef Documentation

◆ FONT_SEL_TEST

◆ TRISTATE

Enumeration Type Documentation

◆ TRISTATE

Enumerator
TS_UNKNOWN 
TS_TRUE 
TS_FALSE 

Definition at line 290 of file CreateFontIndirect.c.

290 {
292 TS_TRUE,
294} TRISTATE;
@ TS_UNKNOWN
@ TS_FALSE
@ TS_TRUE

Function Documentation

◆ is_charset_font_installed()

static BOOL is_charset_font_installed ( HDC  hDC,
BYTE  CharSet 
)
static

Definition at line 200 of file CreateFontIndirect.c.

201{
202 LOGFONT lf;
203 ZeroMemory(&lf, sizeof(lf));
206 return TRUE;
207 return FALSE;
208}
static HDC hDC
Definition: 3dtext.c:33
static INT CALLBACK is_charset_font_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void CharSet(RTF_Info *info)
Definition: reader.c:2420
BYTE lfCharSet
Definition: dimm.idl:50
#define ZeroMemory
Definition: winbase.h:1712
int WINAPI EnumFontFamiliesExA(_In_ HDC, _In_ PLOGFONTA, _In_ FONTENUMPROCA, _In_ LPARAM, _In_ DWORD)
#define DEFAULT_CHARSET
Definition: wingdi.h:384

Referenced by Test_FontPresence(), and Test_FontSelection().

◆ is_charset_font_proc()

static INT CALLBACK is_charset_font_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 192 of file CreateFontIndirect.c.

194{
195 if (ntm->tmCharSet == (BYTE)lParam)
196 return 0;
197 return 1;
198}
LPARAM lParam
Definition: combotst.c:139
BYTE tmCharSet
Definition: wingdi.h:2380
unsigned char BYTE
Definition: xxhash.c:193

Referenced by is_charset_font_installed().

◆ is_fixed_charset_font_installed()

static BOOL is_fixed_charset_font_installed ( HDC  hDC,
BYTE  CharSet 
)
static

Definition at line 223 of file CreateFontIndirect.c.

224{
225 LOGFONT lf;
226 ZeroMemory(&lf, sizeof(lf));
229 return TRUE;
230 return FALSE;
231}
static INT CALLBACK is_fixed_charset_font_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)

Referenced by Test_FontPresence().

◆ is_fixed_charset_font_proc()

static INT CALLBACK is_fixed_charset_font_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 214 of file CreateFontIndirect.c.

216{
217 if (ntm->tmCharSet == (BYTE)lParam && !(ntm->tmPitchAndFamily & _TMPF_VAR_PITCH))
218 return 0;
219 return 1;
220}
#define _TMPF_VAR_PITCH
BYTE tmPitchAndFamily
Definition: wingdi.h:2379

Referenced by is_fixed_charset_font_installed().

◆ is_truetype_font_installed()

static BOOL is_truetype_font_installed ( HDC  hDC,
const char name 
)
static

Definition at line 180 of file CreateFontIndirect.c.

181{
182 LOGFONT lf;
183 ZeroMemory(&lf, sizeof(lf));
187 return TRUE;
188 return FALSE;
189}
static INT CALLBACK is_truetype_font_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
Definition: name.c:39
#define lstrcpy
Definition: winbase.h:3809

Referenced by Test_FontPresence().

◆ is_truetype_font_proc()

static INT CALLBACK is_truetype_font_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 172 of file CreateFontIndirect.c.

174{
175 if (type != TRUETYPE_FONTTYPE) return 1;
176
177 return 0;
178}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1109

Referenced by is_truetype_font_installed().

◆ START_TEST()

START_TEST ( CreateFontIndirect  )

Definition at line 765 of file CreateFontIndirect.c.

766{
773}
void Test_CreateFontIndirectExW(void)
static void Test_FontPresence(void)
void Test_CreateFontIndirectA(void)
static void Test_FontSelection(void)
void Test_CreateFontIndirectW(void)
void Test_CreateFontIndirectExA(void)

◆ Test_CreateFontIndirectA()

void Test_CreateFontIndirectA ( void  )

Definition at line 14 of file CreateFontIndirect.c.

15{
16 LOGFONTA logfont;
18 ULONG ret;
19 ENUMLOGFONTEXDVW elfedv2;
20
21 logfont.lfHeight = 12;
22 logfont.lfWidth = 0;
23 logfont.lfEscapement = 0;
24 logfont.lfOrientation = 0;
25 logfont.lfWeight = FW_NORMAL;
26 logfont.lfItalic = 0;
27 logfont.lfUnderline = 0;
28 logfont.lfStrikeOut = 0;
29 logfont.lfCharSet = DEFAULT_CHARSET;
32 logfont.lfQuality = PROOF_QUALITY;
34 memset(logfont.lfFaceName, 'A', LF_FACESIZE);
35 hFont = CreateFontIndirectA(&logfont);
36 ok(hFont != 0, "CreateFontIndirectA failed\n");
37
38 memset(&elfedv2, 0, sizeof(elfedv2));
39 ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
40 ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "ret = %ld\n", ret);
42 ok(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0, "\n");
43}
#define ok(value,...)
Definition: atltest.h:57
HFONT hFont
Definition: main.c:53
#define LF_FACESIZE
Definition: dimm.idl:39
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define memset(x, y, z)
Definition: compat.h:39
BYTE lfStrikeOut
Definition: dimm.idl:49
BYTE lfClipPrecision
Definition: dimm.idl:52
BYTE lfUnderline
Definition: dimm.idl:48
BYTE lfQuality
Definition: dimm.idl:53
BYTE lfOutPrecision
Definition: dimm.idl:51
LONG lfOrientation
Definition: dimm.idl:45
BYTE lfItalic
Definition: dimm.idl:47
BYTE lfPitchAndFamily
Definition: dimm.idl:54
LONG lfHeight
Definition: dimm.idl:42
LONG lfEscapement
Definition: dimm.idl:44
LONG lfWeight
Definition: dimm.idl:46
LONG lfWidth
Definition: dimm.idl:43
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2702
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2703
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1910
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define DEFAULT_PITCH
Definition: wingdi.h:443
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define PROOF_QUALITY
Definition: wingdi.h:438
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define FW_NORMAL
Definition: wingdi.h:373

Referenced by START_TEST().

◆ Test_CreateFontIndirectExA()

void Test_CreateFontIndirectExA ( void  )

Definition at line 79 of file CreateFontIndirect.c.

80{
81 ENUMLOGFONTEXDVA elfedva, elfedva2;
82 ENUMLOGFONTEXDVW elfedvw;
83 ENUMLOGFONTEXA *penumlfa;
84 LOGFONTA *plogfonta;
86 ULONG ret;
87
88 memset(&elfedva, 0, sizeof(elfedva));
89 penumlfa = &elfedva.elfEnumLogfontEx;
90 plogfonta = &elfedva.elfEnumLogfontEx.elfLogFont;
91
92 plogfonta->lfHeight = 12;
93 plogfonta->lfWidth = 0;
94 plogfonta->lfEscapement = 0;
95 plogfonta->lfOrientation = 0;
96 plogfonta->lfWeight = FW_NORMAL;
97 plogfonta->lfItalic = 0;
98 plogfonta->lfUnderline = 0;
99 plogfonta->lfStrikeOut = 0;
100 plogfonta->lfCharSet = DEFAULT_CHARSET;
103 plogfonta->lfQuality = PROOF_QUALITY;
104 plogfonta->lfPitchAndFamily = DEFAULT_PITCH;
105
106 memset(plogfonta->lfFaceName, 'A', LF_FACESIZE * sizeof(WCHAR));
107 memset(penumlfa->elfFullName, 'B', LF_FULLFACESIZE * sizeof(WCHAR));
108
109 hFont = CreateFontIndirectExA(&elfedva);
110 ok(hFont != 0, "CreateFontIndirectExA failed\n");
111
112 ret = GetObjectW(hFont, sizeof(elfedvw), &elfedvw);
113 ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
114 ok(elfedvw.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0, "\n");
115 ok(elfedvw.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0, "\n");
116
117 memset(&elfedva2, 0, sizeof(elfedva2));
118 ret = GetObjectA(hFont, sizeof(elfedva2), &elfedva2);
119 ok(ret == sizeof(ENUMLOGFONTEXDVA), "ret = %ld\n", ret);
120 ok(elfedva2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0, "\n");
121 ok(elfedva2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0, "\n");
122}
LOGFONTA elfLogFont
Definition: wingdi.h:2696
BYTE elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2697
ENUMLOGFONTEXA elfEnumLogfontEx
Definition: wingdi.h:2774
CHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1894
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define LF_FULLFACESIZE
Definition: wingdi.h:41
HFONT WINAPI CreateFontIndirectExA(const ENUMLOGFONTEXDVA *)
Definition: font.c:1657
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ Test_CreateFontIndirectExW()

void Test_CreateFontIndirectExW ( void  )

Definition at line 125 of file CreateFontIndirect.c.

126{
127 ENUMLOGFONTEXDVW elfedv, elfedv2;
128 ENUMLOGFONTEXDVA elfedva;
129 ENUMLOGFONTEXW *penumlfw;
130 LOGFONTW *plogfontw;
131 HFONT hFont;
132 ULONG ret;
133
134 memset(&elfedv, 0, sizeof(elfedv));
135 penumlfw = &elfedv.elfEnumLogfontEx;
136 plogfontw = &elfedv.elfEnumLogfontEx.elfLogFont;
137
138 plogfontw->lfHeight = 12;
139 plogfontw->lfWidth = 0;
140 plogfontw->lfEscapement = 0;
141 plogfontw->lfOrientation = 0;
142 plogfontw->lfWeight = FW_NORMAL;
143 plogfontw->lfItalic = 0;
144 plogfontw->lfUnderline = 0;
145 plogfontw->lfStrikeOut = 0;
146 plogfontw->lfCharSet = DEFAULT_CHARSET;
149 plogfontw->lfQuality = PROOF_QUALITY;
150 plogfontw->lfPitchAndFamily = DEFAULT_PITCH;
151
152 memset(plogfontw->lfFaceName, 'A', LF_FACESIZE * sizeof(WCHAR));
153 memset(penumlfw->elfFullName, 'B', LF_FULLFACESIZE * sizeof(WCHAR));
154
155 hFont = CreateFontIndirectExW(&elfedv);
156 ok(hFont != 0, "CreateFontIndirectExW failed\n");
157
158 memset(&elfedv2, 0, sizeof(elfedv2));
159 ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
160 ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
161 ok(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A', "\n");
162 ok(elfedv2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == ((WCHAR)'B' << 8) + 'B', "\n");
163
164 memset(&elfedva, 0, sizeof(elfedva));
165 ret = GetObjectA(hFont, sizeof(elfedva), &elfedva);
166 ok(ret == sizeof(ENUMLOGFONTEXDVA), "\n");
167 ok(elfedva.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == '?', "\n");
168 ok(elfedva.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0, "\n");
169}
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71
HFONT WINAPI CreateFontIndirectExW(const ENUMLOGFONTEXDVW *)
Definition: font.c:1681

Referenced by START_TEST().

◆ Test_CreateFontIndirectW()

void Test_CreateFontIndirectW ( void  )

Definition at line 46 of file CreateFontIndirect.c.

47{
48 LOGFONTW logfont;
50 ULONG ret;
51 ENUMLOGFONTEXDVW elfedv2;
52
53 logfont.lfHeight = 12;
54 logfont.lfWidth = 0;
55 logfont.lfEscapement = 0;
56 logfont.lfOrientation = 0;
57 logfont.lfWeight = FW_NORMAL;
58 logfont.lfItalic = 0;
59 logfont.lfUnderline = 0;
60 logfont.lfStrikeOut = 0;
61 logfont.lfCharSet = DEFAULT_CHARSET;
64 logfont.lfQuality = PROOF_QUALITY;
66 memset(logfont.lfFaceName, 'A', LF_FACESIZE * 2);
67 hFont = CreateFontIndirectW(&logfont);
68 ok(hFont != 0, "CreateFontIndirectW failed\n");
69
70 memset(&elfedv2, 0, sizeof(elfedv2));
71 ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
72 ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
73 ok(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A', "\n");
74 ok(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0, "\n");
75 /* Theres a bunch of data in elfFullName ... */
76}
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)

Referenced by START_TEST().

◆ Test_FontPresence()

static void Test_FontPresence ( void  )
static

Definition at line 234 of file CreateFontIndirect.c.

235{
236 HDC hDC;
237
239
240 ok(is_truetype_font_installed(hDC, "Arial"), "'Arial' is not found\n");
241 ok(is_truetype_font_installed(hDC, "Courier New"), "'Courier New' is not found\n");
242 ok(is_truetype_font_installed(hDC, "Marlett"), "'Marlett' is not found\n");
243 ok(is_truetype_font_installed(hDC, "MS Shell Dlg"), "'MS Shell Dlg' is not found\n");
244 ok(is_truetype_font_installed(hDC, "Tahoma"), "'Tahoma' is not found\n");
245 ok(is_truetype_font_installed(hDC, "Times New Roman"), "'Times New Roman' is not found\n");
246
247 ok(is_charset_font_installed(hDC, ANSI_CHARSET), "ANSI_CHARSET fonts are not found\n");
248 ok(is_charset_font_installed(hDC, SYMBOL_CHARSET), "SYMBOL_CHARSET fonts are not found\n");
249 trace_if(is_charset_font_installed(hDC, SHIFTJIS_CHARSET), "SHIFTJIS_CHARSET fonts are not found\n");
250 trace_if(is_charset_font_installed(hDC, HANGUL_CHARSET), "HANGUL_CHARSET fonts are not found\n");
251 trace_if(is_charset_font_installed(hDC, GB2312_CHARSET), "GB2312_CHARSET fonts are not found\n");
252 trace_if(is_charset_font_installed(hDC, CHINESEBIG5_CHARSET), "CHINESEBIG5_CHARSET fonts are not found\n");
253 ok(is_charset_font_installed(hDC, OEM_CHARSET), "OEM_CHARSET fonts are not found\n");
254 trace_if(is_charset_font_installed(hDC, JOHAB_CHARSET), "JOHAB_CHARSET fonts are not found\n");
255 trace_if(is_charset_font_installed(hDC, HEBREW_CHARSET), "HEBREW_CHARSET fonts are not found\n");
256 trace_if(is_charset_font_installed(hDC, ARABIC_CHARSET), "ARABIC_CHARSET fonts are not found\n");
257 trace_if(is_charset_font_installed(hDC, GREEK_CHARSET), "GREEK_CHARSET fonts are not found\n");
258 trace_if(is_charset_font_installed(hDC, TURKISH_CHARSET), "TURKISH_CHARSET fonts are not found\n");
259 trace_if(is_charset_font_installed(hDC, VIETNAMESE_CHARSET), "VIETNAMESE_CHARSET fonts are not found\n");
260 trace_if(is_charset_font_installed(hDC, THAI_CHARSET), "THAI_CHARSET fonts are not found\n");
261 trace_if(is_charset_font_installed(hDC, EASTEUROPE_CHARSET), "EASTEUROPE_CHARSET fonts are not found\n");
262 trace_if(is_charset_font_installed(hDC, RUSSIAN_CHARSET), "RUSSIAN_CHARSET fonts are not found\n");
263 trace_if(is_charset_font_installed(hDC, MAC_CHARSET), "MAC_CHARSET fonts are not found\n");
264 trace_if(is_charset_font_installed(hDC, BALTIC_CHARSET), "BALTIC_CHARSET fonts are not found\n");
265
266 ok(is_fixed_charset_font_installed(hDC, ANSI_CHARSET), "fixed ANSI_CHARSET fonts are not found\n");
267 trace_if(is_fixed_charset_font_installed(hDC, SHIFTJIS_CHARSET), "fixed SHIFTJIS_CHARSET fonts are not found\n");
268 trace_if(is_fixed_charset_font_installed(hDC, HANGUL_CHARSET), "fixed HANGUL_CHARSET fonts are not found\n");
269 trace_if(is_fixed_charset_font_installed(hDC, GB2312_CHARSET), "fixed GB2312_CHARSET fonts are not found\n");
270 trace_if(is_fixed_charset_font_installed(hDC, CHINESEBIG5_CHARSET), "fixed CHINESEBIG5_CHARSET fonts are not found\n");
271 ok(is_fixed_charset_font_installed(hDC, OEM_CHARSET), "fixed OEM_CHARSET fonts are not found\n");
272 trace_if(is_fixed_charset_font_installed(hDC, JOHAB_CHARSET), "fixed JOHAB_CHARSET fonts are not found\n");
273 trace_if(is_fixed_charset_font_installed(hDC, HEBREW_CHARSET), "fixed HEBREW_CHARSET fonts are not found\n");
274 trace_if(is_fixed_charset_font_installed(hDC, ARABIC_CHARSET), "fixed ARABIC_CHARSET fonts are not found\n");
275 trace_if(is_fixed_charset_font_installed(hDC, GREEK_CHARSET), "fixed GREEK_CHARSET fonts are not found\n");
276 trace_if(is_fixed_charset_font_installed(hDC, TURKISH_CHARSET), "fixed TURKISH_CHARSET fonts are not found\n");
277 trace_if(is_fixed_charset_font_installed(hDC, VIETNAMESE_CHARSET), "fixed VIETNAMESE_CHARSET fonts are not found\n");
278 trace_if(is_fixed_charset_font_installed(hDC, THAI_CHARSET), "fixed THAI_CHARSET fonts are not found\n");
279 trace_if(is_fixed_charset_font_installed(hDC, EASTEUROPE_CHARSET), "fixed EASTEUROPE_CHARSET fonts are not found\n");
280 trace_if(is_fixed_charset_font_installed(hDC, RUSSIAN_CHARSET), "fixed RUSSIAN_CHARSET fonts are not found\n");
281 trace_if(is_fixed_charset_font_installed(hDC, MAC_CHARSET), "fixed MAC_CHARSET fonts are not found\n");
282 trace_if(is_fixed_charset_font_installed(hDC, BALTIC_CHARSET), "fixed BALTIC_CHARSET fonts are not found\n");
283
284 DeleteDC(hDC);
285}
static BOOL is_charset_font_installed(HDC hDC, BYTE CharSet)
static BOOL is_fixed_charset_font_installed(HDC hDC, BYTE CharSet)
#define trace_if(val, msg)
static BOOL is_truetype_font_installed(HDC hDC, const char *name)
#define NULL
Definition: types.h:112
static HDC
Definition: imagelist.c:92
#define HANGUL_CHARSET
Definition: wingdi.h:388
#define RUSSIAN_CHARSET
Definition: wingdi.h:396
#define ARABIC_CHARSET
Definition: wingdi.h:394
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define THAI_CHARSET
Definition: wingdi.h:397
#define GREEK_CHARSET
Definition: wingdi.h:391
#define JOHAB_CHARSET
Definition: wingdi.h:401
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:390
#define ANSI_CHARSET
Definition: wingdi.h:383
#define OEM_CHARSET
Definition: wingdi.h:400
#define VIETNAMESE_CHARSET
Definition: wingdi.h:402
BOOL WINAPI DeleteDC(_In_ HDC)
#define MAC_CHARSET
Definition: wingdi.h:403
#define HEBREW_CHARSET
Definition: wingdi.h:393
#define SHIFTJIS_CHARSET
Definition: wingdi.h:386
#define SYMBOL_CHARSET
Definition: wingdi.h:385
#define EASTEUROPE_CHARSET
Definition: wingdi.h:399
#define GB2312_CHARSET
Definition: wingdi.h:389
#define BALTIC_CHARSET
Definition: wingdi.h:395
#define TURKISH_CHARSET
Definition: wingdi.h:392

Referenced by START_TEST().

◆ Test_FontSelection()

static void Test_FontSelection ( void  )
static

Definition at line 748 of file CreateFontIndirect.c.

749{
750 UINT nIndex;
751 HDC hDC;
752
754 for (nIndex = 0; nIndex < _countof(g_Entries); ++nIndex)
755 {
756 if (!is_charset_font_installed(hDC, g_Entries[nIndex].CharSetBefore))
757 skip("charset not available: 0x%x\n", g_Entries[nIndex].CharSetBefore);
758 else
759 Test_FontSelectionEntry(hDC, nIndex, g_Entries + nIndex);
760 }
761 DeleteDC(hDC);
762}
static FONT_SEL_TEST g_Entries[]
static void Test_FontSelectionEntry(HDC hDC, UINT nIndex, FONT_SEL_TEST *Entry)
#define skip(...)
Definition: atltest.h:64
unsigned int UINT
Definition: ndis.h:50
#define _countof(array)
Definition: sndvol32.h:68

Referenced by START_TEST().

◆ Test_FontSelectionEntry()

static void Test_FontSelectionEntry ( HDC  hDC,
UINT  nIndex,
FONT_SEL_TEST Entry 
)
static

Definition at line 675 of file CreateFontIndirect.c.

676{
677 LOGFONTA lf;
678 HFONT hFont;
679 HGDIOBJ hFontOld;
681
682 ZeroMemory(&lf, sizeof(lf));
683
684 if (Entry->FaceNameBefore[0])
685 lstrcpynA(lf.lfFaceName, Entry->FaceNameBefore, _countof(lf.lfFaceName));
686
687 lf.lfCharSet = Entry->CharSetBefore;
688
689 if (Entry->BoldBefore == TS_TRUE)
690 lf.lfWeight = FW_BOLD;
691 else if (Entry->BoldBefore == TS_FALSE)
692 lf.lfWeight = FW_NORMAL;
693 else
695
696 lf.lfItalic = Entry->ItalicBefore;
697 lf.lfUnderline = Entry->UnderlineBefore;
698 lf.lfStrikeOut = Entry->StruckOutBefore;
699
700 if (Entry->FixedPitchBefore == TS_TRUE)
702 else if (Entry->FixedPitchBefore == TS_FALSE)
704 else
706
708 ok(hFont != NULL, "Entry #%u: hFont failed\n", nIndex);
709
710 hFontOld = SelectObject(hDC, hFont);
711 {
712 ok(GetTextMetricsA(hDC, &tm), "Entry #%u: GetTextMetricsA failed\n", nIndex);
713
714 if (Entry->CharSetAfter != DEFAULT_CHARSET)
715 ok(tm.tmCharSet == Entry->CharSetAfter, "Entry #%u: CharSet mismatched, it was %u\n", nIndex, tm.tmCharSet);
716
717 if (Entry->BoldAfter == TS_TRUE)
718 ok(tm.tmWeight >= FW_BOLD, "Entry #%u: Weight was non-bold\n", nIndex);
719 else if (Entry->BoldAfter == TS_FALSE)
720 ok(tm.tmWeight <= FW_MEDIUM, "Entry #%u: Weight was bold\n", nIndex);
721
722 if (Entry->ItalicAfter == TS_TRUE)
723 ok(tm.tmItalic, "Entry #%u: Italic was non-italic\n", nIndex);
724 else if (Entry->ItalicAfter == TS_FALSE)
725 ok(!tm.tmItalic, "Entry #%u: Italic was italic\n", nIndex);
726
727 if (Entry->UnderlineAfter == TS_TRUE)
728 ok(tm.tmUnderlined, "Entry #%u: Underlined was FALSE\n", nIndex);
729 else if (Entry->UnderlineAfter == TS_FALSE)
730 ok(!tm.tmUnderlined, "Entry #%u: Underlined was TRUE\n", nIndex);
731
732 if (Entry->StruckOutAfter == TS_TRUE)
733 ok(tm.tmStruckOut, "Entry #%u: Struck-out was FALSE\n", nIndex);
734 else if (Entry->StruckOutAfter == TS_FALSE)
735 ok(!tm.tmStruckOut, "Entry #%u: Struck-out was TRUE\n", nIndex);
736#if 0 // FIXME: fails on WHS testbot
737 if (Entry->FixedPitchAfter == TS_TRUE)
738 ok(!(tm.tmPitchAndFamily & _TMPF_VAR_PITCH), "Entry #%u: Pitch mismatched, it was non-fixed-pitch\n", nIndex);
739 else if (Entry->FixedPitchAfter == TS_FALSE)
740 ok((tm.tmPitchAndFamily & _TMPF_VAR_PITCH), "Entry #%u: Pitch mismatched, it was fixed-pitch\n", nIndex);
741#endif
742 }
743 SelectObject(hDC, hFontOld);
745}
#define lstrcpynA
Definition: compat.h:751
pKey DeleteObject()
base of all file and directory entries
Definition: entries.h:83
Definition: time.h:68
#define FIXED_PITCH
Definition: wingdi.h:444
#define VARIABLE_PITCH
Definition: wingdi.h:445
#define FW_DONTCARE
Definition: wingdi.h:368
#define FW_BOLD
Definition: wingdi.h:378
#define FF_DONTCARE
Definition: wingdi.h:448
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
#define FW_MEDIUM
Definition: wingdi.h:375

Referenced by Test_FontSelection().

Variable Documentation

◆ g_Entries

FONT_SEL_TEST g_Entries[]
static

Definition at line 318 of file CreateFontIndirect.c.

Referenced by Test_FontSelection().