ole32: Call CoCreateInstanceEx from CoCreateInstance instead of the other way around.
[wine.git] / dlls / gdiplus / tests / font.c
blob932b5eda4bc6bb2bf2e7dae07d4cc67ee0680ac1
1 /*
2 * Unit test suite for fonts
4 * Copyright (C) 2007 Google (Evan Stade)
5 * Copyright (C) 2012 Dmitry Timoshkov
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.
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.
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
22 #include <math.h>
24 #include "objbase.h"
25 #include "gdiplus.h"
26 #include "wine/test.h"
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)
33 static 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'};
34 static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
35 static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
36 static const WCHAR Tahoma[] = {'T','a','h','o','m','a',0};
38 static void set_rect_empty(RectF *rc)
40 rc->X = 0.0;
41 rc->Y = 0.0;
42 rc->Width = 0.0;
43 rc->Height = 0.0;
46 static void test_createfont(void)
48 GpFontFamily* fontfamily = NULL, *fontfamily2;
49 GpFont* font = NULL;
50 GpStatus stat;
51 Unit unit;
52 UINT i;
53 REAL size;
54 WCHAR familyname[LF_FACESIZE];
56 stat = GdipCreateFontFamilyFromName(nonexistent, NULL, &fontfamily);
57 expect (FontFamilyNotFound, stat);
58 stat = GdipDeleteFont(font);
59 expect (InvalidParameter, stat);
60 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &fontfamily);
61 expect (Ok, stat);
62 stat = GdipCreateFont(fontfamily, 12, FontStyleRegular, UnitPoint, &font);
63 expect (Ok, stat);
64 stat = GdipGetFontUnit (font, &unit);
65 expect (Ok, stat);
66 expect (UnitPoint, unit);
68 stat = GdipGetFamily(font, &fontfamily2);
69 expect(Ok, stat);
70 stat = GdipGetFamilyName(fontfamily2, familyname, 0);
71 expect(Ok, stat);
72 ok (lstrcmpiW(Tahoma, familyname) == 0, "Expected Tahoma, got %s\n",
73 wine_dbgstr_w(familyname));
74 stat = GdipDeleteFontFamily(fontfamily2);
75 expect(Ok, stat);
77 /* Test to see if returned size is based on unit (its not) */
78 GdipGetFontSize(font, &size);
79 ok (size == 12, "Expected 12, got %f\n", size);
80 GdipDeleteFont(font);
82 /* Make sure everything is converted correctly for all Units */
83 for (i = UnitWorld; i <=UnitMillimeter; i++)
85 if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */
86 GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font);
87 GdipGetFontSize (font, &size);
88 ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i);
89 GdipGetFontUnit (font, &unit);
90 expect (i, unit);
91 GdipDeleteFont(font);
94 GdipDeleteFontFamily(fontfamily);
97 static void test_logfont(void)
99 LOGFONTA lfa, lfa2;
100 GpFont *font;
101 GpFontFamily *family;
102 GpStatus stat;
103 GpGraphics *graphics;
104 HDC hdc = GetDC(0);
105 INT style;
106 REAL rval;
107 UINT16 em_height, line_spacing;
108 Unit unit;
110 GdipCreateFromHDC(hdc, &graphics);
112 memset(&lfa, 0, sizeof(LOGFONTA));
113 memset(&lfa2, 0xff, sizeof(LOGFONTA));
114 lstrcpyA(lfa.lfFaceName, "Tahoma");
116 stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
117 expect(Ok, stat);
118 stat = GdipGetLogFontA(font, graphics, &lfa2);
119 expect(Ok, stat);
121 ok(lfa2.lfHeight < 0, "Expected negative height\n");
122 expect(0, lfa2.lfWidth);
123 expect(0, lfa2.lfEscapement);
124 expect(0, lfa2.lfOrientation);
125 ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
126 expect(0, lfa2.lfItalic);
127 expect(0, lfa2.lfUnderline);
128 expect(0, lfa2.lfStrikeOut);
129 ok(lfa2.lfCharSet == GetTextCharset(hdc) || lfa2.lfCharSet == ANSI_CHARSET,
130 "Expected %x or %x, got %x\n", GetTextCharset(hdc), ANSI_CHARSET, lfa2.lfCharSet);
131 expect(0, lfa2.lfOutPrecision);
132 expect(0, lfa2.lfClipPrecision);
133 expect(0, lfa2.lfQuality);
134 expect(0, lfa2.lfPitchAndFamily);
136 GdipDeleteFont(font);
138 memset(&lfa, 0, sizeof(LOGFONTA));
139 lfa.lfHeight = 25;
140 lfa.lfWidth = 25;
141 lfa.lfEscapement = lfa.lfOrientation = 50;
142 lfa.lfItalic = lfa.lfUnderline = lfa.lfStrikeOut = TRUE;
144 memset(&lfa2, 0xff, sizeof(LOGFONTA));
145 lstrcpyA(lfa.lfFaceName, "Tahoma");
147 stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
148 expect(Ok, stat);
149 stat = GdipGetLogFontA(font, graphics, &lfa2);
150 expect(Ok, stat);
152 ok(lfa2.lfHeight < 0, "Expected negative height\n");
153 expect(0, lfa2.lfWidth);
154 expect(0, lfa2.lfEscapement);
155 expect(0, lfa2.lfOrientation);
156 ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
157 expect(TRUE, lfa2.lfItalic);
158 expect(TRUE, lfa2.lfUnderline);
159 expect(TRUE, lfa2.lfStrikeOut);
160 ok(lfa2.lfCharSet == GetTextCharset(hdc) || lfa2.lfCharSet == ANSI_CHARSET,
161 "Expected %x or %x, got %x\n", GetTextCharset(hdc), ANSI_CHARSET, lfa2.lfCharSet);
162 expect(0, lfa2.lfOutPrecision);
163 expect(0, lfa2.lfClipPrecision);
164 expect(0, lfa2.lfQuality);
165 expect(0, lfa2.lfPitchAndFamily);
167 stat = GdipGetFontStyle(font, &style);
168 expect(Ok, stat);
169 ok (style == (FontStyleItalic | FontStyleUnderline | FontStyleStrikeout),
170 "Expected , got %d\n", style);
172 stat = GdipGetFontUnit(font, &unit);
173 expect(Ok, stat);
174 expect(UnitWorld, unit);
176 stat = GdipGetFontHeight(font, graphics, &rval);
177 expect(Ok, stat);
178 expectf(25.347656, rval);
179 stat = GdipGetFontSize(font, &rval);
180 expect(Ok, stat);
181 expectf(21.0, rval);
183 stat = GdipGetFamily(font, &family);
184 expect(Ok, stat);
185 stat = GdipGetEmHeight(family, FontStyleRegular, &em_height);
186 expect(Ok, stat);
187 expect(2048, em_height);
188 stat = GdipGetLineSpacing(family, FontStyleRegular, &line_spacing);
189 expect(Ok, stat);
190 expect(2472, line_spacing);
191 GdipDeleteFontFamily(family);
193 GdipDeleteFont(font);
195 memset(&lfa, 0, sizeof(lfa));
196 lfa.lfHeight = -25;
197 lstrcpyA(lfa.lfFaceName, "Tahoma");
198 stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
199 expect(Ok, stat);
200 memset(&lfa2, 0xff, sizeof(lfa2));
201 stat = GdipGetLogFontA(font, graphics, &lfa2);
202 expect(Ok, stat);
203 expect(lfa.lfHeight, lfa2.lfHeight);
205 stat = GdipGetFontUnit(font, &unit);
206 expect(Ok, stat);
207 expect(UnitWorld, unit);
209 stat = GdipGetFontHeight(font, graphics, &rval);
210 expect(Ok, stat);
211 expectf(30.175781, rval);
212 stat = GdipGetFontSize(font, &rval);
213 expect(Ok, stat);
214 expectf(25.0, rval);
216 stat = GdipGetFamily(font, &family);
217 expect(Ok, stat);
218 stat = GdipGetEmHeight(family, FontStyleRegular, &em_height);
219 expect(Ok, stat);
220 expect(2048, em_height);
221 stat = GdipGetLineSpacing(family, FontStyleRegular, &line_spacing);
222 expect(Ok, stat);
223 expect(2472, line_spacing);
224 GdipDeleteFontFamily(family);
226 GdipDeleteFont(font);
228 GdipDeleteGraphics(graphics);
229 ReleaseDC(0, hdc);
232 static void test_fontfamily (void)
234 GpFontFamily *family, *clonedFontFamily;
235 WCHAR itsName[LF_FACESIZE];
236 GpStatus stat;
238 /* FontFamily cannot be NULL */
239 stat = GdipCreateFontFamilyFromName (Tahoma , NULL, NULL);
240 expect (InvalidParameter, stat);
242 /* FontFamily must be able to actually find the family.
243 * If it can't, any subsequent calls should fail.
245 stat = GdipCreateFontFamilyFromName (nonexistent, NULL, &family);
246 expect (FontFamilyNotFound, stat);
248 /* Bitmap fonts are not found */
249 stat = GdipCreateFontFamilyFromName (MSSansSerif, NULL, &family);
250 expect (FontFamilyNotFound, stat);
251 if(stat == Ok) GdipDeleteFontFamily(family);
253 stat = GdipCreateFontFamilyFromName (Tahoma, NULL, &family);
254 expect (Ok, stat);
256 stat = GdipGetFamilyName (family, itsName, LANG_NEUTRAL);
257 expect (Ok, stat);
258 expect (0, lstrcmpiW(itsName, Tahoma));
260 if (0)
262 /* Crashes on Windows XP SP2, Vista, and so Wine as well */
263 stat = GdipGetFamilyName (family, NULL, LANG_NEUTRAL);
264 expect (Ok, stat);
267 /* Make sure we don't read old data */
268 ZeroMemory (itsName, sizeof(itsName));
269 stat = GdipCloneFontFamily(family, &clonedFontFamily);
270 expect (Ok, stat);
271 GdipDeleteFontFamily(family);
272 stat = GdipGetFamilyName(clonedFontFamily, itsName, LANG_NEUTRAL);
273 expect(Ok, stat);
274 expect(0, lstrcmpiW(itsName, Tahoma));
276 GdipDeleteFontFamily(clonedFontFamily);
279 static void test_fontfamily_properties (void)
281 GpFontFamily* FontFamily = NULL;
282 GpStatus stat;
283 UINT16 result = 0;
285 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &FontFamily);
286 expect(Ok, stat);
288 stat = GdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
289 expect(Ok, stat);
290 ok (result == 2472, "Expected 2472, got %d\n", result);
291 result = 0;
292 stat = GdipGetEmHeight(FontFamily, FontStyleRegular, &result);
293 expect(Ok, stat);
294 ok(result == 2048, "Expected 2048, got %d\n", result);
295 result = 0;
296 stat = GdipGetCellAscent(FontFamily, FontStyleRegular, &result);
297 expect(Ok, stat);
298 ok(result == 2049, "Expected 2049, got %d\n", result);
299 result = 0;
300 stat = GdipGetCellDescent(FontFamily, FontStyleRegular, &result);
301 expect(Ok, stat);
302 ok(result == 423, "Expected 423, got %d\n", result);
303 GdipDeleteFontFamily(FontFamily);
305 stat = GdipCreateFontFamilyFromName(TimesNewRoman, NULL, &FontFamily);
306 if(stat == FontFamilyNotFound)
307 skip("Times New Roman not installed\n");
308 else
310 result = 0;
311 stat = GdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
312 expect(Ok, stat);
313 ok(result == 2355, "Expected 2355, got %d\n", result);
314 result = 0;
315 stat = GdipGetEmHeight(FontFamily, FontStyleRegular, &result);
316 expect(Ok, stat);
317 ok(result == 2048, "Expected 2048, got %d\n", result);
318 result = 0;
319 stat = GdipGetCellAscent(FontFamily, FontStyleRegular, &result);
320 expect(Ok, stat);
321 ok(result == 1825, "Expected 1825, got %d\n", result);
322 result = 0;
323 stat = GdipGetCellDescent(FontFamily, FontStyleRegular, &result);
324 expect(Ok, stat);
325 ok(result == 443, "Expected 443 got %d\n", result);
326 GdipDeleteFontFamily(FontFamily);
330 static void check_family(const char* context, GpFontFamily *family, WCHAR *name)
332 GpStatus stat;
333 GpFont* font;
335 *name = 0;
336 stat = GdipGetFamilyName(family, name, LANG_NEUTRAL);
337 ok(stat == Ok, "could not get the %s family name: %.8x\n", context, stat);
339 stat = GdipCreateFont(family, 12, FontStyleRegular, UnitPixel, &font);
340 ok(stat == Ok, "could not create a font for the %s family: %.8x\n", context, stat);
341 if (stat == Ok)
343 stat = GdipDeleteFont(font);
344 ok(stat == Ok, "could not delete the %s family font: %.8x\n", context, stat);
347 stat = GdipDeleteFontFamily(family);
348 ok(stat == Ok, "could not delete the %s family: %.8x\n", context, stat);
351 static void test_getgenerics (void)
353 GpStatus stat;
354 GpFontFamily *family;
355 WCHAR sansname[LF_FACESIZE], serifname[LF_FACESIZE], mononame[LF_FACESIZE];
356 int missingfonts = 0;
358 stat = GdipGetGenericFontFamilySansSerif(&family);
359 expect (Ok, stat);
360 if (stat == FontFamilyNotFound)
361 missingfonts = 1;
362 else
363 check_family("Sans Serif", family, sansname);
365 stat = GdipGetGenericFontFamilySerif(&family);
366 expect (Ok, stat);
367 if (stat == FontFamilyNotFound)
368 missingfonts = 1;
369 else
370 check_family("Serif", family, serifname);
372 stat = GdipGetGenericFontFamilyMonospace(&family);
373 expect (Ok, stat);
374 if (stat == FontFamilyNotFound)
375 missingfonts = 1;
376 else
377 check_family("Monospace", family, mononame);
379 if (missingfonts && strcmp(winetest_platform, "wine") == 0)
380 trace("You may need to install either the Microsoft Web Fonts or the Liberation Fonts\n");
382 /* Check that the family names are all different */
383 ok(lstrcmpiW(sansname, serifname) != 0, "Sans Serif and Serif families should be different: %s\n", wine_dbgstr_w(sansname));
384 ok(lstrcmpiW(sansname, mononame) != 0, "Sans Serif and Monospace families should be different: %s\n", wine_dbgstr_w(sansname));
385 ok(lstrcmpiW(serifname, mononame) != 0, "Serif and Monospace families should be different: %s\n", wine_dbgstr_w(serifname));
388 static void test_installedfonts (void)
390 GpStatus stat;
391 GpFontCollection* collection=NULL;
393 stat = GdipNewInstalledFontCollection(NULL);
394 expect (InvalidParameter, stat);
396 stat = GdipNewInstalledFontCollection(&collection);
397 expect (Ok, stat);
398 ok (collection != NULL, "got NULL font collection\n");
401 static void test_heightgivendpi(void)
403 GpStatus stat;
404 GpFont* font = NULL;
405 GpFontFamily* fontfamily = NULL;
406 REAL height;
407 Unit unit;
409 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &fontfamily);
410 expect(Ok, stat);
412 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPixel, &font);
413 expect(Ok, stat);
415 stat = GdipGetFontHeightGivenDPI(NULL, 96, &height);
416 expect(InvalidParameter, stat);
418 stat = GdipGetFontHeightGivenDPI(font, 96, NULL);
419 expect(InvalidParameter, stat);
421 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
422 expect(Ok, stat);
423 expectf(36.210938, height);
424 GdipDeleteFont(font);
426 height = 12345;
427 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitWorld, &font);
428 expect(Ok, stat);
430 stat = GdipGetFontUnit(font, &unit);
431 expect(Ok, stat);
432 expect(UnitWorld, unit);
434 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
435 expect(Ok, stat);
436 expectf(36.210938, height);
437 GdipDeleteFont(font);
439 height = 12345;
440 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPoint, &font);
441 expect(Ok, stat);
442 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
443 expect(Ok, stat);
444 expectf(48.281250, height);
445 GdipDeleteFont(font);
447 height = 12345;
448 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitInch, &font);
449 expect(Ok, stat);
451 stat = GdipGetFontUnit(font, &unit);
452 expect(Ok, stat);
453 expect(UnitInch, unit);
455 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
456 expect(Ok, stat);
457 expectf(3476.250000, height);
458 GdipDeleteFont(font);
460 height = 12345;
461 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitDocument, &font);
462 expect(Ok, stat);
464 stat = GdipGetFontUnit(font, &unit);
465 expect(Ok, stat);
466 expect(UnitDocument, unit);
468 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
469 expect(Ok, stat);
470 expectf(11.587500, height);
471 GdipDeleteFont(font);
473 height = 12345;
474 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitMillimeter, &font);
475 expect(Ok, stat);
477 stat = GdipGetFontUnit(font, &unit);
478 expect(Ok, stat);
479 expect(UnitMillimeter, unit);
481 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
482 expect(Ok, stat);
483 expectf(136.860245, height);
484 GdipDeleteFont(font);
486 GdipDeleteFontFamily(fontfamily);
489 static int CALLBACK font_enum_proc(const LOGFONTW *lfe, const TEXTMETRICW *ntme,
490 DWORD type, LPARAM lparam)
492 NEWTEXTMETRICW *ntm = (NEWTEXTMETRICW *)lparam;
494 if (type != TRUETYPE_FONTTYPE) return 1;
496 *ntm = *(NEWTEXTMETRICW *)ntme;
497 return 0;
500 struct font_metrics
502 UINT16 em_height, line_spacing, ascent, descent;
503 REAL font_height, font_size;
504 INT lfHeight;
507 static void gdi_get_font_metrics(LOGFONTW *lf, struct font_metrics *fm)
509 HDC hdc;
510 HFONT hfont;
511 NEWTEXTMETRICW ntm;
512 OUTLINETEXTMETRICW otm;
513 int ret;
515 hdc = CreateCompatibleDC(0);
517 /* it's the only way to get extended NEWTEXTMETRIC fields */
518 ret = EnumFontFamiliesExW(hdc, lf, font_enum_proc, (LPARAM)&ntm, 0);
519 ok(!ret, "EnumFontFamiliesExW failed to find %s\n", wine_dbgstr_w(lf->lfFaceName));
521 hfont = CreateFontIndirectW(lf);
522 SelectObject(hdc, hfont);
524 otm.otmSize = sizeof(otm);
525 ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
526 ok(ret, "GetOutlineTextMetrics failed\n");
528 DeleteDC(hdc);
529 DeleteObject(hfont);
531 fm->lfHeight = -otm.otmTextMetrics.tmAscent;
532 fm->line_spacing = ntm.ntmCellHeight;
533 fm->font_size = (REAL)otm.otmTextMetrics.tmAscent;
534 fm->font_height = (REAL)fm->line_spacing * fm->font_size / (REAL)ntm.ntmSizeEM;
535 fm->em_height = ntm.ntmSizeEM;
536 fm->ascent = ntm.ntmSizeEM;
537 fm->descent = ntm.ntmCellHeight - ntm.ntmSizeEM;
540 static void gdip_get_font_metrics(GpFont *font, struct font_metrics *fm)
542 INT style;
543 GpFontFamily *family;
544 GpStatus stat;
546 stat = GdipGetFontStyle(font, &style);
547 expect(Ok, stat);
549 stat = GdipGetFontHeight(font, NULL, &fm->font_height);
550 expect(Ok, stat);
551 stat = GdipGetFontSize(font, &fm->font_size);
552 expect(Ok, stat);
554 fm->lfHeight = (INT)(fm->font_size * -1.0);
556 stat = GdipGetFamily(font, &family);
557 expect(Ok, stat);
559 stat = GdipGetEmHeight(family, style, &fm->em_height);
560 expect(Ok, stat);
561 stat = GdipGetLineSpacing(family, style, &fm->line_spacing);
562 expect(Ok, stat);
563 stat = GdipGetCellAscent(family, style, &fm->ascent);
564 expect(Ok, stat);
565 stat = GdipGetCellDescent(family, style, &fm->descent);
566 expect(Ok, stat);
568 GdipDeleteFontFamily(family);
571 static void cmp_font_metrics(struct font_metrics *fm1, struct font_metrics *fm2, int line)
573 ok_(__FILE__, line)(fm1->lfHeight == fm2->lfHeight, "lfHeight %d != %d\n", fm1->lfHeight, fm2->lfHeight);
574 ok_(__FILE__, line)(fm1->em_height == fm2->em_height, "em_height %u != %u\n", fm1->em_height, fm2->em_height);
575 ok_(__FILE__, line)(fm1->line_spacing == fm2->line_spacing, "line_spacing %u != %u\n", fm1->line_spacing, fm2->line_spacing);
576 ok_(__FILE__, line)(abs(fm1->ascent - fm2->ascent) <= 1, "ascent %u != %u\n", fm1->ascent, fm2->ascent);
577 ok_(__FILE__, line)(abs(fm1->descent - fm2->descent) <= 1, "descent %u != %u\n", fm1->descent, fm2->descent);
578 ok(fm1->font_height > 0.0, "fm1->font_height should be positive, got %f\n", fm1->font_height);
579 ok(fm2->font_height > 0.0, "fm2->font_height should be positive, got %f\n", fm2->font_height);
580 ok_(__FILE__, line)(fm1->font_height == fm2->font_height, "font_height %f != %f\n", fm1->font_height, fm2->font_height);
581 ok(fm1->font_size > 0.0, "fm1->font_size should be positive, got %f\n", fm1->font_size);
582 ok(fm2->font_size > 0.0, "fm2->font_size should be positive, got %f\n", fm2->font_size);
583 ok_(__FILE__, line)(fm1->font_size == fm2->font_size, "font_size %f != %f\n", fm1->font_size, fm2->font_size);
586 static void test_font_metrics(void)
588 LOGFONTW lf;
589 GpFont *font;
590 GpFontFamily *family;
591 GpGraphics *graphics;
592 GpStatus stat;
593 Unit unit;
594 struct font_metrics fm_gdi, fm_gdip;
595 HDC hdc;
597 hdc = CreateCompatibleDC(0);
598 stat = GdipCreateFromHDC(hdc, &graphics);
599 expect(Ok, stat);
601 memset(&lf, 0, sizeof(lf));
603 /* Tahoma,-13 */
604 lstrcpyW(lf.lfFaceName, Tahoma);
605 lf.lfHeight = -13;
606 stat = GdipCreateFontFromLogfontW(hdc, &lf, &font);
607 expect(Ok, stat);
609 stat = GdipGetFontUnit(font, &unit);
610 expect(Ok, stat);
611 expect(UnitWorld, unit);
613 gdip_get_font_metrics(font, &fm_gdip);
614 trace("gdiplus:\n");
615 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
616 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
617 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
618 fm_gdip.font_height, fm_gdip.font_size);
620 gdi_get_font_metrics(&lf, &fm_gdi);
621 trace("gdi:\n");
622 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
623 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
624 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
625 fm_gdi.font_height, fm_gdi.font_size);
627 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
629 stat = GdipGetLogFontW(font, graphics, &lf);
630 expect(Ok, stat);
631 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
632 gdi_get_font_metrics(&lf, &fm_gdi);
633 trace("gdi:\n");
634 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
635 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
636 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
637 fm_gdi.font_height, fm_gdi.font_size);
638 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
640 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
642 GdipDeleteFont(font);
644 /* Tahoma,13 */
645 lstrcpyW(lf.lfFaceName, Tahoma);
646 lf.lfHeight = 13;
647 stat = GdipCreateFontFromLogfontW(hdc, &lf, &font);
648 expect(Ok, stat);
650 stat = GdipGetFontUnit(font, &unit);
651 expect(Ok, stat);
652 expect(UnitWorld, unit);
654 gdip_get_font_metrics(font, &fm_gdip);
655 trace("gdiplus:\n");
656 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
657 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
658 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
659 fm_gdip.font_height, fm_gdip.font_size);
661 gdi_get_font_metrics(&lf, &fm_gdi);
662 trace("gdi:\n");
663 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
664 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
665 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
666 fm_gdi.font_height, fm_gdi.font_size);
668 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
670 stat = GdipGetLogFontW(font, graphics, &lf);
671 expect(Ok, stat);
672 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
673 gdi_get_font_metrics(&lf, &fm_gdi);
674 trace("gdi:\n");
675 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
676 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
677 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
678 fm_gdi.font_height, fm_gdi.font_size);
679 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
681 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
683 GdipDeleteFont(font);
685 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &family);
686 expect(Ok, stat);
688 /* Tahoma,13 */
689 stat = GdipCreateFont(family, 13.0, FontStyleRegular, UnitPixel, &font);
690 expect(Ok, stat);
692 gdip_get_font_metrics(font, &fm_gdip);
693 trace("gdiplus:\n");
694 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
695 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
696 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
697 fm_gdip.font_height, fm_gdip.font_size);
699 stat = GdipGetLogFontW(font, graphics, &lf);
700 expect(Ok, stat);
701 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
702 gdi_get_font_metrics(&lf, &fm_gdi);
703 trace("gdi:\n");
704 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
705 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
706 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
707 fm_gdi.font_height, fm_gdi.font_size);
708 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
710 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
712 stat = GdipGetLogFontW(font, NULL, &lf);
713 expect(InvalidParameter, stat);
715 GdipDeleteFont(font);
717 stat = GdipCreateFont(family, -13.0, FontStyleRegular, UnitPixel, &font);
718 expect(InvalidParameter, stat);
720 GdipDeleteFontFamily(family);
722 GdipDeleteGraphics(graphics);
723 DeleteDC(hdc);
726 static void test_font_substitution(void)
728 WCHAR ms_shell_dlg[LF_FACESIZE];
729 HDC hdc;
730 HFONT hfont;
731 LOGFONTA lf;
732 GpStatus status;
733 GpGraphics *graphics;
734 GpFont *font;
735 GpFontFamily *family;
736 int ret;
738 hdc = CreateCompatibleDC(0);
739 status = GdipCreateFromHDC(hdc, &graphics);
740 expect(Ok, status);
742 hfont = GetStockObject(DEFAULT_GUI_FONT);
743 ok(hfont != 0, "GetStockObject(DEFAULT_GUI_FONT) failed\n");
745 memset(&lf, 0xfe, sizeof(lf));
746 ret = GetObjectA(hfont, sizeof(lf), &lf);
747 ok(ret == sizeof(lf), "GetObject failed\n");
748 ok(!lstrcmpA(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
749 MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, -1, ms_shell_dlg, LF_FACESIZE);
751 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
752 expect(Ok, status);
753 memset(&lf, 0xfe, sizeof(lf));
754 status = GdipGetLogFontA(font, graphics, &lf);
755 expect(Ok, status);
756 ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
757 !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
758 GdipDeleteFont(font);
760 status = GdipCreateFontFamilyFromName(ms_shell_dlg, NULL, &family);
761 expect(Ok, status);
762 status = GdipCreateFont(family, 12, FontStyleRegular, UnitPoint, &font);
763 expect(Ok, status);
764 memset(&lf, 0xfe, sizeof(lf));
765 status = GdipGetLogFontA(font, graphics, &lf);
766 expect(Ok, status);
767 ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
768 !lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
769 GdipDeleteFont(font);
770 GdipDeleteFontFamily(family);
772 status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family);
773 ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
775 lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
776 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
777 expect(Ok, status);
778 memset(&lf, 0xfe, sizeof(lf));
779 status = GdipGetLogFontA(font, graphics, &lf);
780 expect(Ok, status);
781 ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
782 GdipDeleteFont(font);
784 /* empty FaceName */
785 lf.lfFaceName[0] = 0;
786 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
787 expect(Ok, status);
788 memset(&lf, 0xfe, sizeof(lf));
789 status = GdipGetLogFontA(font, graphics, &lf);
790 expect(Ok, status);
791 ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
792 GdipDeleteFont(font);
794 /* zeroing out lfWeight and lfCharSet leads to font creation failure */
795 lf.lfWeight = 0;
796 lf.lfCharSet = 0;
797 lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
798 font = NULL;
799 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
800 todo_wine
801 ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
802 "expected NotTrueTypeFont, got %d\n", status);
803 /* FIXME: remove when wine is fixed */
804 if (font) GdipDeleteFont(font);
806 /* empty FaceName */
807 lf.lfFaceName[0] = 0;
808 font = NULL;
809 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
810 todo_wine
811 ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
812 "expected NotTrueTypeFont, got %d\n", status);
813 /* FIXME: remove when wine is fixed */
814 if (font) GdipDeleteFont(font);
816 GdipDeleteGraphics(graphics);
817 DeleteDC(hdc);
820 static void test_font_transform(void)
822 static const WCHAR string[] = { 'A',0 };
823 GpStatus status;
824 HDC hdc;
825 LOGFONTA lf;
826 GpFont *font;
827 GpGraphics *graphics;
828 GpMatrix *matrix;
829 GpStringFormat *format, *typographic;
830 PointF pos[1] = { { 0,0 } };
831 REAL height, margin_y;
832 RectF bounds, rect;
834 hdc = CreateCompatibleDC(0);
835 status = GdipCreateFromHDC(hdc, &graphics);
836 expect(Ok, status);
838 status = GdipSetPageUnit(graphics, UnitPixel);
839 expect(Ok, status);
841 status = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
842 expect(Ok, status);
843 status = GdipStringFormatGetGenericTypographic(&typographic);
844 expect(Ok, status);
846 memset(&lf, 0, sizeof(lf));
847 lstrcpyA(lf.lfFaceName, "Tahoma");
848 lf.lfHeight = -100;
849 lf.lfWidth = 100;
850 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
851 expect(Ok, status);
853 margin_y = 100.0 / 8.0;
855 /* identity matrix */
856 status = GdipCreateMatrix(&matrix);
857 expect(Ok, status);
858 status = GdipSetWorldTransform(graphics, matrix);
859 expect(Ok, status);
860 status = GdipGetLogFontA(font, graphics, &lf);
861 expect(Ok, status);
862 expect(-100, lf.lfHeight);
863 expect(0, lf.lfWidth);
864 expect(0, lf.lfEscapement);
865 expect(0, lf.lfOrientation);
866 status = GdipGetFontHeight(font, graphics, &height);
867 expect(Ok, status);
868 expectf(120.703125, height);
869 set_rect_empty(&rect);
870 set_rect_empty(&bounds);
871 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
872 expect(Ok, status);
873 expectf(0.0, bounds.X);
874 expectf(0.0, bounds.Y);
875 todo_wine
876 expectf(height + margin_y, bounds.Height);
877 set_rect_empty(&rect);
878 set_rect_empty(&bounds);
879 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
880 expect(Ok, status);
881 expectf(0.0, bounds.X);
882 expectf(0.0, bounds.Y);
883 expectf_(height, bounds.Height, 1.0);
884 set_rect_empty(&bounds);
885 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
886 DriverStringOptionsCmapLookup, NULL, &bounds);
887 expect(Ok, status);
888 expectf(0.0, bounds.X);
889 expectf_(-100.0, bounds.Y, 0.05);
890 expectf_(height, bounds.Height, 0.5);
891 set_rect_empty(&bounds);
892 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
893 DriverStringOptionsCmapLookup, matrix, &bounds);
894 expect(Ok, status);
895 expectf(0.0, bounds.X);
896 expectf_(-100.0, bounds.Y, 0.05);
897 expectf_(height, bounds.Height, 0.5);
899 /* scale matrix */
900 status = GdipScaleMatrix(matrix, 2.0, 3.0, MatrixOrderAppend);
901 expect(Ok, status);
902 status = GdipSetWorldTransform(graphics, matrix);
903 expect(Ok, status);
904 status = GdipGetLogFontA(font, graphics, &lf);
905 expect(Ok, status);
906 expect(-300, lf.lfHeight);
907 expect(0, lf.lfWidth);
908 expect(0, lf.lfEscapement);
909 expect(0, lf.lfOrientation);
910 status = GdipGetFontHeight(font, graphics, &height);
911 expect(Ok, status);
912 expectf(120.703125, height);
913 set_rect_empty(&rect);
914 set_rect_empty(&bounds);
915 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
916 expect(Ok, status);
917 expectf(0.0, bounds.X);
918 expectf(0.0, bounds.Y);
919 todo_wine
920 expectf(height + margin_y, bounds.Height);
921 set_rect_empty(&rect);
922 set_rect_empty(&bounds);
923 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
924 expect(Ok, status);
925 expectf(0.0, bounds.X);
926 expectf(0.0, bounds.Y);
927 expectf_(height, bounds.Height, 0.05);
928 set_rect_empty(&bounds);
929 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
930 DriverStringOptionsCmapLookup, NULL, &bounds);
931 expect(Ok, status);
932 expectf(0.0, bounds.X);
933 expectf_(-100.0, bounds.Y, 0.05);
934 expectf_(height, bounds.Height, 0.2);
935 set_rect_empty(&bounds);
936 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
937 DriverStringOptionsCmapLookup, matrix, &bounds);
938 expect(Ok, status);
939 expectf(0.0, bounds.X);
940 todo_wine
941 expectf_(-300.0, bounds.Y, 0.15);
942 todo_wine
943 expectf(height * 3.0, bounds.Height);
945 /* scale + ratate matrix */
946 status = GdipRotateMatrix(matrix, 45.0, MatrixOrderAppend);
947 expect(Ok, status);
948 status = GdipSetWorldTransform(graphics, matrix);
949 expect(Ok, status);
950 status = GdipGetLogFontA(font, graphics, &lf);
951 expect(Ok, status);
952 expect(-300, lf.lfHeight);
953 expect(0, lf.lfWidth);
954 expect_(3151, lf.lfEscapement, 1);
955 expect_(3151, lf.lfOrientation, 1);
956 status = GdipGetFontHeight(font, graphics, &height);
957 expect(Ok, status);
958 expectf(120.703125, height);
959 set_rect_empty(&rect);
960 set_rect_empty(&bounds);
961 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
962 expect(Ok, status);
963 expectf(0.0, bounds.X);
964 expectf(0.0, bounds.Y);
965 todo_wine
966 expectf(height + margin_y, bounds.Height);
967 set_rect_empty(&rect);
968 set_rect_empty(&bounds);
969 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
970 expect(Ok, status);
971 expectf(0.0, bounds.X);
972 expectf(0.0, bounds.Y);
973 expectf_(height, bounds.Height, 0.05);
974 set_rect_empty(&bounds);
975 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
976 DriverStringOptionsCmapLookup, NULL, &bounds);
977 expect(Ok, status);
978 expectf(0.0, bounds.X);
979 expectf_(-100.0, bounds.Y, 0.05);
980 expectf_(height, bounds.Height, 0.2);
981 set_rect_empty(&bounds);
982 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
983 DriverStringOptionsCmapLookup, matrix, &bounds);
984 expect(Ok, status);
985 todo_wine
986 expectf_(-43.814377, bounds.X, 0.05);
987 todo_wine
988 expectf_(-212.235611, bounds.Y, 0.05);
989 todo_wine
990 expectf_(340.847534, bounds.Height, 0.05);
992 /* scale + ratate + shear matrix */
993 status = GdipShearMatrix(matrix, 4.0, 5.0, MatrixOrderAppend);
994 expect(Ok, status);
995 status = GdipSetWorldTransform(graphics, matrix);
996 expect(Ok, status);
997 status = GdipGetLogFontA(font, graphics, &lf);
998 expect(Ok, status);
999 todo_wine
1000 expect(1032, lf.lfHeight);
1001 expect(0, lf.lfWidth);
1002 expect_(3099, lf.lfEscapement, 1);
1003 expect_(3099, lf.lfOrientation, 1);
1004 status = GdipGetFontHeight(font, graphics, &height);
1005 expect(Ok, status);
1006 expectf(120.703125, height);
1007 set_rect_empty(&rect);
1008 set_rect_empty(&bounds);
1009 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1010 expect(Ok, status);
1011 expectf(0.0, bounds.X);
1012 expectf(0.0, bounds.Y);
1013 todo_wine
1014 expectf(height + margin_y, bounds.Height);
1015 set_rect_empty(&rect);
1016 set_rect_empty(&bounds);
1017 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1018 expect(Ok, status);
1019 expectf(0.0, bounds.X);
1020 expectf(0.0, bounds.Y);
1021 expectf_(height, bounds.Height, 0.2);
1022 set_rect_empty(&bounds);
1023 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1024 DriverStringOptionsCmapLookup, NULL, &bounds);
1025 expect(Ok, status);
1026 expectf(0.0, bounds.X);
1027 expectf_(-100.0, bounds.Y, 0.2);
1028 expectf_(height, bounds.Height, 0.2);
1029 set_rect_empty(&bounds);
1030 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1031 DriverStringOptionsCmapLookup, matrix, &bounds);
1032 expect(Ok, status);
1033 todo_wine
1034 expectf_(-636.706848, bounds.X, 0.05);
1035 todo_wine
1036 expectf_(-175.257523, bounds.Y, 0.05);
1037 todo_wine
1038 expectf_(1532.984985, bounds.Height, 0.05);
1040 /* scale + ratate + shear + translate matrix */
1041 status = GdipTranslateMatrix(matrix, 10.0, 20.0, MatrixOrderAppend);
1042 expect(Ok, status);
1043 status = GdipSetWorldTransform(graphics, matrix);
1044 expect(Ok, status);
1045 status = GdipGetLogFontA(font, graphics, &lf);
1046 expect(Ok, status);
1047 todo_wine
1048 expect(1032, lf.lfHeight);
1049 expect(0, lf.lfWidth);
1050 expect_(3099, lf.lfEscapement, 1);
1051 expect_(3099, lf.lfOrientation, 1);
1052 status = GdipGetFontHeight(font, graphics, &height);
1053 expect(Ok, status);
1054 expectf(120.703125, height);
1055 set_rect_empty(&rect);
1056 set_rect_empty(&bounds);
1057 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1058 expect(Ok, status);
1059 expectf(0.0, bounds.X);
1060 expectf(0.0, bounds.Y);
1061 todo_wine
1062 expectf(height + margin_y, bounds.Height);
1063 set_rect_empty(&rect);
1064 set_rect_empty(&bounds);
1065 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1066 expect(Ok, status);
1067 expectf(0.0, bounds.X);
1068 expectf(0.0, bounds.Y);
1069 expectf_(height, bounds.Height, 0.1);
1070 set_rect_empty(&bounds);
1071 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1072 DriverStringOptionsCmapLookup, NULL, &bounds);
1073 expect(Ok, status);
1074 expectf(0.0, bounds.X);
1075 expectf_(-100.0, bounds.Y, 0.2);
1076 expectf_(height, bounds.Height, 0.2);
1077 set_rect_empty(&bounds);
1078 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1079 DriverStringOptionsCmapLookup, matrix, &bounds);
1080 expect(Ok, status);
1081 todo_wine
1082 expectf_(-626.706848, bounds.X, 0.05);
1083 todo_wine
1084 expectf_(-155.257523, bounds.Y, 0.05);
1085 todo_wine
1086 expectf_(1532.984985, bounds.Height, 0.05);
1088 GdipDeleteMatrix(matrix);
1089 GdipDeleteFont(font);
1090 GdipDeleteGraphics(graphics);
1091 GdipDeleteStringFormat(typographic);
1092 GdipDeleteStringFormat(format);
1093 DeleteDC(hdc);
1096 START_TEST(font)
1098 struct GdiplusStartupInput gdiplusStartupInput;
1099 ULONG_PTR gdiplusToken;
1101 gdiplusStartupInput.GdiplusVersion = 1;
1102 gdiplusStartupInput.DebugEventCallback = NULL;
1103 gdiplusStartupInput.SuppressBackgroundThread = 0;
1104 gdiplusStartupInput.SuppressExternalCodecs = 0;
1106 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1108 test_font_transform();
1109 test_font_substitution();
1110 test_font_metrics();
1111 test_createfont();
1112 test_logfont();
1113 test_fontfamily();
1114 test_fontfamily_properties();
1115 test_getgenerics();
1116 test_installedfonts();
1117 test_heightgivendpi();
1119 GdiplusShutdown(gdiplusToken);