summaryrefslogtreecommitdiff
path: root/tests/test-layout.c
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2017-08-15 09:21:26 +0200
committerJohn Ralls <jralls@ceridwen.us>2017-08-15 09:26:36 +0200
commit8ab2cc198469b4a46b1536c4f5c5d3396a6444b4 (patch)
treee98ab683e7fb7afbf39fac6796bde905f14ca38a /tests/test-layout.c
parent599ffcf042bbca6f87edff0e241958523145294d (diff)
downloadpango-8ab2cc198469b4a46b1536c4f5c5d3396a6444b4.tar.gz
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
Diffstat (limited to 'tests/test-layout.c')
-rw-r--r--tests/test-layout.c11
1 files changed, 10 insertions, 1 deletions
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 <unistd.h>
#endif
+#include "config.h"
#include <pango/pangocairo.h>
#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);