From 40b195d0f9ee7ef1b917a635bb073fa108b2ed40 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 25 Apr 2014 13:12:20 +0200 Subject: Fix font fallback handling with Harfbuzz and CoreText Comparing CGFontRefs is not reliable it seems, CFEqual on them appears to compare pointers and there's no guarantee that CTFontCopyGraphicsFont returns the same pointer all the time. So instead let's compare CTFontRefs, which we keep around and also provide as input to CoreText shaping. Task-number: 38363 Change-Id: I6073ea88f0c9f5ebf49d17cba0d76041ade32570 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Konstantin Ritt --- src/3rdparty/harfbuzz-ng/src/hb-coretext.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc index 4a905ee189..4fef861acc 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc @@ -690,13 +690,10 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, */ CFDictionaryRef attributes = CTRunGetAttributes (run); CTFontRef run_ct_font = static_cast(CFDictionaryGetValue (attributes, kCTFontAttributeName)); - CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0); CFRange range = CTRunGetStringRange (run); - if (!CFEqual (run_cg_font, face_data->cg_font)) + if (!CFEqual (run_ct_font, font_data->ct_font)) { - CFRelease (run_cg_font); - buffer->ensure (buffer->len + range.length); if (buffer->in_error) FAIL ("Buffer resize failed"); @@ -731,7 +728,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, } continue; } - CFRelease (run_cg_font); /* CoreText throws away the PDF token, while the OpenType backend will add a zero-advance * glyph for this. We need to make sure the two produce the same output. */ -- cgit v1.2.3