From 531f9822b2e8a60f03c43d6f86ef9ed32c951f0e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 23 Oct 2018 01:32:08 -0700 Subject: [PATCH] [morx] Add a few debug messages to Ligature chain --- src/hb-aat-layout-morx-table.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 3f5f29d..5577efe 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -373,6 +373,7 @@ struct LigatureSubtable hb_buffer_t *buffer = driver->buffer; unsigned int flags = entry->flags; + DEBUG_MSG (APPLY, nullptr, "Ligature transition at %d", buffer->idx); if (flags & SetComponent) { if (unlikely (match_length >= ARRAY_LENGTH (match_positions))) @@ -383,10 +384,12 @@ struct LigatureSubtable match_length--; match_positions[match_length++] = buffer->out_len; + DEBUG_MSG (APPLY, nullptr, "Set component at %d", buffer->out_len); } if (flags & PerformAction) { + DEBUG_MSG (APPLY, nullptr, "Perform action with %d", match_length); unsigned int end = buffer->out_len; unsigned int action_idx = entry->data.ligActionIndex; unsigned int action; @@ -404,10 +407,12 @@ struct LigatureSubtable if (unlikely (!cursor)) { /* Stack underflow. Clear the stack. */ + DEBUG_MSG (APPLY, nullptr, "Stack underflow"); match_length = 0; break; } + DEBUG_MSG (APPLY, nullptr, "Moving to stack position %d", cursor - 1); buffer->move_to (match_positions[--cursor]); const HBUINT32 &actionData = ligAction[action_idx]; @@ -426,17 +431,22 @@ struct LigatureSubtable if (unlikely (!componentData.sanitize (&c->sanitizer))) return false; ligature_idx += componentData; + DEBUG_MSG (APPLY, nullptr, "Action store %d last %d", + bool (action & LigActionStore), + bool (action & LigActionLast)); if (action & (LigActionStore | LigActionLast)) { const GlyphID &ligatureData = ligature[ligature_idx]; if (unlikely (!ligatureData.sanitize (&c->sanitizer))) return false; hb_codepoint_t lig = ligatureData; + DEBUG_MSG (APPLY, nullptr, "Produced ligature %d", lig); buffer->replace_glyph (lig); /* Now go and delete all subsequent components. */ while (match_length - 1 > cursor) { + DEBUG_MSG (APPLY, nullptr, "Skipping ligature component"); buffer->move_to (match_positions[--match_length]); buffer->skip_glyph (); end--; -- 2.7.4