[HarfBuzz] harfbuzz: Branch 'master' - 5 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Jun 30 16:41:35 UTC 2016
src/hb-coretext.cc | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
New commits:
commit 46809dee30232d493539519b1bb527fa816c37db
Merge: 70e72e5 1bea49e
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Jun 30 09:41:03 2016 -0700
Merge pull request #268 from drott/conflictingFontFix
Discard reconfigured CTFont if URL changes
commit 1bea49eb4b7a94ab6222f9c3c40320cbdb247b2d
Merge: 7aa3631 70e72e5
Author: Dominik Röttsches <d-r at roettsches.de>
Date: Wed Jun 29 12:10:41 2016 +0200
Merge branch 'master' into conflictingFontFix
commit 7aa3631dd06af74a1fa9f0bfaa5f721876be817f
Merge: f7da048 abae93f
Author: Dominik Röttsches <d-r at roettsches.de>
Date: Tue Jun 28 09:52:18 2016 +0200
Merge branch 'master' into conflictingFontFix
commit f7da0486ed8884481d477ce08fcf928c4da9a0a3
Merge: a022327 07461d0
Author: Dominik Röttsches <d-r at roettsches.de>
Date: Mon Jun 20 10:25:43 2016 +0300
Merge branch 'master' into conflictingFontFix
commit a0223274b97e82fe02730fd45729172511fec459
Author: Dominik Röttsches <drott at chromium.org>
Date: Thu Jun 16 14:19:39 2016 +0200
Discard reconfigured CTFont if URL changes
Fixes https://github.com/behdad/harfbuzz/issues/267
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index e64d265..98592af 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -145,6 +145,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
return NULL;
}
+ CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute);
/* Create font copy with cascade list that has LastResort first; this speeds up CoreText
* font fallback which we don't need anyway. */
@@ -154,14 +155,31 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
CFRelease (last_resort_font_desc);
if (new_ct_font)
{
- CFRelease (ct_font);
- ct_font = new_ct_font;
+ // The CTFontCreateCopyWithAttributes call fails to stay on the same font
+ // when reconfiguring the cascade list and may switch to a different font
+ // when there are fonts that go by the same name, since the descriptor is
+ // just name and size.
+
+ // Avoid reconfiguring the cascade lists if the new font is outside the
+ // system locations that we cannot access from the sandboxed renderer
+ // process in Blink. This can be detected by the new file URL location
+ // that the newly found font points to.
+ CFURLRef new_url = (CFURLRef)CTFontCopyAttribute(new_ct_font, kCTFontURLAttribute);
+ if (CFEqual(original_url, new_url)) {
+ CFRelease (ct_font);
+ ct_font = new_ct_font;
+ } else {
+ CFRelease(new_ct_font);
+ DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
+ }
+ CFRelease(new_url);
}
else
DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed");
}
- return ct_font;
+ CFRelease(original_url);
+ return ct_font;
}
struct hb_coretext_shaper_face_data_t {
More information about the HarfBuzz
mailing list