[HarfBuzz] harfbuzz: Branch 'master' - 8 commits

Simon Hausmann hausmann at kemper.freedesktop.org
Mon Jan 19 13:18:47 PST 2009


 src/harfbuzz-hangul.c              |    2 ++
 src/harfbuzz-indic.cpp             |    2 ++
 src/harfbuzz-khmer.c               |    1 +
 src/harfbuzz-myanmar.c             |    5 +++--
 src/harfbuzz-shaper.cpp            |   10 +++++++---
 src/harfbuzz-tibetan.c             |    2 ++
 tests/linebreaking/harfbuzz-qt.cpp |   20 ++++++++++++++++++++
 tests/shaping/main.cpp             |    4 ++--
 8 files changed, 39 insertions(+), 7 deletions(-)

New commits:
commit f0138222885b29fab9de31f2cf3151b8eb32bd11
Author: Thiago Macieira <thiago.macieira at nokia.com>
Date:   Fri Jan 16 07:22:22 2009 -0500

    Fixes: Warning (overflow in conversion)
    
    We know this overflows, but make it explicit to the compiler we know
    what we're doing.
    
    Signed-off-by: Simon Hausmann <shausman at trolltech.com>

diff --git a/src/harfbuzz-myanmar.c b/src/harfbuzz-myanmar.c
index 9a5c90a..400242f 100644
--- a/src/harfbuzz-myanmar.c
+++ b/src/harfbuzz-myanmar.c
@@ -203,7 +203,7 @@ static int myanmar_nextSyllableBoundary(const HB_UChar16 *s, int start, int end,
         MymrCharClass charClass = getMyanmarCharClass(*uc);
         state = mymrStateTable[state][charClass & Mymr_CF_CLASS_MASK];
         if (pos == start)
-            *invalid = charClass & Mymr_CF_DOTTED_CIRCLE;
+            *invalid = (HB_Bool)(charClass & Mymr_CF_DOTTED_CIRCLE);
 
         MMDEBUG("state[%d]=%d class=%8x (uc=%4x)", pos - start, state, charClass, *uc);
 
commit 45c0caffb971bce0ae124b82161e52e5b66bfb29
Author: Thiago Macieira <thiago.macieira at nokia.com>
Date:   Wed Oct 22 14:29:18 2008 +0200

    Fixes: Avoid a load-time constructor
    
    I really, really don't understand why the compiler thought it had to
    generate a static initialisation for setting thai_attributes to 0...
    
    Signed-off-by: Simon Hausmann <shausman at trolltech.com>

diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index 71e9d92..5687650 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -583,7 +583,8 @@ HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item)
     return true;
 }
 
-static HB_AttributeFunction thai_attributes = 0;
+//static HB_AttributeFunction thai_attributes = 0;
+#define thai_attributes 0
 
 const HB_ScriptEngine HB_ScriptEngines[] = {
     // Common
commit 96377e13c4eef03aa8718952b873c0b0424480ab
Author: Simon Hausmann <shausman at trolltech.com>
Date:   Mon Sep 29 16:26:42 2008 +0200

    Fix crash in debug builds when rendering gothic text with recent fonts
    
    It may happen that text with surrogates is subject to kerning, in which case
    we go through the OpenType path. After glyph substitution we reconstruct the
    log clusters, but that code currently doesn't work with surrogates.
    Currently glyph substitution does not happen with surrogates, so disabling
    the logcluster recreation if we didn't do glyph substitution in the first place
    works around it.
    
    Signed-off-by: Simon Hausmann <shausman at trolltech.com>
    Signed-off-by: Lars Knoll <lars at trolltech.com>

diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index 8c5244f..71e9d92 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -1200,11 +1200,13 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
     }
     item->num_glyphs = face->buffer->in_length;
 
-    if (doLogClusters) {
+    if (doLogClusters && face->glyphs_substituted) {
         // we can't do this for indic, as we pass the stuf in syllables and it's easier to do it in the shaper.
         unsigned short *logClusters = item->log_clusters;
         int clusterStart = 0;
         int oldCi = 0;
+        // #### the reconstruction of the logclusters currently does not work if the original string
+        // contains surrogate pairs
         for (unsigned int i = 0; i < face->buffer->in_length; ++i) {
             int ci = face->buffer->in_string[i].cluster;
             //         DEBUG("   ci[%d] = %d mark=%d, cmb=%d, cs=%d",
commit cb3201541c3352fe1e89a96cbe16590e3c338e0e
Author: Thomas Zander <tzander at trolltech.com>
Date:   Thu Mar 27 16:03:50 2008 +0100

    Fix rendering of unknown fonts to have the correct width for each character.
    
    Provide correct fallback in the case there is no openType set.
    
    Signed-off-by: Simon Hausmann <shausman at trolltech.com>

diff --git a/src/harfbuzz-hangul.c b/src/harfbuzz-hangul.c
index 54ae8c1..cf4a16d 100644
--- a/src/harfbuzz-hangul.c
+++ b/src/harfbuzz-hangul.c
@@ -201,6 +201,8 @@ static HB_Bool hangul_shape_syllable(HB_ShaperItem *item, HB_Bool openType)
 
         if (!positioned)
             return FALSE;
+    } else {
+        HB_HeuristicPosition(item);
     }
 #endif
 
diff --git a/src/harfbuzz-indic.cpp b/src/harfbuzz-indic.cpp
index 221a14e..d18a3ee 100644
--- a/src/harfbuzz-indic.cpp
+++ b/src/harfbuzz-indic.cpp
@@ -1666,6 +1666,8 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv
             item->num_glyphs = j;
         }
 
+    } else {
+        HB_HeuristicPosition(item);
     }
 #endif // NO_OPENTYPE
     item->attributes[0].clusterStart = true;
diff --git a/src/harfbuzz-khmer.c b/src/harfbuzz-khmer.c
index fe06295..532801c 100644
--- a/src/harfbuzz-khmer.c
+++ b/src/harfbuzz-khmer.c
@@ -582,6 +582,7 @@ static HB_Bool khmer_shape_syllable(HB_Bool openType, HB_ShaperItem *item)
 #endif
     {
 	KHDEBUG("Not using openType");
+        HB_HeuristicPosition(item);
     }
 
     item->attributes[0].clusterStart = TRUE;
diff --git a/src/harfbuzz-myanmar.c b/src/harfbuzz-myanmar.c
index a8ba88a..9a5c90a 100644
--- a/src/harfbuzz-myanmar.c
+++ b/src/harfbuzz-myanmar.c
@@ -454,6 +454,7 @@ static HB_Bool myanmar_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_
 #endif
     {
 	MMDEBUG("Not using openType");
+        HB_HeuristicPosition(item);
     }
 
     item->attributes[0].clusterStart = TRUE;
diff --git a/src/harfbuzz-tibetan.c b/src/harfbuzz-tibetan.c
index c39aaac..0314e26 100644
--- a/src/harfbuzz-tibetan.c
+++ b/src/harfbuzz-tibetan.c
@@ -148,6 +148,8 @@ static HB_Bool tibetan_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_
         HB_OpenTypeShape(item, /*properties*/0);
         if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE))
             return FALSE;
+    } else {
+        HB_HeuristicPosition(item);
     }
 #endif
 
commit 683ebf8d36ccdd884edb115ba49cd63a02055abc
Author: Simon Hausmann <shausman at trolltech.com>
Date:   Fri Mar 14 12:57:09 2008 +0100

    Fix crash when rendering myanmar text.
    
    When determining the char attributes avoid running out of bounds in the char attributes array.
    
    Signed-off-by: Simon Hausmann <shausman at trolltech.com>
    Signed-off-by: Thomas Zander <tzander at trolltech.com>

diff --git a/src/harfbuzz-myanmar.c b/src/harfbuzz-myanmar.c
index 6fcb4c7..a8ba88a 100644
--- a/src/harfbuzz-myanmar.c
+++ b/src/harfbuzz-myanmar.c
@@ -523,7 +523,7 @@ void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 fr
 	hb_uint32 boundary = myanmar_nextSyllableBoundary(text, from+i, end, &invalid) - from;
 
 	attributes[i].charStop = TRUE;
-        if (from || i)
+        if (i)
             attributes[i-1].lineBreakType = HB_Break;
 
 	if (boundary > len-1)
commit 59c9677c2580ee99a90be1b61dacc199008ebd5e
Author: Simon Hausmann <simon.hausmann at nokia.com>
Date:   Mon Jan 19 17:16:06 2009 +0100

    Fix crash when memset'ing null pointer.
    
    Clear the positions buffer only if it has been allocated before.

diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index 7077793..8c5244f 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -1172,7 +1172,8 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
 
     bool glyphs_positioned = false;
     if (face->gpos) {
-        memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB_PositionRec));
+        if (face->buffer->positions)
+            memset(face->buffer->positions, 0, face->buffer->in_length*sizeof(HB_PositionRec));
         // #### check that passing "false,false" is correct
         glyphs_positioned = HB_GPOS_Apply_String(item->font, face->gpos, face->current_flags, face->buffer, false, false) != HB_Err_Not_Covered;
     }
commit d80aa54bc661dd7c088441b177a2ce40ec9e65cd
Author: Simon Hausmann <simon.hausmann at nokia.com>
Date:   Mon Jan 19 10:46:07 2009 +0100

    Fix compilation after internal API changes a while ago.

diff --git a/tests/shaping/main.cpp b/tests/shaping/main.cpp
index cf142c1..05d69cb 100644
--- a/tests/shaping/main.cpp
+++ b/tests/shaping/main.cpp
@@ -121,14 +121,14 @@ HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32
         return error;
 
     if (face->glyph->format != ft_glyph_format_outline)
-        return (HB_Error)HB_Err_Invalid_GPOS_SubTable;
+        return (HB_Error)HB_Err_Invalid_SubTable;
 
     *nPoints = face->glyph->outline.n_points;
     if (!(*nPoints))
         return HB_Err_Ok;
 
     if (point > *nPoints)
-        return (HB_Error)HB_Err_Invalid_GPOS_SubTable;
+        return (HB_Error)HB_Err_Invalid_SubTable;
 
     *xpos = face->glyph->outline.points[point].x;
     *ypos = face->glyph->outline.points[point].y;
commit 9a758f1131b0675512abe393c4a4fdbbfde3b50b
Author: Simon Hausmann <simon.hausmann at nokia.com>
Date:   Mon Jan 19 10:44:34 2009 +0100

    Fix compilation, provide missing unicode functions.

diff --git a/tests/linebreaking/harfbuzz-qt.cpp b/tests/linebreaking/harfbuzz-qt.cpp
index 3136113..414543e 100644
--- a/tests/linebreaking/harfbuzz-qt.cpp
+++ b/tests/linebreaking/harfbuzz-qt.cpp
@@ -55,3 +55,23 @@ HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch)
     return QChar::mirroredChar(ch);
 }
 
+HB_WordClass HB_GetWordClass(HB_UChar32 ch)
+{
+    const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
+    return (HB_WordClass) prop->wordBreak;
+}
+
+
+HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch)
+{
+    const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
+    return (HB_SentenceClass) prop->sentenceBreak;
+}
+
+void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak)
+{
+    const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ch);
+    *grapheme = (HB_GraphemeClass) prop->graphemeBreak;
+    *lineBreak = (HB_LineBreakClass) prop->line_break_class;
+}
+



More information about the HarfBuzz mailing list