Bug 1390317 - Don't try to use the mozilla-specific cairo extension from bug 1377257 if we're building with system cairo. r=jrmuizel
authorJonathan Kew <jkew@mozilla.com>
Wed, 11 Oct 2017 22:12:42 +0100
changeset 428241 ff5a050f7eb78e857ad72b356b4b8d0aededbb5d
parent 428240 5fffd2b6a6c736e0faca4bc951ba4a98c694c04b
child 428242 2671b1108d73170d0ef06b15390e93d8a7138a27
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersjrmuizel
bugs1390317, 1377257
milestone58.0a1
Bug 1390317 - Don't try to use the mozilla-specific cairo extension from bug 1377257 if we're building with system cairo. r=jrmuizel
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -837,18 +837,26 @@ gfxFont::GetRoundOffsetsToPixels(DrawTar
   NS_ASSERTION(scaled_font, "null cairo scaled font should never be returned "
     "by cairo_get_scaled_font");
   if (!scaled_font) {
     result |= RoundingFlags::kRoundX; // default to the same as the fallback path below
     return result;
   }
 
   // Sometimes hint metrics gets set for us, most notably for printing.
+#ifdef MOZ_TREE_CAIRO
   cairo_hint_metrics_t hint_metrics =
     cairo_scaled_font_get_hint_metrics(scaled_font);
+#else
+  cairo_font_options_t* font_options = cairo_font_options_create();
+  cairo_scaled_font_get_font_options(scaled_font, font_options);
+  cairo_hint_metrics_t hint_metrics =
+    cairo_font_options_get_hint_metrics(font_options);
+  cairo_font_options_destroy(font_options);
+#endif
 
   switch (hint_metrics) {
   case CAIRO_HINT_METRICS_OFF:
     result &= ~RoundingFlags::kRoundY;
     return result;
   case CAIRO_HINT_METRICS_DEFAULT:
     // Here we mimic what cairo surface/font backends do.  Printing
     // surfaces have already been handled by hint_metrics.  The