From 8ab2cc198469b4a46b1536c4f5c5d3396a6444b4 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 15 Aug 2017 09:21:26 +0200 Subject: CoreText: Remove absolute size and scaling to screen resolution. Cairo's CGFont backend already handles scaling fonts to the display resolution, so scaling to the screen screen resolution in Pango's CoreText backend generates double-sized text on a Retina display. The layout test depended on providing a (bogus) resolution of 96DPI and scaling the font to it in order to obtain the "expected" layout results. This is replaced by adjusting the font size in test-layout.c if Pango is compiled for CoreText. https://bugzilla.gnome.org/show_bug.cgi?id=782393 --- tests/test-layout.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/test-layout.c') diff --git a/tests/test-layout.c b/tests/test-layout.c index 0a6a2c16..07ca6909 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -27,6 +27,7 @@ #include #endif +#include "config.h" #include #include "test-common.h" @@ -264,8 +265,16 @@ test_file (const gchar *filename, GString *string) parse_params (contents, &width, &ellipsize_at, &ellipsize, &wrap); layout = pango_layout_new (context); - +/* The layout tests are predicated on scaling fonts to 90 DPI, but + * Apple's font APIs (CoreText and CoreGraphics) don't work that way + * so we have to use a bigger font to get the results to agree with + * the expected values. + */ +#if defined (HAVE_CORE_TEXT) && defined (HAVE_CAIRO_QUARTZ) + desc = pango_font_description_from_string ("Cantarell 14.5"); +#else desc = pango_font_description_from_string ("Cantarell 11"); +#endif pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); -- cgit v1.2.1