From 3109a86add936ae4cc77541fc026c4fe2db4e328 Mon Sep 17 00:00:00 2001 From: Martin Hosken Date: Mon, 24 May 2010 13:25:37 +0100 Subject: [PATCH] hb-graphite now no longer has -ve advances within clusters. Fix infinite loop in tag_to_script(). python fixed to use tag_to_script and allow hbtestfont to be passed font files, where fontconfig knows about them. --- contrib/python/lib/harfbuzz.pyx | 4 ++-- contrib/python/scripts/hbtestfont | 6 +++++- src/hb-graphite.cc | 4 ++-- src/hb-ot-tag.c | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/contrib/python/lib/harfbuzz.pyx b/contrib/python/lib/harfbuzz.pyx index 139d3ea..4d71ead 100644 --- a/contrib/python/lib/harfbuzz.pyx +++ b/contrib/python/lib/harfbuzz.pyx @@ -41,7 +41,7 @@ cdef extern from "hb-language.h" : char * hb_language_to_string(hb_language_t language) cdef extern from "hb-ot-tag.h" : - hb_script_t hb_ot_tag_to_script (char *sname) + hb_script_t hb_ot_tag_to_script (hb_tag_t tag) cdef extern from "hb-buffer.h" : ctypedef struct hb_buffer_t : @@ -141,7 +141,7 @@ cdef class buffer : cdef hb_script_t scriptnum language = hb_language_from_string(lang) - scriptnum = hb_ot_string_to_script(script) + scriptnum = hb_ot_tag_to_script(hb_tag_from_string(script)) hb_buffer_set_script(self.buffer, scriptnum) hb_buffer_set_language(self.buffer, language) diff --git a/contrib/python/scripts/hbtestfont b/contrib/python/scripts/hbtestfont index e3a63f5..7790fd3 100755 --- a/contrib/python/scripts/hbtestfont +++ b/contrib/python/scripts/hbtestfont @@ -20,7 +20,11 @@ p.add_option('-d', '--debug', action='store_true', help="Output trace info") p.add_option('--nogui', action='store_true', help="Don't display a gui") (opts, args) = p.parse_args() -fpat = opts.font + ":weight=" +if opts.font.lower().endswith(".ttf") : + fpat = ":file=" +else : + fpat = "" +fpat += opts.font + ":weight=" fpat += "bold" if opts.bold else "medium" fpat += ":slant=" fpat += "italic" if opts.italic else "roman" diff --git a/src/hb-graphite.cc b/src/hb-graphite.cc index 708757c..54a01fc 100644 --- a/src/hb-graphite.cc +++ b/src/hb-graphite.cc @@ -291,8 +291,8 @@ hb_graphite_shape (hb_font_t *font, pPosition->y_offset = iGlyph->yOffset() - curradvy; pPosition->x_advance = pPosition->x_offset + iGlyph->advanceWidth(); pPosition->y_advance = pPosition->y_offset + iGlyph->advanceHeight(); -// if (pPosition->x_advance < 0) -// pPosition->x_advance = 0; + if (pPosition->x_advance < 0 && iGlyph->logicalIndex() != iGlyph->attachedClusterBase()->logicalIndex()) + pPosition->x_advance = 0; curradvx += pPosition->x_advance; curradvy += pPosition->y_advance; // fprintf(stderr, "%d@(%f, %f)+(%f, %f)\n", iGlyph->glyphID(), iGlyph->origin(), iGlyph->yOffset(), iGlyph->advanceWidth(), iGlyph->advanceHeight()); diff --git a/src/hb-ot-tag.c b/src/hb-ot-tag.c index d1d42f5..12d2218 100644 --- a/src/hb-ot-tag.c +++ b/src/hb-ot-tag.c @@ -161,6 +161,7 @@ hb_ot_tag_to_script (hb_tag_t tag) while (*p) if (tag == *p) return i; + p++; } return HB_SCRIPT_UNKNOWN; -- 2.7.4