ReactOS 0.4.16-dev-125-g798ea90
font.c
Go to the documentation of this file.
1/*
2 * Unit test suite for fonts
3 *
4 * Copyright (C) 2007 Google (Evan Stade)
5 * Copyright (C) 2012 Dmitry Timoshkov
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <math.h>
23
24#include "objbase.h"
25#include "gdiplus.h"
26#include "wine/test.h"
27
28#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
29#define expect_(expected, got, precision) ok(abs((expected) - (got)) <= (precision), "Expected %d, got %d\n", (expected), (got))
30#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
31#define expectf(expected, got) expectf_((expected), (got), 0.001)
32
33static const WCHAR nonexistent[] = {'T','h','i','s','F','o','n','t','s','h','o','u','l','d','N','o','t','E','x','i','s','t','\0'};
34static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
35static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
36static const WCHAR Tahoma[] = {'T','a','h','o','m','a',0};
37
38static void set_rect_empty(RectF *rc)
39{
40 rc->X = 0.0;
41 rc->Y = 0.0;
42 rc->Width = 0.0;
43 rc->Height = 0.0;
44}
45
46static void create_testfontfile(const WCHAR *filename, int resource, WCHAR pathW[MAX_PATH])
47{
48 DWORD written;
50 HRSRC res;
51 void *ptr;
52
53 GetTempPathW(MAX_PATH, pathW);
54 lstrcatW(pathW, filename);
55
57 ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW), GetLastError());
58
60 ok(res != 0, "couldn't find resource\n");
63 ok(written == SizeofResource(GetModuleHandleA(NULL), res), "couldn't write resource\n");
65}
66
67#define DELETE_FONTFILE(filename) _delete_testfontfile(filename, __LINE__)
68static void _delete_testfontfile(const WCHAR *filename, int line)
69{
71 ok_(__FILE__,line)(ret, "failed to delete file %s, error %d\n", wine_dbgstr_w(filename), GetLastError());
72}
73
74static void test_long_name(void)
75{
77 static const WCHAR path_longname[] = {'w','i','n','e','_','l','o','n','g','n','a','m','e','.','t','t','f',0};
79 GpFontCollection *fonts;
80 INT num_families;
81 GpFontFamily *family;
83 GpFont *font;
84
86 ok(stat == Ok, "GdipNewPrivateFontCollection failed: %d\n", stat);
87
88 create_testfontfile(path_longname, 1, path);
89
91 ok(stat == Ok, "GdipPrivateAddFontFile failed: %d\n", stat);
92
93 stat = GdipGetFontCollectionFamilyCount(fonts, &num_families);
94 ok(stat == Ok, "GdipGetFontCollectionFamilyCount failed: %d\n", stat);
95
96 ok(num_families == 1, "expected num_families to be 1, got %d\n", num_families);
97
98 stat = GdipGetFontCollectionFamilyList(fonts, num_families, &family, &num_families);
99 ok(stat == Ok, "GdipGetFontCollectionFamilyList failed: %d\n", stat);
100
102 ok(stat == Ok, "GdipGetFamilyName failed: %d\n", stat);
103
105 ok(stat == Ok, "GdipCreateFont failed: %d\n", stat);
106
107 /* Cleanup */
108
110 ok(stat == Ok, "GdipDeleteFont failed: %d\n", stat);
111
113 ok(stat == Ok, "GdipDeletePrivateFontCollection failed: %d\n", stat);
114
116}
117
118static void test_createfont(void)
119{
120 GpFontFamily* fontfamily = NULL, *fontfamily2;
121 GpFont* font = NULL;
123 Unit unit;
124 UINT i;
125 REAL size;
126 WCHAR familyname[LF_FACESIZE];
127
133 expect (Ok, stat);
134 stat = GdipCreateFont(fontfamily, 12, FontStyleRegular, UnitPoint, &font);
135 expect (Ok, stat);
137 expect (Ok, stat);
139
140 stat = GdipGetFamily(font, &fontfamily2);
141 expect(Ok, stat);
142 stat = GdipGetFamilyName(fontfamily2, familyname, 0);
143 expect(Ok, stat);
144 ok (lstrcmpiW(Tahoma, familyname) == 0, "Expected Tahoma, got %s\n",
145 wine_dbgstr_w(familyname));
146 stat = GdipDeleteFontFamily(fontfamily2);
147 expect(Ok, stat);
148
149 /* Test to see if returned size is based on unit (it's not) */
151 ok (size == 12, "Expected 12, got %f\n", size);
153
154 /* Make sure everything is converted correctly for all Units */
155 for (i = UnitWorld; i <=UnitMillimeter; i++)
156 {
157 if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */
158 stat = GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font);
159 expect(Ok, stat);
161 ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i);
163 ok (stat == Ok, "Failed to get font unit, %d.\n", stat);
164 expect (i, unit);
166 }
167
168 GdipDeleteFontFamily(fontfamily);
169}
170
171static void test_logfont(void)
172{
173 LOGFONTA lfa, lfa2;
174 GpFont *font;
175 GpFontFamily *family;
177 GpGraphics *graphics;
178 HDC hdc = GetDC(0);
179 INT style;
180 REAL rval;
181 UINT16 em_height, line_spacing;
182 Unit unit;
183
184 stat = GdipCreateFromHDC(hdc, &graphics);
185 expect(Ok, stat);
186
187 memset(&lfa, 0, sizeof(LOGFONTA));
188 memset(&lfa2, 0xff, sizeof(LOGFONTA));
189 lstrcpyA(lfa.lfFaceName, "Tahoma");
190
192 expect(Ok, stat);
193 stat = GdipGetLogFontA(font, graphics, &lfa2);
194 expect(Ok, stat);
195
196 ok(lfa2.lfHeight < 0, "Expected negative height\n");
197 expect(0, lfa2.lfWidth);
198 expect(0, lfa2.lfEscapement);
199 expect(0, lfa2.lfOrientation);
200 ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
201 expect(0, lfa2.lfItalic);
202 expect(0, lfa2.lfUnderline);
203 expect(0, lfa2.lfStrikeOut);
205 "Expected %x or %x, got %x\n", GetTextCharset(hdc), ANSI_CHARSET, lfa2.lfCharSet);
206 expect(0, lfa2.lfOutPrecision);
207 expect(0, lfa2.lfClipPrecision);
208 expect(0, lfa2.lfQuality);
209 expect(0, lfa2.lfPitchAndFamily);
210
212
213 memset(&lfa, 0, sizeof(LOGFONTA));
214 lfa.lfHeight = 25;
215 lfa.lfWidth = 25;
216 lfa.lfEscapement = lfa.lfOrientation = 50;
217 lfa.lfItalic = lfa.lfUnderline = lfa.lfStrikeOut = TRUE;
218
219 memset(&lfa2, 0xff, sizeof(LOGFONTA));
220 lstrcpyA(lfa.lfFaceName, "Tahoma");
221
223 expect(Ok, stat);
224 stat = GdipGetLogFontA(font, graphics, &lfa2);
225 expect(Ok, stat);
226
227 ok(lfa2.lfHeight < 0, "Expected negative height\n");
228 expect(0, lfa2.lfWidth);
229 expect(0, lfa2.lfEscapement);
230 expect(0, lfa2.lfOrientation);
231 ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
232 expect(TRUE, lfa2.lfItalic);
233 expect(TRUE, lfa2.lfUnderline);
234 expect(TRUE, lfa2.lfStrikeOut);
236 "Expected %x or %x, got %x\n", GetTextCharset(hdc), ANSI_CHARSET, lfa2.lfCharSet);
237 expect(0, lfa2.lfOutPrecision);
238 expect(0, lfa2.lfClipPrecision);
239 expect(0, lfa2.lfQuality);
240 expect(0, lfa2.lfPitchAndFamily);
241
243 expect(Ok, stat);
245 "Expected , got %d\n", style);
246
248 expect(Ok, stat);
250
251 stat = GdipGetFontHeight(font, graphics, &rval);
252 expect(Ok, stat);
253 expectf(25.347656, rval);
255 expect(Ok, stat);
256 expectf(21.0, rval);
257
258 stat = GdipGetFamily(font, &family);
259 expect(Ok, stat);
260 stat = GdipGetEmHeight(family, FontStyleRegular, &em_height);
261 expect(Ok, stat);
262 expect(2048, em_height);
263 stat = GdipGetLineSpacing(family, FontStyleRegular, &line_spacing);
264 expect(Ok, stat);
265 expect(2472, line_spacing);
266 GdipDeleteFontFamily(family);
267
269
270 memset(&lfa, 0, sizeof(lfa));
271 lfa.lfHeight = -25;
272 lstrcpyA(lfa.lfFaceName, "Tahoma");
274 expect(Ok, stat);
275 memset(&lfa2, 0xff, sizeof(lfa2));
276 stat = GdipGetLogFontA(font, graphics, &lfa2);
277 expect(Ok, stat);
278 expect(lfa.lfHeight, lfa2.lfHeight);
279
281 expect(Ok, stat);
283
284 stat = GdipGetFontHeight(font, graphics, &rval);
285 expect(Ok, stat);
286 expectf(30.175781, rval);
288 expect(Ok, stat);
289 expectf(25.0, rval);
290
291 stat = GdipGetFamily(font, &family);
292 expect(Ok, stat);
293 stat = GdipGetEmHeight(family, FontStyleRegular, &em_height);
294 expect(Ok, stat);
295 expect(2048, em_height);
296 stat = GdipGetLineSpacing(family, FontStyleRegular, &line_spacing);
297 expect(Ok, stat);
298 expect(2472, line_spacing);
299 GdipDeleteFontFamily(family);
300
302
303 GdipDeleteGraphics(graphics);
304 ReleaseDC(0, hdc);
305}
306
307static void test_fontfamily (void)
308{
309 GpFontFamily *family, *clonedFontFamily;
310 WCHAR itsName[LF_FACESIZE];
312
313 /* FontFamily cannot be NULL */
316
317 /* FontFamily must be able to actually find the family.
318 * If it can't, any subsequent calls should fail.
319 */
322
323 /* Bitmap fonts are not found */
326 if(stat == Ok) GdipDeleteFontFamily(family);
327
329 expect (Ok, stat);
330
331 stat = GdipGetFamilyName (family, itsName, LANG_NEUTRAL);
332 expect (Ok, stat);
333 expect (0, lstrcmpiW(itsName, Tahoma));
334
335 if (0)
336 {
337 /* Crashes on Windows XP SP2, Vista, and so Wine as well */
339 expect (Ok, stat);
340 }
341
342 /* Make sure we don't read old data */
343 ZeroMemory (itsName, sizeof(itsName));
344 stat = GdipCloneFontFamily(family, &clonedFontFamily);
345 expect (Ok, stat);
346 GdipDeleteFontFamily(family);
347 stat = GdipGetFamilyName(clonedFontFamily, itsName, LANG_NEUTRAL);
348 expect(Ok, stat);
349 expect(0, lstrcmpiW(itsName, Tahoma));
350
351 GdipDeleteFontFamily(clonedFontFamily);
352}
353
355{
358 UINT16 result = 0;
359
361 expect(Ok, stat);
362
364 expect(Ok, stat);
365 ok (result == 2472, "Expected 2472, got %d\n", result);
366 result = 0;
368 expect(Ok, stat);
369 ok(result == 2048, "Expected 2048, got %d\n", result);
370 result = 0;
372 expect(Ok, stat);
373 ok(result == 2049, "Expected 2049, got %d\n", result);
374 result = 0;
376 expect(Ok, stat);
377 ok(result == 423, "Expected 423, got %d\n", result);
379
382 skip("Times New Roman not installed\n");
383 else
384 {
385 result = 0;
387 expect(Ok, stat);
388 ok(result == 2355, "Expected 2355, got %d\n", result);
389 result = 0;
391 expect(Ok, stat);
392 ok(result == 2048, "Expected 2048, got %d\n", result);
393 result = 0;
395 expect(Ok, stat);
396 ok(result == 1825, "Expected 1825, got %d\n", result);
397 result = 0;
399 expect(Ok, stat);
400 ok(result == 443, "Expected 443 got %d\n", result);
402 }
403}
404
405static void check_family(const char* context, GpFontFamily *family, WCHAR *name)
406{
408 GpFont* font;
409
410 *name = 0;
412 ok(stat == Ok, "could not get the %s family name: %.8x\n", context, stat);
413
415 ok(stat == Ok, "could not create a font for the %s family: %.8x\n", context, stat);
416 if (stat == Ok)
417 {
419 ok(stat == Ok, "could not delete the %s family font: %.8x\n", context, stat);
420 }
421
422 stat = GdipDeleteFontFamily(family);
423 ok(stat == Ok, "could not delete the %s family: %.8x\n", context, stat);
424}
425
426static void test_getgenerics (void)
427{
429 GpFontFamily *family;
430 WCHAR sansname[LF_FACESIZE], serifname[LF_FACESIZE], mononame[LF_FACESIZE];
431 int missingfonts = 0;
432
434 expect (Ok, stat);
436 missingfonts = 1;
437 else
438 check_family("Sans Serif", family, sansname);
439
441 expect (Ok, stat);
443 missingfonts = 1;
444 else
445 check_family("Serif", family, serifname);
446
448 expect (Ok, stat);
450 missingfonts = 1;
451 else
452 check_family("Monospace", family, mononame);
453
454 if (missingfonts && strcmp(winetest_platform, "wine") == 0)
455 trace("You may need to install either the Microsoft Web Fonts or the Liberation Fonts\n");
456
457 /* Check that the family names are all different */
458 ok(lstrcmpiW(sansname, serifname) != 0, "Sans Serif and Serif families should be different: %s\n", wine_dbgstr_w(sansname));
459 ok(lstrcmpiW(sansname, mononame) != 0, "Sans Serif and Monospace families should be different: %s\n", wine_dbgstr_w(sansname));
460 ok(lstrcmpiW(serifname, mononame) != 0, "Serif and Monospace families should be different: %s\n", wine_dbgstr_w(serifname));
461}
462
463static void test_installedfonts (void)
464{
467
470
472 expect (Ok, stat);
473 ok (collection != NULL, "got NULL font collection\n");
474}
475
476static void test_heightgivendpi(void)
477{
479 GpFont* font = NULL;
480 GpFontFamily* fontfamily = NULL;
481 REAL height;
482 Unit unit;
483
485 expect(Ok, stat);
486
487 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPixel, &font);
488 expect(Ok, stat);
489
492
495
497 expect(Ok, stat);
498 expectf(36.210938, height);
500
501 height = 12345;
502 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitWorld, &font);
503 expect(Ok, stat);
504
506 expect(Ok, stat);
508
510 expect(Ok, stat);
511 expectf(36.210938, height);
513
514 height = 12345;
515 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPoint, &font);
516 expect(Ok, stat);
518 expect(Ok, stat);
519 expectf(48.281250, height);
521
522 height = 12345;
523 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitInch, &font);
524 expect(Ok, stat);
525
527 expect(Ok, stat);
529
531 expect(Ok, stat);
532 expectf(3476.250000, height);
534
535 height = 12345;
537 expect(Ok, stat);
538
540 expect(Ok, stat);
542
544 expect(Ok, stat);
545 expectf(11.587500, height);
547
548 height = 12345;
550 expect(Ok, stat);
551
553 expect(Ok, stat);
555
557 expect(Ok, stat);
558 expectf(136.860245, height);
560
561 GdipDeleteFontFamily(fontfamily);
562}
563
564static int CALLBACK font_enum_proc(const LOGFONTW *lfe, const TEXTMETRICW *ntme,
566{
568
569 if (type != TRUETYPE_FONTTYPE) return 1;
570
571 *ntm = *(NEWTEXTMETRICW *)ntme;
572 return 0;
573}
574
575struct font_metrics
576{
580};
581
582static void gdi_get_font_metrics(LOGFONTW *lf, struct font_metrics *fm)
583{
584 HDC hdc;
585 HFONT hfont;
586 NEWTEXTMETRICW ntm;
588 int ret;
589
591
592 /* it's the only way to get extended NEWTEXTMETRIC fields */
594 ok(!ret, "EnumFontFamiliesExW failed to find %s\n", wine_dbgstr_w(lf->lfFaceName));
595
598
599 otm.otmSize = sizeof(otm);
601 ok(ret, "GetOutlineTextMetrics failed\n");
602
603 DeleteDC(hdc);
605
607 fm->line_spacing = ntm.ntmCellHeight;
609 fm->font_height = (REAL)fm->line_spacing * fm->font_size / (REAL)ntm.ntmSizeEM;
610 fm->em_height = ntm.ntmSizeEM;
611 fm->ascent = ntm.ntmSizeEM;
612 fm->descent = ntm.ntmCellHeight - ntm.ntmSizeEM;
613}
614
616{
617 INT style;
618 GpFontFamily *family;
620
622 expect(Ok, stat);
623
626
629
631 expect(Ok, stat);
633 expect(Ok, stat);
634
635 fm->lfHeight = (INT)(fm->font_size * -1.0);
636
637 stat = GdipGetFamily(font, &family);
638 expect(Ok, stat);
639
640 stat = GdipGetEmHeight(family, style, &fm->em_height);
641 expect(Ok, stat);
642 stat = GdipGetLineSpacing(family, style, &fm->line_spacing);
643 expect(Ok, stat);
644 stat = GdipGetCellAscent(family, style, &fm->ascent);
645 expect(Ok, stat);
646 stat = GdipGetCellDescent(family, style, &fm->descent);
647 expect(Ok, stat);
648
649 GdipDeleteFontFamily(family);
650}
651
652static void cmp_font_metrics(struct font_metrics *fm1, struct font_metrics *fm2, int line)
653{
654 ok_(__FILE__, line)(fm1->lfHeight == fm2->lfHeight, "lfHeight %d != %d\n", fm1->lfHeight, fm2->lfHeight);
655 ok_(__FILE__, line)(fm1->em_height == fm2->em_height, "em_height %u != %u\n", fm1->em_height, fm2->em_height);
656 ok_(__FILE__, line)(fm1->line_spacing == fm2->line_spacing, "line_spacing %u != %u\n", fm1->line_spacing, fm2->line_spacing);
657 ok_(__FILE__, line)(abs(fm1->ascent - fm2->ascent) <= 1, "ascent %u != %u\n", fm1->ascent, fm2->ascent);
658 ok_(__FILE__, line)(abs(fm1->descent - fm2->descent) <= 1, "descent %u != %u\n", fm1->descent, fm2->descent);
659 ok(fm1->font_height > 0.0, "fm1->font_height should be positive, got %f\n", fm1->font_height);
660 ok(fm2->font_height > 0.0, "fm2->font_height should be positive, got %f\n", fm2->font_height);
661 ok_(__FILE__, line)(fm1->font_height == fm2->font_height, "font_height %f != %f\n", fm1->font_height, fm2->font_height);
662 ok(fm1->font_size > 0.0, "fm1->font_size should be positive, got %f\n", fm1->font_size);
663 ok(fm2->font_size > 0.0, "fm2->font_size should be positive, got %f\n", fm2->font_size);
664 ok_(__FILE__, line)(fm1->font_size == fm2->font_size, "font_size %f != %f\n", fm1->font_size, fm2->font_size);
665}
666
667static void test_font_metrics(void)
668{
669 LOGFONTW lf;
670 GpFont *font;
671 GpFontFamily *family;
672 GpGraphics *graphics;
674 Unit unit;
675 struct font_metrics fm_gdi, fm_gdip;
676 HDC hdc;
677
679 stat = GdipCreateFromHDC(hdc, &graphics);
680 expect(Ok, stat);
681
682 memset(&lf, 0, sizeof(lf));
683
684 /* Tahoma,-13 */
686 lf.lfHeight = -13;
688 expect(Ok, stat);
689
691 expect(Ok, stat);
693
694 gdip_get_font_metrics(font, &fm_gdip);
695 trace("gdiplus:\n");
696 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
698 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
699 fm_gdip.font_height, fm_gdip.font_size);
700
701 gdi_get_font_metrics(&lf, &fm_gdi);
702 trace("gdi:\n");
703 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
705 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
706 fm_gdi.font_height, fm_gdi.font_size);
707
708 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
709
710 stat = GdipGetLogFontW(font, graphics, &lf);
711 expect(Ok, stat);
712 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
713 gdi_get_font_metrics(&lf, &fm_gdi);
714 trace("gdi:\n");
715 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
717 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
718 fm_gdi.font_height, fm_gdi.font_size);
719 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
720
721 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
722
724
725 /* Tahoma,13 */
727 lf.lfHeight = 13;
729 expect(Ok, stat);
730
732 expect(Ok, stat);
734
735 gdip_get_font_metrics(font, &fm_gdip);
736 trace("gdiplus:\n");
737 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
739 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
740 fm_gdip.font_height, fm_gdip.font_size);
741
742 gdi_get_font_metrics(&lf, &fm_gdi);
743 trace("gdi:\n");
744 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
746 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
747 fm_gdi.font_height, fm_gdi.font_size);
748
749 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
750
751 stat = GdipGetLogFontW(font, graphics, &lf);
752 expect(Ok, stat);
753 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
754 gdi_get_font_metrics(&lf, &fm_gdi);
755 trace("gdi:\n");
756 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
758 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
759 fm_gdi.font_height, fm_gdi.font_size);
760 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
761
762 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
763
765
767 expect(Ok, stat);
768
769 /* Tahoma,13 */
771 expect(Ok, stat);
772
773 gdip_get_font_metrics(font, &fm_gdip);
774 trace("gdiplus:\n");
775 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
777 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
778 fm_gdip.font_height, fm_gdip.font_size);
779
780 stat = GdipGetLogFontW(font, graphics, &lf);
781 expect(Ok, stat);
782 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
783 gdi_get_font_metrics(&lf, &fm_gdi);
784 trace("gdi:\n");
785 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
787 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
788 fm_gdi.font_height, fm_gdi.font_size);
789 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
790
791 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
792
793 stat = GdipGetLogFontW(font, NULL, &lf);
795
797
800
801 GdipDeleteFontFamily(family);
802
803 GdipDeleteGraphics(graphics);
804 DeleteDC(hdc);
805}
806
807static void test_font_substitution(void)
808{
809 WCHAR ms_shell_dlg[LF_FACESIZE];
810 char fallback_font[LF_FACESIZE];
811 HDC hdc;
812 HFONT hfont;
813 LOGFONTA lf;
815 GpGraphics *graphics;
816 GpFont *font;
817 GpFontFamily *family;
818 int ret;
819
821 status = GdipCreateFromHDC(hdc, &graphics);
822 expect(Ok, status);
823
825 ok(hfont != 0, "GetStockObject(DEFAULT_GUI_FONT) failed\n");
826
827 memset(&lf, 0xfe, sizeof(lf));
828 ret = GetObjectA(hfont, sizeof(lf), &lf);
829 ok(ret == sizeof(lf), "GetObject failed\n");
830 ok(!lstrcmpA(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
831 MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, -1, ms_shell_dlg, LF_FACESIZE);
832
834 expect(Ok, status);
835 memset(&lf, 0xfe, sizeof(lf));
836 status = GdipGetLogFontA(font, graphics, &lf);
837 expect(Ok, status);
838 ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
839 !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
841
842 status = GdipCreateFontFamilyFromName(ms_shell_dlg, NULL, &family);
843 expect(Ok, status);
845 expect(Ok, status);
846 memset(&lf, 0xfe, sizeof(lf));
847 status = GdipGetLogFontA(font, graphics, &lf);
848 expect(Ok, status);
849 ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
850 !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
852 GdipDeleteFontFamily(family);
853
855 ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
856
857 /* nonexistent fonts fallback to Arial, or something else if it's missing */
858 strcpy(lf.lfFaceName,"Arial");
860 expect(Ok, status);
861 status = GdipGetLogFontA(font, graphics, &lf);
862 expect(Ok, status);
863 strcpy(fallback_font,lf.lfFaceName);
864 trace("fallback font %s\n", fallback_font);
866
867 lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
869 expect(Ok, status);
870 memset(&lf, 0xfe, sizeof(lf));
871 status = GdipGetLogFontA(font, graphics, &lf);
872 expect(Ok, status);
873 ok(!lstrcmpA(lf.lfFaceName, fallback_font), "wrong face name %s / %s\n", lf.lfFaceName, fallback_font);
875
876 /* empty FaceName */
877 lf.lfFaceName[0] = 0;
879 expect(Ok, status);
880 memset(&lf, 0xfe, sizeof(lf));
881 status = GdipGetLogFontA(font, graphics, &lf);
882 expect(Ok, status);
883 ok(!lstrcmpA(lf.lfFaceName, fallback_font), "wrong face name %s / %s\n", lf.lfFaceName, fallback_font);
885
886 /* zeroing out lfWeight and lfCharSet leads to font creation failure */
887 lf.lfWeight = 0;
888 lf.lfCharSet = 0;
889 lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
890 font = NULL;
893 ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
894 "expected NotTrueTypeFont, got %d\n", status);
895 /* FIXME: remove when wine is fixed */
897
898 /* empty FaceName */
899 lf.lfFaceName[0] = 0;
900 font = NULL;
903 ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
904 "expected NotTrueTypeFont, got %d\n", status);
905 /* FIXME: remove when wine is fixed */
907
908 GdipDeleteGraphics(graphics);
909 DeleteDC(hdc);
910}
911
912static void test_font_transform(void)
913{
914 static const WCHAR string[] = { 'A',0 };
916 HDC hdc;
917 LOGFONTA lf;
918 GpFont *font;
919 GpGraphics *graphics;
921 GpStringFormat *format, *typographic;
922 PointF pos[1] = { { 0,0 } };
923 REAL height, margin_y;
924 RectF bounds, rect;
925
927 status = GdipCreateFromHDC(hdc, &graphics);
928 expect(Ok, status);
929
930 status = GdipSetPageUnit(graphics, UnitPixel);
931 expect(Ok, status);
932
934 expect(Ok, status);
936 expect(Ok, status);
937
938 memset(&lf, 0, sizeof(lf));
939 lstrcpyA(lf.lfFaceName, "Tahoma");
940 lf.lfHeight = -100;
941 lf.lfWidth = 100;
943 expect(Ok, status);
944
945 margin_y = 100.0 / 8.0;
946
947 /* identity matrix */
949 expect(Ok, status);
951 expect(Ok, status);
952 status = GdipGetLogFontA(font, graphics, &lf);
953 expect(Ok, status);
954 expect(-100, lf.lfHeight);
955 expect(0, lf.lfWidth);
956 expect(0, lf.lfEscapement);
957 expect(0, lf.lfOrientation);
958 status = GdipGetFontHeight(font, graphics, &height);
959 expect(Ok, status);
960 expectf(120.703125, height);
962 set_rect_empty(&bounds);
963 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
964 expect(Ok, status);
965 expectf(0.0, bounds.X);
966 expectf(0.0, bounds.Y);
968 expectf(height + margin_y, bounds.Height);
970 set_rect_empty(&bounds);
971 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
972 expect(Ok, status);
973 expectf(0.0, bounds.X);
974 expectf(0.0, bounds.Y);
975 expectf_(height, bounds.Height, 1.0);
976 set_rect_empty(&bounds);
977 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
979 expect(Ok, status);
980 expectf(0.0, bounds.X);
981 expectf_(-100.0, bounds.Y, 0.05);
982 expectf_(height, bounds.Height, 0.5);
983 set_rect_empty(&bounds);
984 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
986 expect(Ok, status);
987 expectf(0.0, bounds.X);
988 expectf_(-100.0, bounds.Y, 0.05);
989 expectf_(height, bounds.Height, 0.5);
990
991 /* scale matrix */
993 expect(Ok, status);
995 expect(Ok, status);
996 status = GdipGetLogFontA(font, graphics, &lf);
997 expect(Ok, status);
998 expect(-300, lf.lfHeight);
999 expect(0, lf.lfWidth);
1000 expect(0, lf.lfEscapement);
1001 expect(0, lf.lfOrientation);
1002 status = GdipGetFontHeight(font, graphics, &height);
1003 expect(Ok, status);
1004 expectf(120.703125, height);
1006 set_rect_empty(&bounds);
1007 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1008 expect(Ok, status);
1009 expectf(0.0, bounds.X);
1010 expectf(0.0, bounds.Y);
1012 expectf(height + margin_y, bounds.Height);
1014 set_rect_empty(&bounds);
1015 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1016 expect(Ok, status);
1017 expectf(0.0, bounds.X);
1018 expectf(0.0, bounds.Y);
1019 expectf_(height, bounds.Height, 0.05);
1020 set_rect_empty(&bounds);
1021 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1023 expect(Ok, status);
1024 expectf(0.0, bounds.X);
1025 expectf_(-100.0, bounds.Y, 0.05);
1026 expectf_(height, bounds.Height, 0.2);
1027 set_rect_empty(&bounds);
1028 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1030 expect(Ok, status);
1031 expectf(0.0, bounds.X);
1033 expectf_(-300.0, bounds.Y, 0.15);
1035 expectf(height * 3.0, bounds.Height);
1036
1037 /* scale + ratate matrix */
1039 expect(Ok, status);
1040 status = GdipSetWorldTransform(graphics, matrix);
1041 expect(Ok, status);
1042 status = GdipGetLogFontA(font, graphics, &lf);
1043 expect(Ok, status);
1044 expect(-300, lf.lfHeight);
1045 expect(0, lf.lfWidth);
1046 expect_(3151, lf.lfEscapement, 1);
1047 expect_(3151, lf.lfOrientation, 1);
1048 status = GdipGetFontHeight(font, graphics, &height);
1049 expect(Ok, status);
1050 expectf(120.703125, height);
1052 set_rect_empty(&bounds);
1053 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1054 expect(Ok, status);
1055 expectf(0.0, bounds.X);
1056 expectf(0.0, bounds.Y);
1058 expectf(height + margin_y, bounds.Height);
1060 set_rect_empty(&bounds);
1061 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1062 expect(Ok, status);
1063 expectf(0.0, bounds.X);
1064 expectf(0.0, bounds.Y);
1065 expectf_(height, bounds.Height, 0.05);
1066 set_rect_empty(&bounds);
1067 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1069 expect(Ok, status);
1070 expectf(0.0, bounds.X);
1071 expectf_(-100.0, bounds.Y, 0.05);
1072 expectf_(height, bounds.Height, 0.2);
1073 set_rect_empty(&bounds);
1074 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1076 expect(Ok, status);
1078 expectf_(-43.814377, bounds.X, 0.05);
1080 expectf_(-212.235611, bounds.Y, 0.05);
1082 expectf_(340.847534, bounds.Height, 0.05);
1083
1084 /* scale + ratate + shear matrix */
1086 expect(Ok, status);
1087 status = GdipSetWorldTransform(graphics, matrix);
1088 expect(Ok, status);
1089 status = GdipGetLogFontA(font, graphics, &lf);
1090 expect(Ok, status);
1092 expect(1032, lf.lfHeight);
1093 expect(0, lf.lfWidth);
1094 expect_(3099, lf.lfEscapement, 1);
1095 expect_(3099, lf.lfOrientation, 1);
1096 status = GdipGetFontHeight(font, graphics, &height);
1097 expect(Ok, status);
1098 expectf(120.703125, height);
1100 set_rect_empty(&bounds);
1101 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1102 expect(Ok, status);
1103 expectf(0.0, bounds.X);
1104 expectf(0.0, bounds.Y);
1106 expectf(height + margin_y, bounds.Height);
1108 set_rect_empty(&bounds);
1109 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1110 expect(Ok, status);
1111 expectf(0.0, bounds.X);
1112 expectf(0.0, bounds.Y);
1113 expectf_(height, bounds.Height, 0.2);
1114 set_rect_empty(&bounds);
1115 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1117 expect(Ok, status);
1118 expectf(0.0, bounds.X);
1119 expectf_(-100.0, bounds.Y, 0.2);
1120 expectf_(height, bounds.Height, 0.2);
1121 set_rect_empty(&bounds);
1122 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1124 expect(Ok, status);
1126 expectf_(-636.706848, bounds.X, 0.05);
1128 expectf_(-175.257523, bounds.Y, 0.05);
1130 expectf_(1532.984985, bounds.Height, 0.05);
1131
1132 /* scale + ratate + shear + translate matrix */
1134 expect(Ok, status);
1135 status = GdipSetWorldTransform(graphics, matrix);
1136 expect(Ok, status);
1137 status = GdipGetLogFontA(font, graphics, &lf);
1138 expect(Ok, status);
1140 expect(1032, lf.lfHeight);
1141 expect(0, lf.lfWidth);
1142 expect_(3099, lf.lfEscapement, 1);
1143 expect_(3099, lf.lfOrientation, 1);
1144 status = GdipGetFontHeight(font, graphics, &height);
1145 expect(Ok, status);
1146 expectf(120.703125, height);
1148 set_rect_empty(&bounds);
1149 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1150 expect(Ok, status);
1151 expectf(0.0, bounds.X);
1152 expectf(0.0, bounds.Y);
1154 expectf(height + margin_y, bounds.Height);
1156 set_rect_empty(&bounds);
1157 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1158 expect(Ok, status);
1159 expectf(0.0, bounds.X);
1160 expectf(0.0, bounds.Y);
1161 expectf_(height, bounds.Height, 0.1);
1162 set_rect_empty(&bounds);
1163 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1165 expect(Ok, status);
1166 expectf(0.0, bounds.X);
1167 expectf_(-100.0, bounds.Y, 0.2);
1168 expectf_(height, bounds.Height, 0.2);
1169 set_rect_empty(&bounds);
1170 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1172 expect(Ok, status);
1174 expectf_(-626.706848, bounds.X, 0.05);
1176 expectf_(-155.257523, bounds.Y, 0.05);
1178 expectf_(1532.984985, bounds.Height, 0.05);
1179
1182 GdipDeleteGraphics(graphics);
1183 GdipDeleteStringFormat(typographic);
1185 DeleteDC(hdc);
1186}
1187
1189{
1190 GpFontFamily *family, *family2;
1192 INT found, count;
1194
1196 ok(status == Ok, "Failed to get system collection, status %d.\n", status);
1197
1198 count = 0;
1200 ok(status == Ok, "Failed to get family count, status %d.\n", status);
1201 ok(count > 0, "Unexpected empty collection.\n");
1202
1204 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1205
1206 found = 123;
1208 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1209 ok(found == 123, "Unexpected list count %d.\n", found);
1210
1212 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1213
1214 found = 123;
1216 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1217 ok(found == 123, "Unexpected list count %d.\n", found);
1218
1219 found = 123;
1221 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1222 ok(found == 123, "Unexpected list count %d.\n", found);
1223
1224 family = NULL;
1225 found = 0;
1226 status = GdipGetFontCollectionFamilyList(collection, 1, &family, &found);
1227 ok(status == Ok, "Failed to get family list, status %d.\n", status);
1228 ok(found == 1, "Unexpected list count %d.\n", found);
1229 ok(family != NULL, "Expected family instance.\n");
1230
1231 family = NULL;
1232 found = 0;
1233 status = GdipGetFontCollectionFamilyList(collection, 1, &family2, &found);
1234 ok(status == Ok, "Failed to get family list, status %d.\n", status);
1235 ok(found == 1, "Unexpected list count %d.\n", found);
1236 ok(family2 != family, "Unexpected family instance.\n");
1237
1238 GdipDeleteFontFamily(family);
1239 GdipDeleteFontFamily(family2);
1240}
1241
1243{
1246 INT count;
1247
1249 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1250
1251 count = 123;
1253 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1254 ok(count == 123, "Unexpected family count %d.\n", count);
1255
1257 ok(status == Ok, "Failed to get system collection, status %d.\n", status);
1258
1260 ok(status == InvalidParameter, "Unexpected status %d.\n", status);
1261}
1262
1264{
1265 struct GdiplusStartupInput gdiplusStartupInput;
1266 ULONG_PTR gdiplusToken;
1267 HMODULE hmsvcrt;
1268 int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask);
1269
1270 /* Enable all FP exceptions except _EM_INEXACT, which gdi32 can trigger */
1271 hmsvcrt = LoadLibraryA("msvcrt");
1272 _controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s");
1273 if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e);
1274
1275 gdiplusStartupInput.GdiplusVersion = 1;
1276 gdiplusStartupInput.DebugEventCallback = NULL;
1277 gdiplusStartupInput.SuppressBackgroundThread = 0;
1278 gdiplusStartupInput.SuppressExternalCodecs = 0;
1279
1280 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1281
1287 test_logfont();
1295
1296 GdiplusShutdown(gdiplusToken);
1297}
static HFONT hfont
unsigned short UINT16
@ lparam
Definition: SystemMenu.c:31
int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
Definition: _controlfp_s.c:19
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define stat
Definition: acwin.h:99
Arabic default style
Definition: afstyles.h:94
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
float rval
Definition: cylfrac.c:48
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
float REAL
Definition: types.h:41
#define CDECL
Definition: compat.h:29
#define CloseHandle
Definition: compat.h:739
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
GpStatus WINGDIPAPI GdipGetFontSize(GpFont *font, REAL *size)
Definition: font.c:350
GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height)
Definition: font.c:552
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
Definition: font.c:869
GpStatus WINGDIPAPI GdipGetFamily(GpFont *font, GpFontFamily **family)
Definition: font.c:319
GpStatus WINGDIPAPI GdipDeleteFont(GpFont *font)
Definition: font.c:270
GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font)
Definition: font.c:203
GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC hdc, GDIPCONST LOGFONTA *lfa, GpFont **font)
Definition: font.c:249
GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics, LOGFONTA *lfa)
Definition: font.c:432
GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **FontFamily)
Definition: font.c:746
GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
Definition: font.c:1041
GpStatus WINGDIPAPI GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellDescent)
Definition: font.c:891
GpStatus WINGDIPAPI GdipNewInstalledFontCollection(GpFontCollection **fontCollection)
Definition: font.c:1679
GpStatus WINGDIPAPI GdipGetFontStyle(GpFont *font, INT *style)
Definition: font.c:393
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyCount(GpFontCollection *fontCollection, INT *numFound)
Definition: font.c:1559
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
Definition: font.c:455
GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
Definition: font.c:1074
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font)
Definition: font.c:144
GpStatus WINGDIPAPI GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellAscent)
Definition: font.c:880
GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)
Definition: font.c:599
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList(GpFontCollection *fontCollection, INT numSought, GpFontFamily *gpfamilies[], INT *numFound)
Definition: font.c:1574
GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
Definition: font.c:417
GpStatus WINGDIPAPI GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 *LineSpacing)
Definition: font.c:945
GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontCollection)
Definition: font.c:1118
GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily)
Definition: font.c:1010
GpStatus WINGDIPAPI GdipGetFamilyName(GDIPCONST GpFontFamily *family, WCHAR *name, LANGID language)
Definition: font.c:837
GpStatus WINGDIPAPI GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 *EmHeight)
Definition: font.c:918
GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection *collection, GDIPCONST WCHAR *name)
Definition: font.c:1137
GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection **fontCollection)
Definition: font.c:1096
GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily *FontFamily, GpFontFamily **clonedFontFamily)
Definition: font.c:803
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, RectF *bounds, INT *codepointsfitted, INT *linesfilled)
Definition: graphics.c:5550
GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix)
Definition: graphics.c:6362
GpStatus WINGDIPAPI GdipMeasureDriverString(GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix, RectF *boundingBox)
Definition: graphics.c:7063
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6206
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:289
GpStatus WINGDIPAPI GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, GpMatrixOrder order)
Definition: matrix.c:335
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:418
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:258
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:140
GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang, GpStringFormat **format)
Definition: stringformat.c:76
GpStatus WINGDIPAPI GdipStringFormatGetGenericTypographic(GpStringFormat **format)
Definition: stringformat.c:408
GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
Definition: stringformat.c:105
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4194
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
FxCollectionEntry * cur
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:81
@ FontStyleUnderline
Definition: gdiplusenums.h:307
@ FontStyleStrikeout
Definition: gdiplusenums.h:308
@ FontStyleRegular
Definition: gdiplusenums.h:303
@ FontStyleItalic
Definition: gdiplusenums.h:305
@ MatrixOrderAppend
Definition: gdiplusenums.h:189
Unit
Definition: gdiplusenums.h:26
@ UnitDocument
Definition: gdiplusenums.h:32
@ UnitInch
Definition: gdiplusenums.h:31
@ UnitMillimeter
Definition: gdiplusenums.h:33
@ UnitDisplay
Definition: gdiplusenums.h:28
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPoint
Definition: gdiplusenums.h:30
@ UnitPixel
Definition: gdiplusenums.h:29
@ DriverStringOptionsCmapLookup
Definition: gdiplusenums.h:47
void WINAPI GdiplusShutdown(ULONG_PTR)
Status
Definition: gdiplustypes.h:25
@ Ok
Definition: gdiplustypes.h:26
@ FileNotFound
Definition: gdiplustypes.h:36
@ InvalidParameter
Definition: gdiplustypes.h:28
@ NotTrueTypeFont
Definition: gdiplustypes.h:42
@ FontFamilyNotFound
Definition: gdiplustypes.h:40
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLenum GLint GLuint mask
Definition: glext.h:6028
GLuint GLenum matrix
Definition: glext.h:9407
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const char * filename
Definition: ioapi.h:137
#define wine_dbgstr_w
Definition: kernel32.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define CREATE_ALWAYS
Definition: disk.h:72
static PVOID ptr
Definition: dispmode.c:27
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static void test_logfont(void)
Definition: font.c:246
#define expect(expected, got)
Definition: font.c:40
static INT CALLBACK font_enum_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: font.c:273
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static void cmp_font_metrics(struct font_metrics *fm1, struct font_metrics *fm2, int line)
Definition: font.c:652
static void gdip_get_font_metrics(GpFont *font, struct font_metrics *fm)
Definition: font.c:615
#define expectf_(expected, got, precision)
Definition: font.c:30
static void test_font_substitution(void)
Definition: font.c:807
static void test_font_metrics(void)
Definition: font.c:667
static void _delete_testfontfile(const WCHAR *filename, int line)
Definition: font.c:68
static void gdi_get_font_metrics(LOGFONTW *lf, struct font_metrics *fm)
Definition: font.c:582
static void test_fontfamily(void)
Definition: font.c:307
#define DELETE_FONTFILE(filename)
Definition: font.c:67
static void test_long_name(void)
Definition: font.c:74
static void test_GdipGetFontCollectionFamilyList(void)
Definition: font.c:1188
static void test_GdipGetFontCollectionFamilyCount(void)
Definition: font.c:1242
static const WCHAR nonexistent[]
Definition: font.c:33
static void set_rect_empty(RectF *rc)
Definition: font.c:38
static const WCHAR Tahoma[]
Definition: font.c:36
static void test_font_transform(void)
Definition: font.c:912
static void test_fontfamily_properties(void)
Definition: font.c:354
static void create_testfontfile(const WCHAR *filename, int resource, WCHAR pathW[MAX_PATH])
Definition: font.c:46
#define expect_(expected, got, precision)
Definition: font.c:29
#define expectf(expected, got)
Definition: font.c:31
static void test_createfont(void)
Definition: font.c:118
static void test_getgenerics(void)
Definition: font.c:426
static void check_family(const char *context, GpFontFamily *family, WCHAR *name)
Definition: font.c:405
static const WCHAR MSSansSerif[]
Definition: font.c:34
static const WCHAR TimesNewRoman[]
Definition: font.c:35
static void test_heightgivendpi(void)
Definition: font.c:476
static void test_installedfonts(void)
Definition: font.c:463
#define todo_wine
Definition: custom.c:89
static ICollection collection
Definition: typelib.c:184
Definition: mk_font.cpp:20
unsigned int UINT
Definition: ndis.h:50
#define GENERIC_WRITE
Definition: nt_native.h:90
#define RT_RCDATA
Definition: pedump.c:372
png_const_structrp png_const_inforp int * unit
Definition: png.h:2159
#define INT
Definition: polytest.cpp:20
#define LANG_NEUTRAL
Definition: nls.h:22
const char * winetest_platform
#define memset(x, y, z)
Definition: compat.h:39
& rect
Definition: startmenu.cpp:1413
BOOL SuppressBackgroundThread
Definition: gdiplusinit.h:36
DebugEventProc DebugEventCallback
Definition: gdiplusinit.h:35
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
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG lfWidth
Definition: dimm.idl:43
LONG lfHeight
Definition: dimm.idl:59
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
REAL Height
Definition: gdiplustypes.h:664
REAL X
Definition: gdiplustypes.h:661
REAL Width
Definition: gdiplustypes.h:663
REAL Y
Definition: gdiplustypes.h:662
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2514
Definition: http.c:7252
Definition: fci.c:127
UINT16 em_height
Definition: font.c:650
UINT16 ascent
Definition: font.c:650
UINT16 line_spacing
Definition: font.c:650
INT lfHeight
Definition: font.c:579
REAL font_size
Definition: font.c:578
UINT16 descent
Definition: font.c:650
REAL font_height
Definition: font.c:578
Definition: format.c:58
Definition: parser.c:49
Definition: name.c:39
Definition: stat.h:55
Definition: ps.c:97
UINT ntmCellHeight
Definition: wingdi.h:2666
LONG tmAscent
Definition: wingdi.h:2384
T1_FIELD_DICT_FONTDICT family_name
Definition: t1tokens.h:30
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
int ret
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
LONG_PTR LPARAM
Definition: windef.h:208
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1109
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI GetTextCharset(_In_ HDC)
Definition: text.c:187
#define ANSI_CHARSET
Definition: wingdi.h:383
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180