urlmon: Moved FindMimeFromData to mimefilter.c.
[wine/multimedia.git] / dlls / gdiplus / tests / font.c
blob29d4ad5e04f7b32133c725784b08166c6c4bf28b
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 "windows.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 MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
36 static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
37 static const WCHAR CourierNew[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
38 static const WCHAR Tahoma[] = {'T','a','h','o','m','a',0};
39 static const WCHAR LiberationSerif[] = {'L','i','b','e','r','a','t','i','o','n',' ','S','e','r','i','f',0};
41 static void set_rect_empty(RectF *rc)
43 rc->X = 0.0;
44 rc->Y = 0.0;
45 rc->Width = 0.0;
46 rc->Height = 0.0;
49 static void test_createfont(void)
51 GpFontFamily* fontfamily = NULL, *fontfamily2;
52 GpFont* font = NULL;
53 GpStatus stat;
54 Unit unit;
55 UINT i;
56 REAL size;
57 WCHAR familyname[LF_FACESIZE];
59 stat = GdipCreateFontFamilyFromName(nonexistent, NULL, &fontfamily);
60 expect (FontFamilyNotFound, stat);
61 stat = GdipDeleteFont(font);
62 expect (InvalidParameter, stat);
63 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &fontfamily);
64 expect (Ok, stat);
65 stat = GdipCreateFont(fontfamily, 12, FontStyleRegular, UnitPoint, &font);
66 expect (Ok, stat);
67 stat = GdipGetFontUnit (font, &unit);
68 expect (Ok, stat);
69 expect (UnitPoint, unit);
71 stat = GdipGetFamily(font, &fontfamily2);
72 expect(Ok, stat);
73 stat = GdipGetFamilyName(fontfamily2, familyname, 0);
74 expect(Ok, stat);
75 ok (lstrcmpiW(Tahoma, familyname) == 0, "Expected Tahoma, got %s\n",
76 wine_dbgstr_w(familyname));
77 stat = GdipDeleteFontFamily(fontfamily2);
78 expect(Ok, stat);
80 /* Test to see if returned size is based on unit (its not) */
81 GdipGetFontSize(font, &size);
82 ok (size == 12, "Expected 12, got %f\n", size);
83 GdipDeleteFont(font);
85 /* Make sure everything is converted correctly for all Units */
86 for (i = UnitWorld; i <=UnitMillimeter; i++)
88 if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */
89 GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font);
90 GdipGetFontSize (font, &size);
91 ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i);
92 GdipGetFontUnit (font, &unit);
93 expect (i, unit);
94 GdipDeleteFont(font);
97 GdipDeleteFontFamily(fontfamily);
100 static void test_logfont(void)
102 LOGFONTA lfa, lfa2;
103 GpFont *font;
104 GpFontFamily *family;
105 GpStatus stat;
106 GpGraphics *graphics;
107 HDC hdc = GetDC(0);
108 INT style;
109 REAL rval;
110 UINT16 em_height, line_spacing;
111 Unit unit;
113 GdipCreateFromHDC(hdc, &graphics);
115 memset(&lfa, 0, sizeof(LOGFONTA));
116 memset(&lfa2, 0xff, sizeof(LOGFONTA));
117 lstrcpyA(lfa.lfFaceName, "Tahoma");
119 stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
120 expect(Ok, stat);
121 stat = GdipGetLogFontA(font, graphics, &lfa2);
122 expect(Ok, stat);
124 ok(lfa2.lfHeight < 0, "Expected negative height\n");
125 expect(0, lfa2.lfWidth);
126 expect(0, lfa2.lfEscapement);
127 expect(0, lfa2.lfOrientation);
128 ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
129 expect(0, lfa2.lfItalic);
130 expect(0, lfa2.lfUnderline);
131 expect(0, lfa2.lfStrikeOut);
132 ok(lfa2.lfCharSet == GetTextCharset(hdc) || lfa2.lfCharSet == ANSI_CHARSET,
133 "Expected %x or %x, got %x\n", GetTextCharset(hdc), ANSI_CHARSET, lfa2.lfCharSet);
134 expect(0, lfa2.lfOutPrecision);
135 expect(0, lfa2.lfClipPrecision);
136 expect(0, lfa2.lfQuality);
137 expect(0, lfa2.lfPitchAndFamily);
139 GdipDeleteFont(font);
141 memset(&lfa, 0, sizeof(LOGFONTA));
142 lfa.lfHeight = 25;
143 lfa.lfWidth = 25;
144 lfa.lfEscapement = lfa.lfOrientation = 50;
145 lfa.lfItalic = lfa.lfUnderline = lfa.lfStrikeOut = TRUE;
147 memset(&lfa2, 0xff, sizeof(LOGFONTA));
148 lstrcpyA(lfa.lfFaceName, "Tahoma");
150 stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
151 expect(Ok, stat);
152 stat = GdipGetLogFontA(font, graphics, &lfa2);
153 expect(Ok, stat);
155 ok(lfa2.lfHeight < 0, "Expected negative height\n");
156 expect(0, lfa2.lfWidth);
157 expect(0, lfa2.lfEscapement);
158 expect(0, lfa2.lfOrientation);
159 ok((lfa2.lfWeight >= 100) && (lfa2.lfWeight <= 900), "Expected weight to be set\n");
160 expect(TRUE, lfa2.lfItalic);
161 expect(TRUE, lfa2.lfUnderline);
162 expect(TRUE, lfa2.lfStrikeOut);
163 ok(lfa2.lfCharSet == GetTextCharset(hdc) || lfa2.lfCharSet == ANSI_CHARSET,
164 "Expected %x or %x, got %x\n", GetTextCharset(hdc), ANSI_CHARSET, lfa2.lfCharSet);
165 expect(0, lfa2.lfOutPrecision);
166 expect(0, lfa2.lfClipPrecision);
167 expect(0, lfa2.lfQuality);
168 expect(0, lfa2.lfPitchAndFamily);
170 stat = GdipGetFontStyle(font, &style);
171 expect(Ok, stat);
172 ok (style == (FontStyleItalic | FontStyleUnderline | FontStyleStrikeout),
173 "Expected , got %d\n", style);
175 stat = GdipGetFontUnit(font, &unit);
176 expect(Ok, stat);
177 expect(UnitWorld, unit);
179 stat = GdipGetFontHeight(font, graphics, &rval);
180 expect(Ok, stat);
181 expectf(25.347656, rval);
182 stat = GdipGetFontSize(font, &rval);
183 expect(Ok, stat);
184 expectf(21.0, rval);
186 stat = GdipGetFamily(font, &family);
187 expect(Ok, stat);
188 stat = GdipGetEmHeight(family, FontStyleRegular, &em_height);
189 expect(Ok, stat);
190 expect(2048, em_height);
191 stat = GdipGetLineSpacing(family, FontStyleRegular, &line_spacing);
192 expect(Ok, stat);
193 expect(2472, line_spacing);
194 GdipDeleteFontFamily(family);
196 GdipDeleteFont(font);
198 memset(&lfa, 0, sizeof(lfa));
199 lfa.lfHeight = -25;
200 lstrcpyA(lfa.lfFaceName, "Tahoma");
201 stat = GdipCreateFontFromLogfontA(hdc, &lfa, &font);
202 expect(Ok, stat);
203 memset(&lfa2, 0xff, sizeof(lfa2));
204 stat = GdipGetLogFontA(font, graphics, &lfa2);
205 expect(Ok, stat);
206 expect(lfa.lfHeight, lfa2.lfHeight);
208 stat = GdipGetFontUnit(font, &unit);
209 expect(Ok, stat);
210 expect(UnitWorld, unit);
212 stat = GdipGetFontHeight(font, graphics, &rval);
213 expect(Ok, stat);
214 expectf(30.175781, rval);
215 stat = GdipGetFontSize(font, &rval);
216 expect(Ok, stat);
217 expectf(25.0, rval);
219 stat = GdipGetFamily(font, &family);
220 expect(Ok, stat);
221 stat = GdipGetEmHeight(family, FontStyleRegular, &em_height);
222 expect(Ok, stat);
223 expect(2048, em_height);
224 stat = GdipGetLineSpacing(family, FontStyleRegular, &line_spacing);
225 expect(Ok, stat);
226 expect(2472, line_spacing);
227 GdipDeleteFontFamily(family);
229 GdipDeleteFont(font);
231 GdipDeleteGraphics(graphics);
232 ReleaseDC(0, hdc);
235 static void test_fontfamily (void)
237 GpFontFamily *family, *clonedFontFamily;
238 WCHAR itsName[LF_FACESIZE];
239 GpStatus stat;
241 /* FontFamily cannot be NULL */
242 stat = GdipCreateFontFamilyFromName (Tahoma , NULL, NULL);
243 expect (InvalidParameter, stat);
245 /* FontFamily must be able to actually find the family.
246 * If it can't, any subsequent calls should fail.
248 stat = GdipCreateFontFamilyFromName (nonexistent, NULL, &family);
249 expect (FontFamilyNotFound, stat);
251 /* Bitmap fonts are not found */
252 stat = GdipCreateFontFamilyFromName (MSSansSerif, NULL, &family);
253 expect (FontFamilyNotFound, stat);
254 if(stat == Ok) GdipDeleteFontFamily(family);
256 stat = GdipCreateFontFamilyFromName (Tahoma, NULL, &family);
257 expect (Ok, stat);
259 stat = GdipGetFamilyName (family, itsName, LANG_NEUTRAL);
260 expect (Ok, stat);
261 expect (0, lstrcmpiW(itsName, Tahoma));
263 if (0)
265 /* Crashes on Windows XP SP2, Vista, and so Wine as well */
266 stat = GdipGetFamilyName (family, NULL, LANG_NEUTRAL);
267 expect (Ok, stat);
270 /* Make sure we don't read old data */
271 ZeroMemory (itsName, sizeof(itsName));
272 stat = GdipCloneFontFamily(family, &clonedFontFamily);
273 expect (Ok, stat);
274 GdipDeleteFontFamily(family);
275 stat = GdipGetFamilyName(clonedFontFamily, itsName, LANG_NEUTRAL);
276 expect(Ok, stat);
277 expect(0, lstrcmpiW(itsName, Tahoma));
279 GdipDeleteFontFamily(clonedFontFamily);
282 static void test_fontfamily_properties (void)
284 GpFontFamily* FontFamily = NULL;
285 GpStatus stat;
286 UINT16 result = 0;
288 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &FontFamily);
289 expect(Ok, stat);
291 stat = GdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
292 expect(Ok, stat);
293 ok (result == 2472, "Expected 2472, got %d\n", result);
294 result = 0;
295 stat = GdipGetEmHeight(FontFamily, FontStyleRegular, &result);
296 expect(Ok, stat);
297 ok(result == 2048, "Expected 2048, got %d\n", result);
298 result = 0;
299 stat = GdipGetCellAscent(FontFamily, FontStyleRegular, &result);
300 expect(Ok, stat);
301 ok(result == 2049, "Expected 2049, got %d\n", result);
302 result = 0;
303 stat = GdipGetCellDescent(FontFamily, FontStyleRegular, &result);
304 expect(Ok, stat);
305 ok(result == 423, "Expected 423, got %d\n", result);
306 GdipDeleteFontFamily(FontFamily);
308 stat = GdipCreateFontFamilyFromName(TimesNewRoman, NULL, &FontFamily);
309 if(stat == FontFamilyNotFound)
310 skip("Times New Roman not installed\n");
311 else
313 result = 0;
314 stat = GdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
315 expect(Ok, stat);
316 ok(result == 2355, "Expected 2355, got %d\n", result);
317 result = 0;
318 stat = GdipGetEmHeight(FontFamily, FontStyleRegular, &result);
319 expect(Ok, stat);
320 ok(result == 2048, "Expected 2048, got %d\n", result);
321 result = 0;
322 stat = GdipGetCellAscent(FontFamily, FontStyleRegular, &result);
323 expect(Ok, stat);
324 ok(result == 1825, "Expected 1825, got %d\n", result);
325 result = 0;
326 stat = GdipGetCellDescent(FontFamily, FontStyleRegular, &result);
327 expect(Ok, stat);
328 ok(result == 443, "Expected 443 got %d\n", result);
329 GdipDeleteFontFamily(FontFamily);
333 static void check_family(const char* context, GpFontFamily *family, WCHAR *name)
335 GpStatus stat;
336 GpFont* font;
338 *name = 0;
339 stat = GdipGetFamilyName(family, name, LANG_NEUTRAL);
340 ok(stat == Ok, "could not get the %s family name: %.8x\n", context, stat);
342 stat = GdipCreateFont(family, 12, FontStyleRegular, UnitPixel, &font);
343 ok(stat == Ok, "could not create a font for the %s family: %.8x\n", context, stat);
344 if (stat == Ok)
346 stat = GdipDeleteFont(font);
347 ok(stat == Ok, "could not delete the %s family font: %.8x\n", context, stat);
350 stat = GdipDeleteFontFamily(family);
351 ok(stat == Ok, "could not delete the %s family: %.8x\n", context, stat);
354 static void test_getgenerics (void)
356 GpStatus stat;
357 GpFontFamily *family;
358 WCHAR sansname[LF_FACESIZE], serifname[LF_FACESIZE], mononame[LF_FACESIZE];
359 int missingfonts = 0;
361 stat = GdipGetGenericFontFamilySansSerif(&family);
362 expect (Ok, stat);
363 if (stat == FontFamilyNotFound)
364 missingfonts = 1;
365 else
366 check_family("Sans Serif", family, sansname);
368 stat = GdipGetGenericFontFamilySerif(&family);
369 expect (Ok, stat);
370 if (stat == FontFamilyNotFound)
371 missingfonts = 1;
372 else
373 check_family("Serif", family, serifname);
375 stat = GdipGetGenericFontFamilyMonospace(&family);
376 expect (Ok, stat);
377 if (stat == FontFamilyNotFound)
378 missingfonts = 1;
379 else
380 check_family("Monospace", family, mononame);
382 if (missingfonts && strcmp(winetest_platform, "wine") == 0)
383 trace("You may need to install either the Microsoft Web Fonts or the Liberation Fonts\n");
385 /* Check that the family names are all different */
386 ok(lstrcmpiW(sansname, serifname) != 0, "Sans Serif and Serif families should be different: %s\n", wine_dbgstr_w(sansname));
387 ok(lstrcmpiW(sansname, mononame) != 0, "Sans Serif and Monospace families should be different: %s\n", wine_dbgstr_w(sansname));
388 ok(lstrcmpiW(serifname, mononame) != 0, "Serif and Monospace families should be different: %s\n", wine_dbgstr_w(serifname));
391 static void test_installedfonts (void)
393 GpStatus stat;
394 GpFontCollection* collection=NULL;
396 stat = GdipNewInstalledFontCollection(NULL);
397 expect (InvalidParameter, stat);
399 stat = GdipNewInstalledFontCollection(&collection);
400 expect (Ok, stat);
401 ok (collection != NULL, "got NULL font collection\n");
404 static void test_heightgivendpi(void)
406 GpStatus stat;
407 GpFont* font = NULL;
408 GpFontFamily* fontfamily = NULL;
409 REAL height;
410 Unit unit;
412 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &fontfamily);
413 expect(Ok, stat);
415 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPixel, &font);
416 expect(Ok, stat);
418 stat = GdipGetFontHeightGivenDPI(NULL, 96, &height);
419 expect(InvalidParameter, stat);
421 stat = GdipGetFontHeightGivenDPI(font, 96, NULL);
422 expect(InvalidParameter, stat);
424 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
425 expect(Ok, stat);
426 expectf(36.210938, height);
427 GdipDeleteFont(font);
429 height = 12345;
430 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitWorld, &font);
431 expect(Ok, stat);
433 stat = GdipGetFontUnit(font, &unit);
434 expect(Ok, stat);
435 expect(UnitWorld, unit);
437 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
438 expect(Ok, stat);
439 expectf(36.210938, height);
440 GdipDeleteFont(font);
442 height = 12345;
443 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPoint, &font);
444 expect(Ok, stat);
445 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
446 expect(Ok, stat);
447 expectf(48.281250, height);
448 GdipDeleteFont(font);
450 height = 12345;
451 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitInch, &font);
452 expect(Ok, stat);
454 stat = GdipGetFontUnit(font, &unit);
455 expect(Ok, stat);
456 expect(UnitInch, unit);
458 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
459 expect(Ok, stat);
460 expectf(3476.250000, height);
461 GdipDeleteFont(font);
463 height = 12345;
464 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitDocument, &font);
465 expect(Ok, stat);
467 stat = GdipGetFontUnit(font, &unit);
468 expect(Ok, stat);
469 expect(UnitDocument, unit);
471 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
472 expect(Ok, stat);
473 expectf(11.587500, height);
474 GdipDeleteFont(font);
476 height = 12345;
477 stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitMillimeter, &font);
478 expect(Ok, stat);
480 stat = GdipGetFontUnit(font, &unit);
481 expect(Ok, stat);
482 expect(UnitMillimeter, unit);
484 stat = GdipGetFontHeightGivenDPI(font, 96, &height);
485 expect(Ok, stat);
486 expectf(136.860245, height);
487 GdipDeleteFont(font);
489 GdipDeleteFontFamily(fontfamily);
492 static int CALLBACK font_enum_proc(const LOGFONTW *lfe, const TEXTMETRICW *ntme,
493 DWORD type, LPARAM lparam)
495 NEWTEXTMETRICW *ntm = (NEWTEXTMETRICW *)lparam;
497 if (type != TRUETYPE_FONTTYPE) return 1;
499 *ntm = *(NEWTEXTMETRICW *)ntme;
500 return 0;
503 struct font_metrics
505 UINT16 em_height, line_spacing, ascent, descent;
506 REAL font_height, font_size;
507 INT lfHeight;
510 static void gdi_get_font_metrics(LOGFONTW *lf, struct font_metrics *fm)
512 HDC hdc;
513 HFONT hfont;
514 NEWTEXTMETRICW ntm;
515 OUTLINETEXTMETRICW otm;
516 int ret;
518 hdc = CreateCompatibleDC(0);
520 /* it's the only way to get extended NEWTEXTMETRIC fields */
521 ret = EnumFontFamiliesExW(hdc, lf, font_enum_proc, (LPARAM)&ntm, 0);
522 ok(!ret, "EnumFontFamiliesExW failed to find %s\n", wine_dbgstr_w(lf->lfFaceName));
524 hfont = CreateFontIndirectW(lf);
525 SelectObject(hdc, hfont);
527 otm.otmSize = sizeof(otm);
528 ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
529 ok(ret, "GetOutlineTextMetrics failed\n");
531 DeleteDC(hdc);
532 DeleteObject(hfont);
534 fm->lfHeight = -otm.otmTextMetrics.tmAscent;
535 fm->line_spacing = ntm.ntmCellHeight;
536 fm->font_size = (REAL)otm.otmTextMetrics.tmAscent;
537 fm->font_height = (REAL)fm->line_spacing * fm->font_size / (REAL)ntm.ntmSizeEM;
538 fm->em_height = ntm.ntmSizeEM;
539 fm->ascent = ntm.ntmSizeEM;
540 fm->descent = ntm.ntmCellHeight - ntm.ntmSizeEM;
543 static void gdip_get_font_metrics(GpFont *font, struct font_metrics *fm)
545 INT style;
546 GpFontFamily *family;
547 GpStatus stat;
549 stat = GdipGetFontStyle(font, &style);
550 expect(Ok, stat);
552 stat = GdipGetFontHeight(font, NULL, &fm->font_height);
553 expect(Ok, stat);
554 stat = GdipGetFontSize(font, &fm->font_size);
555 expect(Ok, stat);
557 fm->lfHeight = (INT)(fm->font_size * -1.0);
559 stat = GdipGetFamily(font, &family);
560 expect(Ok, stat);
562 stat = GdipGetEmHeight(family, style, &fm->em_height);
563 expect(Ok, stat);
564 stat = GdipGetLineSpacing(family, style, &fm->line_spacing);
565 expect(Ok, stat);
566 stat = GdipGetCellAscent(family, style, &fm->ascent);
567 expect(Ok, stat);
568 stat = GdipGetCellDescent(family, style, &fm->descent);
569 expect(Ok, stat);
571 GdipDeleteFontFamily(family);
574 static void cmp_font_metrics(struct font_metrics *fm1, struct font_metrics *fm2, int line)
576 ok_(__FILE__, line)(fm1->lfHeight == fm2->lfHeight, "lfHeight %d != %d\n", fm1->lfHeight, fm2->lfHeight);
577 ok_(__FILE__, line)(fm1->em_height == fm2->em_height, "em_height %u != %u\n", fm1->em_height, fm2->em_height);
578 ok_(__FILE__, line)(fm1->line_spacing == fm2->line_spacing, "line_spacing %u != %u\n", fm1->line_spacing, fm2->line_spacing);
579 ok_(__FILE__, line)(abs(fm1->ascent - fm2->ascent) <= 1, "ascent %u != %u\n", fm1->ascent, fm2->ascent);
580 ok_(__FILE__, line)(abs(fm1->descent - fm2->descent) <= 1, "descent %u != %u\n", fm1->descent, fm2->descent);
581 ok(fm1->font_height > 0.0, "fm1->font_height should be positive, got %f\n", fm1->font_height);
582 ok(fm2->font_height > 0.0, "fm2->font_height should be positive, got %f\n", fm2->font_height);
583 ok_(__FILE__, line)(fm1->font_height == fm2->font_height, "font_height %f != %f\n", fm1->font_height, fm2->font_height);
584 ok(fm1->font_size > 0.0, "fm1->font_size should be positive, got %f\n", fm1->font_size);
585 ok(fm2->font_size > 0.0, "fm2->font_size should be positive, got %f\n", fm2->font_size);
586 ok_(__FILE__, line)(fm1->font_size == fm2->font_size, "font_size %f != %f\n", fm1->font_size, fm2->font_size);
589 static void test_font_metrics(void)
591 LOGFONTW lf;
592 GpFont *font;
593 GpFontFamily *family;
594 GpGraphics *graphics;
595 GpStatus stat;
596 Unit unit;
597 struct font_metrics fm_gdi, fm_gdip;
598 HDC hdc;
600 hdc = CreateCompatibleDC(0);
601 stat = GdipCreateFromHDC(hdc, &graphics);
602 expect(Ok, stat);
604 memset(&lf, 0, sizeof(lf));
606 /* Tahoma,-13 */
607 lstrcpyW(lf.lfFaceName, Tahoma);
608 lf.lfHeight = -13;
609 stat = GdipCreateFontFromLogfontW(hdc, &lf, &font);
610 expect(Ok, stat);
612 stat = GdipGetFontUnit(font, &unit);
613 expect(Ok, stat);
614 expect(UnitWorld, unit);
616 gdip_get_font_metrics(font, &fm_gdip);
617 trace("gdiplus:\n");
618 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
619 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
620 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
621 fm_gdip.font_height, fm_gdip.font_size);
623 gdi_get_font_metrics(&lf, &fm_gdi);
624 trace("gdi:\n");
625 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
626 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
627 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
628 fm_gdi.font_height, fm_gdi.font_size);
630 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
632 stat = GdipGetLogFontW(font, graphics, &lf);
633 expect(Ok, stat);
634 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
635 gdi_get_font_metrics(&lf, &fm_gdi);
636 trace("gdi:\n");
637 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
638 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
639 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
640 fm_gdi.font_height, fm_gdi.font_size);
641 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
643 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
645 GdipDeleteFont(font);
647 /* Tahoma,13 */
648 lstrcpyW(lf.lfFaceName, Tahoma);
649 lf.lfHeight = 13;
650 stat = GdipCreateFontFromLogfontW(hdc, &lf, &font);
651 expect(Ok, stat);
653 stat = GdipGetFontUnit(font, &unit);
654 expect(Ok, stat);
655 expect(UnitWorld, unit);
657 gdip_get_font_metrics(font, &fm_gdip);
658 trace("gdiplus:\n");
659 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
660 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
661 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
662 fm_gdip.font_height, fm_gdip.font_size);
664 gdi_get_font_metrics(&lf, &fm_gdi);
665 trace("gdi:\n");
666 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
667 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
668 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
669 fm_gdi.font_height, fm_gdi.font_size);
671 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
673 stat = GdipGetLogFontW(font, graphics, &lf);
674 expect(Ok, stat);
675 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
676 gdi_get_font_metrics(&lf, &fm_gdi);
677 trace("gdi:\n");
678 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
679 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
680 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
681 fm_gdi.font_height, fm_gdi.font_size);
682 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
684 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
686 GdipDeleteFont(font);
688 stat = GdipCreateFontFamilyFromName(Tahoma, NULL, &family);
689 expect(Ok, stat);
691 /* Tahoma,13 */
692 stat = GdipCreateFont(family, 13.0, FontStyleRegular, UnitPixel, &font);
693 expect(Ok, stat);
695 gdip_get_font_metrics(font, &fm_gdip);
696 trace("gdiplus:\n");
697 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
698 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
699 fm_gdip.em_height, fm_gdip.line_spacing, fm_gdip.ascent, fm_gdip.descent,
700 fm_gdip.font_height, fm_gdip.font_size);
702 stat = GdipGetLogFontW(font, graphics, &lf);
703 expect(Ok, stat);
704 ok(lf.lfHeight < 0, "lf.lfHeight should be negative, got %d\n", lf.lfHeight);
705 gdi_get_font_metrics(&lf, &fm_gdi);
706 trace("gdi:\n");
707 trace("%s,%d: EmHeight %u, LineSpacing %u, CellAscent %u, CellDescent %u, FontHeight %f, FontSize %f\n",
708 wine_dbgstr_w(lf.lfFaceName), lf.lfHeight,
709 fm_gdi.em_height, fm_gdi.line_spacing, fm_gdi.ascent, fm_gdi.descent,
710 fm_gdi.font_height, fm_gdi.font_size);
711 ok((REAL)lf.lfHeight * -1.0 == fm_gdi.font_size, "expected %f, got %f\n", (REAL)lf.lfHeight * -1.0, fm_gdi.font_size);
713 cmp_font_metrics(&fm_gdip, &fm_gdi, __LINE__);
715 stat = GdipGetLogFontW(font, NULL, &lf);
716 expect(InvalidParameter, stat);
718 GdipDeleteFont(font);
720 stat = GdipCreateFont(family, -13.0, FontStyleRegular, UnitPixel, &font);
721 expect(InvalidParameter, stat);
723 GdipDeleteFontFamily(family);
725 GdipDeleteGraphics(graphics);
726 DeleteDC(hdc);
729 static void test_font_substitution(void)
731 WCHAR ms_shell_dlg[LF_FACESIZE];
732 HDC hdc;
733 HFONT hfont;
734 LOGFONT lf;
735 GpStatus status;
736 GpGraphics *graphics;
737 GpFont *font;
738 GpFontFamily *family;
739 int ret;
741 hdc = CreateCompatibleDC(0);
742 status = GdipCreateFromHDC(hdc, &graphics);
743 expect(Ok, status);
745 hfont = GetStockObject(DEFAULT_GUI_FONT);
746 ok(hfont != 0, "GetStockObject(DEFAULT_GUI_FONT) failed\n");
748 memset(&lf, 0xfe, sizeof(lf));
749 ret = GetObject(hfont, sizeof(lf), &lf);
750 ok(ret == sizeof(lf), "GetObject failed\n");
751 ok(!lstrcmp(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
752 MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, -1, ms_shell_dlg, LF_FACESIZE);
754 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
755 expect(Ok, status);
756 memset(&lf, 0xfe, sizeof(lf));
757 status = GdipGetLogFontA(font, graphics, &lf);
758 expect(Ok, status);
759 ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
760 !lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
761 GdipDeleteFont(font);
763 status = GdipCreateFontFamilyFromName(ms_shell_dlg, NULL, &family);
764 expect(Ok, status);
765 status = GdipCreateFont(family, 12, FontStyleRegular, UnitPoint, &font);
766 expect(Ok, status);
767 memset(&lf, 0xfe, sizeof(lf));
768 status = GdipGetLogFontA(font, graphics, &lf);
769 expect(Ok, status);
770 ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
771 !lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
772 GdipDeleteFont(font);
773 GdipDeleteFontFamily(family);
775 status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family);
776 ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
778 lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
779 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
780 expect(Ok, status);
781 memset(&lf, 0xfe, sizeof(lf));
782 status = GdipGetLogFontA(font, graphics, &lf);
783 expect(Ok, status);
784 ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
785 GdipDeleteFont(font);
787 /* empty FaceName */
788 lf.lfFaceName[0] = 0;
789 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
790 expect(Ok, status);
791 memset(&lf, 0xfe, sizeof(lf));
792 status = GdipGetLogFontA(font, graphics, &lf);
793 expect(Ok, status);
794 ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
795 GdipDeleteFont(font);
797 /* zeroing out lfWeight and lfCharSet leads to font creation failure */
798 lf.lfWeight = 0;
799 lf.lfCharSet = 0;
800 lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
801 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
802 todo_wine
803 ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
804 "expected NotTrueTypeFont, got %d\n", status);
806 /* empty FaceName */
807 lf.lfFaceName[0] = 0;
808 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
809 todo_wine
810 ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
811 "expected NotTrueTypeFont, got %d\n", status);
813 GdipDeleteGraphics(graphics);
814 DeleteDC(hdc);
817 static void test_font_transform(void)
819 static const WCHAR string[] = { 'A',0 };
820 GpStatus status;
821 HDC hdc;
822 LOGFONT lf;
823 GpFont *font;
824 GpGraphics *graphics;
825 GpMatrix *matrix;
826 GpStringFormat *format, *typographic;
827 PointF pos[1] = { { 0,0 } };
828 REAL height, margin_y;
829 RectF bounds, rect;
831 hdc = CreateCompatibleDC(0);
832 status = GdipCreateFromHDC(hdc, &graphics);
833 expect(Ok, status);
835 status = GdipSetPageUnit(graphics, UnitPixel);
836 expect(Ok, status);
838 status = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
839 expect(Ok, status);
840 status = GdipStringFormatGetGenericTypographic(&typographic);
841 expect(Ok, status);
843 memset(&lf, 0, sizeof(lf));
844 lstrcpy(lf.lfFaceName, "Tahoma");
845 lf.lfHeight = -100;
846 lf.lfWidth = 100;
847 status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
848 expect(Ok, status);
850 margin_y = 100.0 / 8.0;
852 /* identity matrix */
853 status = GdipCreateMatrix(&matrix);
854 expect(Ok, status);
855 status = GdipSetWorldTransform(graphics, matrix);
856 expect(Ok, status);
857 status = GdipGetLogFontA(font, graphics, &lf);
858 expect(Ok, status);
859 expect(-100, lf.lfHeight);
860 expect(0, lf.lfWidth);
861 expect(0, lf.lfEscapement);
862 expect(0, lf.lfOrientation);
863 status = GdipGetFontHeight(font, graphics, &height);
864 expect(Ok, status);
865 expectf(120.703125, height);
866 set_rect_empty(&rect);
867 set_rect_empty(&bounds);
868 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
869 expect(Ok, status);
870 expectf(0.0, bounds.X);
871 expectf(0.0, bounds.Y);
872 todo_wine
873 expectf(height + margin_y, bounds.Height);
874 set_rect_empty(&rect);
875 set_rect_empty(&bounds);
876 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
877 expect(Ok, status);
878 expectf(0.0, bounds.X);
879 expectf(0.0, bounds.Y);
880 expectf_(height, bounds.Height, 1.0);
881 set_rect_empty(&bounds);
882 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
883 DriverStringOptionsCmapLookup, NULL, &bounds);
884 expect(Ok, status);
885 expectf(0.0, bounds.X);
886 expectf_(-100.0, bounds.Y, 0.05);
887 expectf_(height, bounds.Height, 0.5);
888 set_rect_empty(&bounds);
889 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
890 DriverStringOptionsCmapLookup, matrix, &bounds);
891 expect(Ok, status);
892 expectf(0.0, bounds.X);
893 expectf_(-100.0, bounds.Y, 0.05);
894 expectf_(height, bounds.Height, 0.5);
896 /* scale matrix */
897 status = GdipScaleMatrix(matrix, 2.0, 3.0, MatrixOrderAppend);
898 expect(Ok, status);
899 status = GdipSetWorldTransform(graphics, matrix);
900 expect(Ok, status);
901 status = GdipGetLogFontA(font, graphics, &lf);
902 expect(Ok, status);
903 expect(-300, lf.lfHeight);
904 expect(0, lf.lfWidth);
905 expect(0, lf.lfEscapement);
906 expect(0, lf.lfOrientation);
907 status = GdipGetFontHeight(font, graphics, &height);
908 expect(Ok, status);
909 expectf(120.703125, height);
910 set_rect_empty(&rect);
911 set_rect_empty(&bounds);
912 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
913 expect(Ok, status);
914 expectf(0.0, bounds.X);
915 expectf(0.0, bounds.Y);
916 todo_wine
917 expectf(height + margin_y, bounds.Height);
918 set_rect_empty(&rect);
919 set_rect_empty(&bounds);
920 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
921 expect(Ok, status);
922 expectf(0.0, bounds.X);
923 expectf(0.0, bounds.Y);
924 expectf_(height, bounds.Height, 0.05);
925 set_rect_empty(&bounds);
926 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
927 DriverStringOptionsCmapLookup, NULL, &bounds);
928 expect(Ok, status);
929 expectf(0.0, bounds.X);
930 expectf_(-100.0, bounds.Y, 0.05);
931 expectf_(height, bounds.Height, 0.2);
932 set_rect_empty(&bounds);
933 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
934 DriverStringOptionsCmapLookup, matrix, &bounds);
935 expect(Ok, status);
936 expectf(0.0, bounds.X);
937 todo_wine
938 expectf_(-300.0, bounds.Y, 0.15);
939 todo_wine
940 expectf(height * 3.0, bounds.Height);
942 /* scale + ratate matrix */
943 status = GdipRotateMatrix(matrix, 45.0, MatrixOrderAppend);
944 expect(Ok, status);
945 status = GdipSetWorldTransform(graphics, matrix);
946 expect(Ok, status);
947 status = GdipGetLogFontA(font, graphics, &lf);
948 expect(Ok, status);
949 expect(-300, lf.lfHeight);
950 expect(0, lf.lfWidth);
951 expect_(3151, lf.lfEscapement, 1);
952 expect_(3151, lf.lfOrientation, 1);
953 status = GdipGetFontHeight(font, graphics, &height);
954 expect(Ok, status);
955 expectf(120.703125, height);
956 set_rect_empty(&rect);
957 set_rect_empty(&bounds);
958 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
959 expect(Ok, status);
960 expectf(0.0, bounds.X);
961 expectf(0.0, bounds.Y);
962 todo_wine
963 expectf(height + margin_y, bounds.Height);
964 set_rect_empty(&rect);
965 set_rect_empty(&bounds);
966 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
967 expect(Ok, status);
968 expectf(0.0, bounds.X);
969 expectf(0.0, bounds.Y);
970 expectf_(height, bounds.Height, 0.05);
971 set_rect_empty(&bounds);
972 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
973 DriverStringOptionsCmapLookup, NULL, &bounds);
974 expect(Ok, status);
975 expectf(0.0, bounds.X);
976 expectf_(-100.0, bounds.Y, 0.05);
977 expectf_(height, bounds.Height, 0.2);
978 set_rect_empty(&bounds);
979 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
980 DriverStringOptionsCmapLookup, matrix, &bounds);
981 expect(Ok, status);
982 todo_wine
983 expectf_(-43.814377, bounds.X, 0.05);
984 todo_wine
985 expectf_(-212.235611, bounds.Y, 0.05);
986 todo_wine
987 expectf_(340.847534, bounds.Height, 0.05);
989 /* scale + ratate + shear matrix */
990 status = GdipShearMatrix(matrix, 4.0, 5.0, MatrixOrderAppend);
991 expect(Ok, status);
992 status = GdipSetWorldTransform(graphics, matrix);
993 expect(Ok, status);
994 status = GdipGetLogFontA(font, graphics, &lf);
995 expect(Ok, status);
996 todo_wine
997 expect(1032, lf.lfHeight);
998 expect(0, lf.lfWidth);
999 expect_(3099, lf.lfEscapement, 1);
1000 expect_(3099, lf.lfOrientation, 1);
1001 status = GdipGetFontHeight(font, graphics, &height);
1002 expect(Ok, status);
1003 expectf(120.703125, height);
1004 set_rect_empty(&rect);
1005 set_rect_empty(&bounds);
1006 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1007 expect(Ok, status);
1008 expectf(0.0, bounds.X);
1009 expectf(0.0, bounds.Y);
1010 todo_wine
1011 expectf(height + margin_y, bounds.Height);
1012 set_rect_empty(&rect);
1013 set_rect_empty(&bounds);
1014 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1015 expect(Ok, status);
1016 expectf(0.0, bounds.X);
1017 expectf(0.0, bounds.Y);
1018 expectf_(height, bounds.Height, 0.2);
1019 set_rect_empty(&bounds);
1020 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1021 DriverStringOptionsCmapLookup, NULL, &bounds);
1022 expect(Ok, status);
1023 expectf(0.0, bounds.X);
1024 expectf_(-100.0, bounds.Y, 0.2);
1025 expectf_(height, bounds.Height, 0.2);
1026 set_rect_empty(&bounds);
1027 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1028 DriverStringOptionsCmapLookup, matrix, &bounds);
1029 expect(Ok, status);
1030 todo_wine
1031 expectf_(-636.706848, bounds.X, 0.05);
1032 todo_wine
1033 expectf_(-175.257523, bounds.Y, 0.05);
1034 todo_wine
1035 expectf_(1532.984985, bounds.Height, 0.05);
1037 /* scale + ratate + shear + translate matrix */
1038 status = GdipTranslateMatrix(matrix, 10.0, 20.0, MatrixOrderAppend);
1039 expect(Ok, status);
1040 status = GdipSetWorldTransform(graphics, matrix);
1041 expect(Ok, status);
1042 status = GdipGetLogFontA(font, graphics, &lf);
1043 expect(Ok, status);
1044 todo_wine
1045 expect(1032, lf.lfHeight);
1046 expect(0, lf.lfWidth);
1047 expect_(3099, lf.lfEscapement, 1);
1048 expect_(3099, lf.lfOrientation, 1);
1049 status = GdipGetFontHeight(font, graphics, &height);
1050 expect(Ok, status);
1051 expectf(120.703125, height);
1052 set_rect_empty(&rect);
1053 set_rect_empty(&bounds);
1054 status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, NULL, NULL);
1055 expect(Ok, status);
1056 expectf(0.0, bounds.X);
1057 expectf(0.0, bounds.Y);
1058 todo_wine
1059 expectf(height + margin_y, bounds.Height);
1060 set_rect_empty(&rect);
1061 set_rect_empty(&bounds);
1062 status = GdipMeasureString(graphics, string, -1, font, &rect, typographic, &bounds, NULL, NULL);
1063 expect(Ok, status);
1064 expectf(0.0, bounds.X);
1065 expectf(0.0, bounds.Y);
1066 expectf_(height, bounds.Height, 0.1);
1067 set_rect_empty(&bounds);
1068 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1069 DriverStringOptionsCmapLookup, NULL, &bounds);
1070 expect(Ok, status);
1071 expectf(0.0, bounds.X);
1072 expectf_(-100.0, bounds.Y, 0.2);
1073 expectf_(height, bounds.Height, 0.2);
1074 set_rect_empty(&bounds);
1075 status = GdipMeasureDriverString(graphics, (const UINT16 *)string, -1, font, pos,
1076 DriverStringOptionsCmapLookup, matrix, &bounds);
1077 expect(Ok, status);
1078 todo_wine
1079 expectf_(-626.706848, bounds.X, 0.05);
1080 todo_wine
1081 expectf_(-155.257523, bounds.Y, 0.05);
1082 todo_wine
1083 expectf_(1532.984985, bounds.Height, 0.05);
1085 GdipDeleteMatrix(matrix);
1086 GdipDeleteFont(font);
1087 GdipDeleteGraphics(graphics);
1088 GdipDeleteStringFormat(typographic);
1089 GdipDeleteStringFormat(format);
1090 DeleteDC(hdc);
1093 START_TEST(font)
1095 struct GdiplusStartupInput gdiplusStartupInput;
1096 ULONG_PTR gdiplusToken;
1098 gdiplusStartupInput.GdiplusVersion = 1;
1099 gdiplusStartupInput.DebugEventCallback = NULL;
1100 gdiplusStartupInput.SuppressBackgroundThread = 0;
1101 gdiplusStartupInput.SuppressExternalCodecs = 0;
1103 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1105 test_font_transform();
1106 test_font_substitution();
1107 test_font_metrics();
1108 test_createfont();
1109 test_logfont();
1110 test_fontfamily();
1111 test_fontfamily_properties();
1112 test_getgenerics();
1113 test_installedfonts();
1114 test_heightgivendpi();
1116 GdiplusShutdown(gdiplusToken);