[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Jan 7 10:51:55 PST 2015
src/sample.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
New commits:
commit 238d6a38f2ceb7d8dceec9365a823f032b3b9f7d
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Jan 7 10:51:44 2015 -0800
[bindings] Update sample.py
diff --git a/src/sample.py b/src/sample.py
index 86ab8a3..1ed593b 100755
--- a/src/sample.py
+++ b/src/sample.py
@@ -19,6 +19,7 @@ def tounicode(s, encoding='utf-8'):
return s
fontdata = open (sys.argv[1], 'rb').read ()
+text = tounicode(sys.argv[2])
blob = hb.glib_blob_create (GLib.Bytes.new (fontdata))
face = hb.face_create (blob, 0)
del blob
@@ -30,7 +31,7 @@ hb.font_set_scale (font, upem, upem)
hb.ot_font_set_funcs (font)
buf = hb.buffer_create ()
-hb.buffer_add_utf8 (buf, tounicode("Hello بهداد").encode('utf-8'), 0, -1)
+hb.buffer_add_utf8 (buf, text.encode('utf-8'), 0, -1)
hb.buffer_guess_segment_properties (buf)
hb.shape (font, buf, [])
@@ -42,6 +43,8 @@ positions = hb.buffer_get_glyph_positions (buf)
for info,pos in zip(infos, positions):
gid = info.codepoint
cluster = info.cluster
- advance = pos.x_advance
+ x_advance = pos.x_advance
+ x_offset = pos.x_offset
+ y_offset = pos.y_offset
- print(gid, cluster, advance)
+ print("gid%d=%d@%d,%d+%d" % (gid, cluster, x_advance, x_offset, y_offset))
More information about the HarfBuzz
mailing list