From 2cea796b75702d4fd433da2f4733810cf3dd3cfa Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Mon, 30 Mar 2020 16:04:17 +0100 Subject: [PATCH 1/5] Instrument entering GSUB/GPOS tables --- src/hb-ot-layout.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index bc285295b..58ec8ed95 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1981,13 +1981,17 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const { GSUBProxy proxy (font->face); + if (!buffer->message (font, "start table GSUB")) return; apply (proxy, plan, font, buffer); + (void)buffer->message (font, "end table GSUB"); } void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const { GPOSProxy proxy (font->face); + if (!buffer->message (font, "start table GPOS")) return; apply (proxy, plan, font, buffer); + (void)buffer->message (font, "end table GPOS"); } void From 42aac64030c54e514c4c031b49f646ece2b878fa Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Mon, 30 Mar 2020 16:06:30 +0100 Subject: [PATCH 2/5] Add table index to lookup messages We could say GSUB/GPOS explicitly, but using the index is more general, in case future tables (such as JSTF, Silf) become supported. --- src/hb-ot-layout.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 58ec8ed95..639d94513 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1954,7 +1954,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, for (; i < stage->last_lookup; i++) { unsigned int lookup_index = lookups[table_index][i].index; - if (!buffer->message (font, "start lookup %d", lookup_index)) continue; + if (!buffer->message (font, "start lookup %d:%d", table_index, lookup_index)) continue; c.set_lookup_index (lookup_index); c.set_lookup_mask (lookups[table_index][i].mask); c.set_auto_zwj (lookups[table_index][i].auto_zwj); @@ -1967,7 +1967,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, apply_string (&c, proxy.table.get_lookup (lookup_index), proxy.accels[lookup_index]); - (void) buffer->message (font, "end lookup %d", lookup_index); + (void) buffer->message (font, "end lookup %d:%d", table_index, lookup_index); } if (stage->pause_func) From bef7ef81da8030628ca99c27a3eb52ab642e6a85 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Mon, 30 Mar 2020 16:39:43 +0100 Subject: [PATCH 3/5] Reformat kerx/morx instrumentation to 'verb noun identifier' --- src/hb-aat-layout-kerx-table.hh | 4 ++-- src/hb-aat-layout-morx-table.hh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index be1b339aa..d974f6ac7 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -891,7 +891,7 @@ struct KerxTable reverse = bool (st->u.header.coverage & st->u.header.Backwards) != HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); - if (!c->buffer->message (c->font, "start %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index)) + if (!c->buffer->message (c->font, "start table %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index)) goto skip; if (!seenCrossStream && @@ -923,7 +923,7 @@ struct KerxTable if (reverse) c->buffer->reverse (); - (void) c->buffer->message (c->font, "end %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index); + (void) c->buffer->message (c->font, "end table %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index); skip: st = &StructAfter (*st); diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index d8df579f5..06e454e28 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -1015,7 +1015,7 @@ struct Chain bool (subtable->get_coverage () & ChainSubtable::Backwards) != HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); - if (!c->buffer->message (c->font, "start chain subtable %d", c->lookup_index)) + if (!c->buffer->message (c->font, "start table morx chainsubtable %d", c->lookup_index)) goto skip; if (reverse) @@ -1026,7 +1026,7 @@ struct Chain if (reverse) c->buffer->reverse (); - (void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index); + (void) c->buffer->message (c->font, "end table morx chainsubtable %d", c->lookup_index); if (unlikely (!c->buffer->successful)) return; From bdda2ff6092a3ddce2fe236dfe8cf3176330589b Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Mon, 30 Mar 2020 16:40:29 +0100 Subject: [PATCH 4/5] More strictly follow noun/verb/identifier format for GPOS/GSUB lookups Less generic than the previous commit, but more descriptive and more consistent. --- src/hb-ot-layout.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 639d94513..971622df6 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1954,7 +1954,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, for (; i < stage->last_lookup; i++) { unsigned int lookup_index = lookups[table_index][i].index; - if (!buffer->message (font, "start lookup %d:%d", table_index, lookup_index)) continue; + if (!buffer->message (font, "start table %s lookup %d", (table_index==0 ? "GSUB" : "GPOS"), lookup_index)) continue; c.set_lookup_index (lookup_index); c.set_lookup_mask (lookups[table_index][i].mask); c.set_auto_zwj (lookups[table_index][i].auto_zwj); @@ -1967,7 +1967,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, apply_string (&c, proxy.table.get_lookup (lookup_index), proxy.accels[lookup_index]); - (void) buffer->message (font, "end lookup %d:%d", table_index, lookup_index); + (void) buffer->message (font, "end table %s lookup %d", (table_index==0 ? "GSUB" : "GPOS"), lookup_index); } if (stage->pause_func) From fe926970bc16ee438fe74d8ee366393ed3576bd5 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Tue, 16 Jun 2020 09:12:44 +0100 Subject: [PATCH 5/5] Reformat messages again Messages can be: start/end table XXXX start/end lookup NNNN start/end subtable NNNN (for kerx/kern) start/end chainsubtable NNNN (for morx) --- src/hb-aat-layout-kerx-table.hh | 4 ++-- src/hb-aat-layout-morx-table.hh | 4 ++-- src/hb-ot-layout.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index d974f6ac7..023c5c0e3 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -891,7 +891,7 @@ struct KerxTable reverse = bool (st->u.header.coverage & st->u.header.Backwards) != HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); - if (!c->buffer->message (c->font, "start table %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index)) + if (!c->buffer->message (c->font, "start subtable %d", c->lookup_index)) goto skip; if (!seenCrossStream && @@ -923,7 +923,7 @@ struct KerxTable if (reverse) c->buffer->reverse (); - (void) c->buffer->message (c->font, "end table %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index); + (void) c->buffer->message (c->font, "end subtable %d", c->lookup_index); skip: st = &StructAfter (*st); diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 06e454e28..9f1953c7b 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -1015,7 +1015,7 @@ struct Chain bool (subtable->get_coverage () & ChainSubtable::Backwards) != HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); - if (!c->buffer->message (c->font, "start table morx chainsubtable %d", c->lookup_index)) + if (!c->buffer->message (c->font, "start chainsubtable %d", c->lookup_index)) goto skip; if (reverse) @@ -1026,7 +1026,7 @@ struct Chain if (reverse) c->buffer->reverse (); - (void) c->buffer->message (c->font, "end table morx chainsubtable %d", c->lookup_index); + (void) c->buffer->message (c->font, "end chainsubtable %d", c->lookup_index); if (unlikely (!c->buffer->successful)) return; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 971622df6..58ec8ed95 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1954,7 +1954,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, for (; i < stage->last_lookup; i++) { unsigned int lookup_index = lookups[table_index][i].index; - if (!buffer->message (font, "start table %s lookup %d", (table_index==0 ? "GSUB" : "GPOS"), lookup_index)) continue; + if (!buffer->message (font, "start lookup %d", lookup_index)) continue; c.set_lookup_index (lookup_index); c.set_lookup_mask (lookups[table_index][i].mask); c.set_auto_zwj (lookups[table_index][i].auto_zwj); @@ -1967,7 +1967,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, apply_string (&c, proxy.table.get_lookup (lookup_index), proxy.accels[lookup_index]); - (void) buffer->message (font, "end table %s lookup %d", (table_index==0 ? "GSUB" : "GPOS"), lookup_index); + (void) buffer->message (font, "end lookup %d", lookup_index); } if (stage->pause_func)