src/hb-coretext.cc | 18 +++++++++--------- src/sample.py | 22 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 10 deletions(-)
New commits: commit d3e2a06b0f2587e913a9c3ff1a20c187f260db80 Author: Behdad Esfahbod <beh...@behdad.org> Date: Thu Jun 30 11:01:22 2016 -0700 [python] Use utf-32 / utf-16 based on build of Python Fixes https://github.com/behdad/harfbuzz/pull/271 diff --git a/src/sample.py b/src/sample.py index 19a4fdc..c2cb94d 100755 --- a/src/sample.py +++ b/src/sample.py @@ -3,6 +3,7 @@ from __future__ import print_function import sys +import array from gi.repository import HarfBuzz as hb from gi.repository import GLib @@ -39,7 +40,26 @@ class Debugger(object): return True debugger = Debugger() hb.buffer_set_message_func (buf, debugger.message, 1, 0) -hb.buffer_add_utf8 (buf, text.encode('utf-8'), 0, -1) + +## +## Add text to buffer +## +# +# See https://github.com/behdad/harfbuzz/pull/271 +# +if False: + # If you do not care about cluster values reflecting Python + # string indices, then this is quickest way to add text to + # buffer: + hb.buffer_add_utf8 (buf, text.encode('utf-8'), 0, -1) + # Otherwise, then following handles both narrow and wide + # Python builds: +elif sys.maxunicode == 0x10FFFF: + hb.buffer_add_utf32 (buf, array.array('I', text.encode('utf-32')), 0, -1) +else: + hb.buffer_add_utf16 (buf, array.array('H', text.encode('utf-16')), 0, -1) + + hb.buffer_guess_segment_properties (buf) hb.shape (font, buf, []) commit fc9de44a03a97f6e93bd98d804596cb1f9f4b5fd Author: Behdad Esfahbod <beh...@behdad.org> Date: Thu Jun 30 09:46:52 2016 -0700 Comments diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 98592af..db6d2aa 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -155,15 +155,15 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) CFRelease (last_resort_font_desc); if (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. + /* 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); _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz