[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Oct 2 14:05:58 UTC 2018
src/hb-ot-layout-gsub-table.hh | 3 ---
src/hb-ot-layout-gsubgpos.hh | 38 +++++++++++++++++++++++---------------
2 files changed, 23 insertions(+), 18 deletions(-)
New commits:
commit 9efddb9de821fc909a3ea8354f3dfd39c823e97b
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Oct 2 16:05:26 2018 +0200
Treat a base+mark... ligature as base, not ligature
Fixes https://github.com/harfbuzz/harfbuzz/issues/746
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index da023eab..bdaf35a9 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -856,7 +856,11 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
buffer->merge_clusters (buffer->idx, buffer->idx + match_length);
- /* - If all components of the ligature were marks, we call this a mark ligature.
+ /* - If a base and one or more marks ligate, consider that as a base, NOT
+ * ligature, such that all following marks can still attach to it.
+ * https://github.com/harfbuzz/harfbuzz/issues/1109
+ *
+ * - If all components of the ligature were marks, we call this a mark ligature.
* If it *is* a mark ligature, we don't allocate a new ligature id, and leave
* the ligature to keep its old ligature id. This will allow it to attach to
* a base ligature in GPOS. Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
@@ -884,21 +888,24 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
* https://bugzilla.gnome.org/show_bug.cgi?id=437633
*/
- bool is_mark_ligature = true;
- for (unsigned int i = 0; i < count; i++)
+ bool is_base_ligature = _hb_glyph_info_is_base_glyph (&buffer->info[match_positions[0]]);
+ bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->info[match_positions[0]]);
+ for (unsigned int i = 1; i < count; i++)
if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]]))
{
+ is_base_ligature = false;
is_mark_ligature = false;
break;
}
+ bool is_ligature = !is_base_ligature && !is_mark_ligature;
- unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
- unsigned int lig_id = is_mark_ligature ? 0 : _hb_allocate_lig_id (buffer);
+ unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0;
+ unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0;
unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur());
unsigned int components_so_far = last_num_components;
- if (!is_mark_ligature)
+ if (is_ligature)
{
_hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count);
if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
@@ -912,7 +919,8 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
{
while (buffer->idx < match_positions[i] && buffer->successful)
{
- if (!is_mark_ligature) {
+ if (is_ligature)
+ {
unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
if (this_comp == 0)
this_comp = last_num_components;
commit 3cca978723db43233d25402254d297dfccf991a3
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Oct 2 15:02:16 2018 +0200
Move code around
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 7e36e063..b664f15a 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -762,7 +762,6 @@ struct Ligature
return_trace (true);
}
- bool is_mark_ligature = false;
unsigned int total_component_count = 0;
unsigned int match_length = 0;
@@ -774,7 +773,6 @@ struct Ligature
nullptr,
&match_length,
match_positions,
- &is_mark_ligature,
&total_component_count)))
return_trace (false);
@@ -783,7 +781,6 @@ struct Ligature
match_positions,
match_length,
ligGlyph,
- is_mark_ligature,
total_component_count);
return_trace (true);
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 5dd4c3da..da023eab 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -731,7 +731,6 @@ static inline bool match_input (hb_ot_apply_context_t *c,
const void *match_data,
unsigned int *end_offset,
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
- bool *p_is_mark_ligature = nullptr,
unsigned int *p_total_component_count = nullptr)
{
TRACE_APPLY (nullptr);
@@ -768,8 +767,6 @@ static inline bool match_input (hb_ot_apply_context_t *c,
* https://github.com/harfbuzz/harfbuzz/issues/545
*/
- bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->cur());
-
unsigned int total_component_count = 0;
total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
@@ -836,15 +833,11 @@ static inline bool match_input (hb_ot_apply_context_t *c,
return_trace (false);
}
- is_mark_ligature = is_mark_ligature && _hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx]);
total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]);
}
*end_offset = skippy_iter.idx - buffer->idx + 1;
- if (p_is_mark_ligature)
- *p_is_mark_ligature = is_mark_ligature;
-
if (p_total_component_count)
*p_total_component_count = total_component_count;
@@ -855,7 +848,6 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
unsigned int match_length,
hb_codepoint_t lig_glyph,
- bool is_mark_ligature,
unsigned int total_component_count)
{
TRACE_APPLY (nullptr);
@@ -864,11 +856,11 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
buffer->merge_clusters (buffer->idx, buffer->idx + match_length);
- /*
- * - If it *is* a mark ligature, we don't allocate a new ligature id, and leave
+ /* - If all components of the ligature were marks, we call this a mark ligature.
+ * If it *is* a mark ligature, we don't allocate a new ligature id, and leave
* the ligature to keep its old ligature id. This will allow it to attach to
* a base ligature in GPOS. Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
- * and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA wit a
+ * and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
* ligature id and component value of 2. Then if SHADDA,FATHA form a ligature
* later, we don't want them to lose their ligature id/component, otherwise
* GPOS will fail to correctly position the mark ligature on top of the
@@ -892,6 +884,14 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
* https://bugzilla.gnome.org/show_bug.cgi?id=437633
*/
+ bool is_mark_ligature = true;
+ for (unsigned int i = 0; i < count; i++)
+ if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]]))
+ {
+ is_mark_ligature = false;
+ break;
+ }
+
unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
unsigned int lig_id = is_mark_ligature ? 0 : _hb_allocate_lig_id (buffer);
unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
More information about the HarfBuzz
mailing list