[HarfBuzz] harfbuzz-ng: Branch 'master' - 4 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Mon Jul 30 14:21:20 PDT 2012
src/hb-old/harfbuzz-arabic.c | 12 +++++++---
src/hb-old/harfbuzz-gpos.c | 6 ++---
src/hb-old/harfbuzz-gsub.c | 6 ++---
src/hb-old/harfbuzz-tibetan.c | 1
src/hb-ot-shape-complex-arabic.cc | 2 -
src/hb-ot-shape-complex-indic.cc | 4 ---
src/hb-ot-shape-complex-misc.cc | 12 +++++++---
src/hb-ot-shape-complex-private.hh | 9 +++----
src/hb-ot-shape.cc | 4 ++-
src/hb-unicode.cc | 8 ++++++
src/indic.cc | 11 ++++++---
test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt | 1
12 files changed, 51 insertions(+), 25 deletions(-)
New commits:
commit 7e34601dededd521bcef15111e39293df3d0d13d
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Jul 30 14:53:41 2012 -0400
Unbreak Hangul jamo composition
When we removed the separate Hangul shaper, the specific normalization
preference of Hangul was lost. Fix that. Also, the Thai shaper was
copied from Hangul, so had the fully-composed normalization behavior,
which was unnecessary. So, fix that too.
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 75f5fe9..1f63c12 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -206,7 +206,7 @@ _hb_ot_shape_complex_override_features_arabic (hb_ot_map_builder_t *map,
}
hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_arabic (void)
+_hb_ot_shape_complex_normalization_preference_arabic (const hb_segment_properties_t *props)
{
return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
}
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index e4c151a..c7025ff 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -420,10 +420,8 @@ _hb_ot_shape_complex_override_features_indic (hb_ot_map_builder_t *map,
hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_indic (void)
+_hb_ot_shape_complex_normalization_preference_indic (const hb_segment_properties_t *props)
{
- /* We want split matras decomposed by the common shaping logic. */
- /* XXX sort this out after adding per-shaper normalizers. */
return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
}
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 4578f0b..4b9e6a6 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -79,8 +79,14 @@ _hb_ot_shape_complex_override_features_default (hb_ot_map_builder_t *map HB_UNUS
}
hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_default (void)
+_hb_ot_shape_complex_normalization_preference_default (const hb_segment_properties_t *props)
{
+ switch ((hb_tag_t) props->script)
+ {
+ /* Unicode-1.1 additions */
+ case HB_SCRIPT_HANGUL:
+ return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+ }
return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
}
@@ -108,9 +114,9 @@ _hb_ot_shape_complex_override_features_thai (hb_ot_map_builder_t *map HB_UNUSED,
}
hb_ot_shape_normalization_mode_t
-_hb_ot_shape_complex_normalization_preference_thai (void)
+_hb_ot_shape_complex_normalization_preference_thai (const hb_segment_properties_t *props HB_UNUSED)
{
- return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL;
+ return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
}
void
diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh
index d444cd6..689ca61 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -270,23 +270,22 @@ hb_ot_shape_complex_override_features (hb_ot_complex_shaper_t shaper,
* normalization_preference()
*
* Called during shape_execute().
- *
- * Shapers should return true if it prefers decomposed (NFD) input rather than precomposed (NFC).
*/
-typedef hb_ot_shape_normalization_mode_t hb_ot_shape_complex_normalization_preference_func_t (void);
+typedef hb_ot_shape_normalization_mode_t hb_ot_shape_complex_normalization_preference_func_t (const hb_segment_properties_t *props HB_UNUSED);
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
HB_INTERNAL hb_ot_shape_complex_normalization_preference_func_t _hb_ot_shape_complex_normalization_preference_##name;
HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
#undef HB_COMPLEX_SHAPER_IMPLEMENT
static inline hb_ot_shape_normalization_mode_t
-hb_ot_shape_complex_normalization_preference (hb_ot_complex_shaper_t shaper)
+hb_ot_shape_complex_normalization_preference (hb_ot_complex_shaper_t shaper,
+ const hb_segment_properties_t *props)
{
switch (shaper) {
default:
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
- case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_normalization_preference_##name ();
+ case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_normalization_preference_##name (props);
HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
#undef HB_COMPLEX_SHAPER_IMPLEMENT
}
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 7831f90..c727fa6 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -492,7 +492,9 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
hb_ensure_native_direction (c->buffer);
- _hb_ot_shape_normalize (c->font, c->buffer, hb_ot_shape_complex_normalization_preference (c->plan->shaper));
+ _hb_ot_shape_normalize (c->font, c->buffer,
+ hb_ot_shape_complex_normalization_preference (c->plan->shaper,
+ &c->buffer->props));
hb_ot_shape_setup_masks (c);
commit 7afb14407e59dfeaa79c33aca1ffa60e7982e349
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Jul 30 13:54:46 2012 -0400
[Indic] Recategorize Telugu length marks
Fixes 8 more Telugu tests. Failures at 15 (0.00154548%).
diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc
index 3569b20..b05b290 100644
--- a/src/hb-unicode.cc
+++ b/src/hb-unicode.cc
@@ -369,6 +369,14 @@ _hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs,
* Uniscribe does this. */
c = 104;
}
+ else if (unlikely (hb_in_range<hb_codepoint_t> (unicode, 0x0C55, 0x0C56)))
+ {
+ /* Telugu length marks.
+ * These are the only matras in the main Indic script range that have
+ * a non-zero ccc. That makes them reorder with the Halant that is
+ * ccc=9. Just zero them, we don't need them in our Indic shaper. */
+ c = 0;
+ }
return c;
}
diff --git a/src/indic.cc b/src/indic.cc
index 3b44076..991a772 100644
--- a/src/indic.cc
+++ b/src/indic.cc
@@ -39,8 +39,13 @@ main (void)
unsigned int category = type & 0x0F;
unsigned int position = type >> 4;
- hb_codepoint_t a, b;
- if (!hb_unicode_decompose (funcs, u, &a, &b))
- printf ("U+%04X %x %x\n", u, category, position);
+ hb_unicode_general_category_t cat = hb_unicode_general_category (funcs, u);
+ unsigned int ccc = hb_unicode_combining_class (funcs, u);
+ if (category == OT_M && ccc)
+ printf ("U+%04X %d\n", u, ccc);
+
+// hb_codepoint_t a, b;
+// if (!hb_unicode_decompose (funcs, u, &a, &b))
+// printf ("U+%04X %x %x\n", u, category, position);
}
}
commit 70b3dc327232b20051b36397aa2b196ab8c62397
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Jul 30 12:40:18 2012 -0400
Add Hebrew test
diff --git a/test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt b/test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt
index 563901c..f3cf91f 100644
--- a/test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt
+++ b/test/shaping/texts/in-tree/shaper-default/script-hebrew/misc/diacritics.txt
@@ -13,3 +13,4 @@
×Ö¸× Ö¼Ö¸Ö½× ×Ö¸× Ö¸Ö¼Ö½×
תַעֲשֶ×Ö¦×
שֹֽ××ְרֵ×Ö
+×Ö²âÖ½Ö
commit f2377155e35c15919af4d7db21b6edc6783146b6
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Jul 30 10:50:57 2012 -0400
[hb-old] Fix misc leaks
Backport (forward-port?!) from upstream:
commit 3ab7b37bdebf0f8773493a1fee910b151c4de30f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Jul 30 10:50:22 2012 -0400
Fix misc leaks
https://bugs.freedesktop.org/show_bug.cgi?id=31992
https://bugs.freedesktop.org/show_bug.cgi?id=31993
https://bugs.freedesktop.org/show_bug.cgi?id=31994
https://bugs.freedesktop.org/show_bug.cgi?id=31995
diff --git a/src/hb-old/harfbuzz-arabic.c b/src/hb-old/harfbuzz-arabic.c
index 3837087..51f839a 100644
--- a/src/hb-old/harfbuzz-arabic.c
+++ b/src/hb-old/harfbuzz-arabic.c
@@ -1111,16 +1111,22 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item)
if (HB_SelectScript(item, item->item.script == HB_Script_Arabic ? arabic_features : syriac_features)) {
HB_Bool ot_ok;
- if (arabicSyriacOpenTypeShape(item, &ot_ok))
+ if (arabicSyriacOpenTypeShape(item, &ot_ok)) {
+ HB_FREE_STACKARRAY(shapedChars);
return TRUE;
- if (ot_ok)
+ }
+ if (ot_ok) {
+ HB_FREE_STACKARRAY(shapedChars);
return FALSE;
/* fall through to the non OT code*/
+ }
}
#endif
- if (item->item.script != HB_Script_Arabic)
+ if (item->item.script != HB_Script_Arabic) {
+ HB_FREE_STACKARRAY(shapedChars);
return HB_BasicShape(item);
+ }
shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen,
item->item.bidiLevel % 2,
diff --git a/src/hb-old/harfbuzz-gpos.c b/src/hb-old/harfbuzz-gpos.c
index 7bd3b3b..e969a01 100644
--- a/src/hb-old/harfbuzz-gpos.c
+++ b/src/hb-old/harfbuzz-gpos.c
@@ -5171,13 +5171,13 @@ static HB_Error Lookup_ChainContextPos2(
if ( error )
return error;
+ if (ccpf2->MaxInputLength < 1)
+ return HB_Err_Not_Covered;
+
if ( ALLOC_ARRAY( backtrack_classes, ccpf2->MaxBacktrackLength, HB_UShort ) )
return error;
known_backtrack_classes = 0;
- if (ccpf2->MaxInputLength < 1)
- return HB_Err_Not_Covered;
-
if ( ALLOC_ARRAY( input_classes, ccpf2->MaxInputLength, HB_UShort ) )
goto End3;
known_input_classes = 1;
diff --git a/src/hb-old/harfbuzz-gsub.c b/src/hb-old/harfbuzz-gsub.c
index 21fec51..ceb7034 100644
--- a/src/hb-old/harfbuzz-gsub.c
+++ b/src/hb-old/harfbuzz-gsub.c
@@ -3158,13 +3158,13 @@ static HB_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub,
if ( error )
return error;
+ if (ccsf2->MaxInputLength < 1)
+ return HB_Err_Not_Covered;
+
if ( ALLOC_ARRAY( backtrack_classes, ccsf2->MaxBacktrackLength, HB_UShort ) )
return error;
known_backtrack_classes = 0;
- if (ccsf2->MaxInputLength < 1)
- return HB_Err_Not_Covered;
-
if ( ALLOC_ARRAY( input_classes, ccsf2->MaxInputLength, HB_UShort ) )
goto End3;
known_input_classes = 1;
diff --git a/src/hb-old/harfbuzz-tibetan.c b/src/hb-old/harfbuzz-tibetan.c
index 04b3e21..8b3e953 100644
--- a/src/hb-old/harfbuzz-tibetan.c
+++ b/src/hb-old/harfbuzz-tibetan.c
@@ -113,6 +113,7 @@ static HB_Bool tibetan_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_
if (item->num_glyphs < item->item.length + 4) {
item->num_glyphs = item->item.length + 4;
+ HB_FREE_STACKARRAY(reordered);
return FALSE;
}
More information about the HarfBuzz
mailing list