diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index c0ed2bcc0..aa5d496d1 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -1642,9 +1642,8 @@ struct Rule const hb_map_t *klass_map = nullptr) const { TRACE_SUBSET (this); - - const hb_array_t input = inputZ.as_array ((inputCount ? inputCount - 1 : 0)); - if (!input.length) return_trace (false); + if (unlikely (!inputCount)) return_trace (false); + const hb_array_t input = inputZ.as_array (inputCount - 1); const hb_map_t *mapping = klass_map == nullptr ? c->plan->glyph_map : klass_map; if (!hb_all (input, mapping)) return_trace (false); diff --git a/test/subset/data/Makefile.am b/test/subset/data/Makefile.am index a69005ab9..4934fa66a 100644 --- a/test/subset/data/Makefile.am +++ b/test/subset/data/Makefile.am @@ -33,6 +33,7 @@ EXTRA_DIST += \ expected/layout.gdef \ expected/layout.gdef.glyphset \ expected/layout.context \ + expected/layout.context_format2 \ expected/layout.gdef-varstore \ expected/layout.gdef-attachlist \ expected/layout.notonastaliqurdu \ diff --git a/test/subset/data/Makefile.sources b/test/subset/data/Makefile.sources index c1a70ba90..c9597e0e2 100644 --- a/test/subset/data/Makefile.sources +++ b/test/subset/data/Makefile.sources @@ -13,6 +13,7 @@ TESTS = \ tests/glyf_bug_3131.tests \ tests/japanese.tests \ tests/layout.context.tests \ + tests/layout.context_format2.tests \ tests/layout.gdef-attachlist.tests \ tests/layout.gdef-varstore.tests \ tests/layout.gdef.tests \ diff --git a/test/subset/data/expected/layout.context_format2/NotoSansNewa-Regular.layout-test-retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/layout.context_format2/NotoSansNewa-Regular.layout-test-retain-gids.retain-all-codepoint.ttf new file mode 100644 index 000000000..c2ef8fed6 Binary files /dev/null and b/test/subset/data/expected/layout.context_format2/NotoSansNewa-Regular.layout-test-retain-gids.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/layout.context_format2/NotoSansNewa-Regular.layout-test.retain-all-codepoint.ttf b/test/subset/data/expected/layout.context_format2/NotoSansNewa-Regular.layout-test.retain-all-codepoint.ttf new file mode 100644 index 000000000..c2ef8fed6 Binary files /dev/null and b/test/subset/data/expected/layout.context_format2/NotoSansNewa-Regular.layout-test.retain-all-codepoint.ttf differ diff --git a/test/subset/data/fonts/NotoSansNewa-Regular.ttf b/test/subset/data/fonts/NotoSansNewa-Regular.ttf new file mode 100644 index 000000000..b79b9cb00 Binary files /dev/null and b/test/subset/data/fonts/NotoSansNewa-Regular.ttf differ diff --git a/test/subset/data/tests/layout.context_format2.tests b/test/subset/data/tests/layout.context_format2.tests new file mode 100644 index 000000000..019fb94dc --- /dev/null +++ b/test/subset/data/tests/layout.context_format2.tests @@ -0,0 +1,9 @@ +FONTS: +NotoSansNewa-Regular.ttf + +PROFILES: +layout-test.txt +layout-test-retain-gids.txt + +SUBSETS: +* diff --git a/test/subset/meson.build b/test/subset/meson.build index 729aa3bfc..a1aa7f12e 100644 --- a/test/subset/meson.build +++ b/test/subset/meson.build @@ -25,6 +25,7 @@ tests = [ 'layout.gdef.glyphset', 'layout.khmer', 'layout.context', + 'layout.context_format2', 'layout.gdef-varstore', 'layout.gdef-attachlist', 'layout.notonastaliqurdu',