[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Aug 23 13:27:31 PDT 2012
src/hb-ot-layout-gsubgpos-private.hh | 6 ++++--
src/hb-ot-layout-private.hh | 3 ++-
src/hb-ot-layout.cc | 14 ++++++++------
src/hb-ot-layout.h | 7 ++++---
src/hb-ot-map.cc | 12 ++----------
src/hb-ot-shape-complex-indic.cc | 10 ++++++----
src/test-would-substitute.cc | 2 +-
7 files changed, 27 insertions(+), 27 deletions(-)
New commits:
commit b5584ee4be46b47e1678acf28426970a6d670b4f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Aug 23 16:26:07 2012 -0400
[Indic] For old-spec, match non-zero context
Fixes consonant-position with old-spec Malayalam. Uniscribe seem to be
doing this. Fixes below-base La (eg. Pa,H,La) with AnjaliNewLipi.ttf.
Doesn't regress new-spec or other scripts.
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0df179c..b2513ef 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -254,10 +254,11 @@ struct would_substitute_feature_t
inline bool would_substitute (hb_codepoint_t *glyphs,
unsigned int glyphs_count,
+ bool zero_context,
hb_face_t *face) const
{
for (unsigned int i = 0; i < count; i++)
- if (hb_ot_layout_would_substitute_lookup_fast (face, lookups[i].index, glyphs, glyphs_count, true))
+ if (hb_ot_layout_would_substitute_lookup_fast (face, lookups[i].index, glyphs, glyphs_count, zero_context))
return true;
return false;
}
@@ -340,9 +341,10 @@ consonant_position_from_face (const indic_shape_plan_t *indic_plan,
hb_codepoint_t *glyphs, unsigned int glyphs_len,
hb_face_t *face)
{
- if (indic_plan->pref.would_substitute (glyphs, glyphs_len, face)) return POS_BELOW_C;
- if (indic_plan->blwf.would_substitute (glyphs, glyphs_len, face)) return POS_BELOW_C;
- if (indic_plan->pstf.would_substitute (glyphs, glyphs_len, face)) return POS_POST_C;
+ bool zero_context = indic_plan->is_old_spec ? false : true;
+ if (indic_plan->pref.would_substitute (glyphs, glyphs_len, zero_context, face)) return POS_BELOW_C;
+ if (indic_plan->blwf.would_substitute (glyphs, glyphs_len, zero_context, face)) return POS_BELOW_C;
+ if (indic_plan->pstf.would_substitute (glyphs, glyphs_len, zero_context, face)) return POS_POST_C;
return POS_BASE_C;
}
commit d9b204d3d24cde165167714728bf380267903d6a
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Aug 23 16:22:28 2012 -0400
[GSUB] Allow non-zero-context matching in would_apply()
To be used in the next patch.
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index ba2a7e0..7d4849f 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -76,17 +76,20 @@ struct hb_would_apply_context_t
hb_face_t *face;
const hb_codepoint_t *glyphs;
unsigned int len;
+ bool zero_context;
const hb_set_digest_t digest;
unsigned int debug_depth;
hb_would_apply_context_t (hb_face_t *face_,
const hb_codepoint_t *glyphs_,
unsigned int len_,
+ bool zero_context_,
const hb_set_digest_t *digest_
) :
face (face_),
glyphs (glyphs_),
len (len_),
+ zero_context (zero_context_),
digest (*digest_),
debug_depth (0) {};
};
@@ -1066,8 +1069,7 @@ static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c
const LookupRecord lookupRecord[],
ChainContextApplyLookupContext &lookup_context)
{
- return !backtrackCount
- && !lookaheadCount
+ return (c->zero_context ? !backtrackCount && !lookaheadCount : true)
&& would_match_input (c,
inputCount, input,
lookup_context.funcs.match, lookup_context.match_data[1]);
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index e101782..3f2c3ef 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -139,9 +139,10 @@ static inline uint8_t allocate_lig_id (hb_buffer_t *buffer) {
HB_INTERNAL hb_bool_t
hb_ot_layout_would_substitute_lookup_fast (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index);
+ hb_bool_t zero_context);
/* Should be called before all the substitute_lookup's are done. */
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index e4d84e8..44420ff 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -401,22 +401,24 @@ hb_ot_layout_has_substitution (hb_face_t *face)
hb_bool_t
hb_ot_layout_would_substitute_lookup (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index)
+ hb_bool_t zero_context)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return false;
- return hb_ot_layout_would_substitute_lookup_fast (face, glyphs, glyphs_length, lookup_index);
+ return hb_ot_layout_would_substitute_lookup_fast (face, lookup_index, glyphs, glyphs_length, zero_context);
}
hb_bool_t
hb_ot_layout_would_substitute_lookup_fast (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index)
+ hb_bool_t zero_context)
{
if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
- hb_would_apply_context_t c (face, glyphs, glyphs_length, &hb_ot_layout_from_face (face)->gsub_digests[lookup_index]);
+ hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context, &hb_ot_layout_from_face (face)->gsub_digests[lookup_index]);
return hb_ot_layout_from_face (face)->gsub->would_substitute_lookup (&c, lookup_index);
}
@@ -445,8 +447,8 @@ hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer)
void
hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
- hb_set_t *glyphs,
- unsigned int lookup_index)
+ unsigned int lookup_index,
+ hb_set_t *glyphs)
{
hb_closure_context_t c (face, glyphs);
_get_gsub (face).closure_lookup (&c, lookup_index);
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 2ad4ff4..d431a38 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -171,14 +171,15 @@ hb_ot_layout_has_substitution (hb_face_t *face);
hb_bool_t
hb_ot_layout_would_substitute_lookup (hb_face_t *face,
+ unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
- unsigned int lookup_index);
+ hb_bool_t zero_context);
void
hb_ot_layout_substitute_closure_lookup (hb_face_t *face,
- hb_set_t *glyphs,
- unsigned int lookup_index);
+ unsigned int lookup_index,
+ hb_set_t *glyphs);
/*
* GPOS
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 7eed624..b8b2dbe 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -116,16 +116,8 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
void hb_ot_map_t::substitute_closure (const hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const
{
unsigned int table_index = 0;
- unsigned int i = 0;
-
- for (unsigned int pause_index = 0; pause_index < pauses[table_index].len; pause_index++) {
- const pause_map_t *pause = &pauses[table_index][pause_index];
- for (; i < pause->num_lookups; i++)
- hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
- }
-
- for (; i < lookups[table_index].len; i++)
- hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
+ for (unsigned int i = 0; i < lookups[table_index].len; i++)
+ hb_ot_layout_substitute_closure_lookup (face, lookups[table_index][i].index, glyphs);
}
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index e2a6f58..0df179c 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -257,7 +257,7 @@ struct would_substitute_feature_t
hb_face_t *face) const
{
for (unsigned int i = 0; i < count; i++)
- if (hb_ot_layout_would_substitute_lookup_fast (face, glyphs, glyphs_count, lookups[i].index))
+ if (hb_ot_layout_would_substitute_lookup_fast (face, lookups[i].index, glyphs, glyphs_count, true))
return true;
return false;
}
diff --git a/src/test-would-substitute.cc b/src/test-would-substitute.cc
index 95626ed..d15aec4 100644
--- a/src/test-would-substitute.cc
+++ b/src/test-would-substitute.cc
@@ -99,5 +99,5 @@ main (int argc, char **argv)
(argc > 4 &&
!hb_font_glyph_from_string (font, argv[4], -1, &glyphs[1])))
return 2;
- return !hb_ot_layout_would_substitute_lookup (face, glyphs, len, strtol (argv[2], NULL, 0));
+ return !hb_ot_layout_would_substitute_lookup (face, strtol (argv[2], NULL, 0), glyphs, len, false);
}
More information about the HarfBuzz
mailing list