[subset] fix bug in parsing glyf flags.
the bytes of the flag stream were being treated as signed integers instead of unsigned as specified in the spec.
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 9b86581..6c0f6dd 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -509,8 +509,8 @@
const Glyph trim_padding () const
{
/* based on FontTools _g_l_y_f.py::trim */
- const char *glyph = bytes.arrayZ;
- const char *glyph_end = glyph + bytes.length;
+ const uint8_t *glyph = (uint8_t*) bytes.arrayZ;
+ const uint8_t *glyph_end = glyph + bytes.length;
/* simple glyph w/contours, possibly trimmable */
glyph += instruction_len_offset ();
diff --git a/test/subset/data/Makefile.am b/test/subset/data/Makefile.am
index 9a7d7a2..bd70a63 100644
--- a/test/subset/data/Makefile.am
+++ b/test/subset/data/Makefile.am
@@ -9,6 +9,7 @@
$(TESTS) \
expected/basics \
expected/full-font \
+ expected/glyf_bug_3131 \
expected/cff-full-font \
expected/japanese \
expected/cff-japanese \
diff --git a/test/subset/data/Makefile.sources b/test/subset/data/Makefile.sources
index c8fc610..0bbc7cc 100644
--- a/test/subset/data/Makefile.sources
+++ b/test/subset/data/Makefile.sources
@@ -9,6 +9,7 @@
tests/colr.tests \
tests/colr_with_components.tests \
tests/full-font.tests \
+ tests/glyf_bug_3131.tests \
tests/japanese.tests \
tests/layout.context.tests \
tests/layout.gdef-attachlist.tests \
diff --git a/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.drop-hints-retain-gids.63,64,65,6F,70,71,72.ttf b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.drop-hints-retain-gids.63,64,65,6F,70,71,72.ttf
new file mode 100644
index 0000000..8ba3b02
--- /dev/null
+++ b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.drop-hints-retain-gids.63,64,65,6F,70,71,72.ttf
Binary files differ
diff --git a/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.drop-hints-retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.drop-hints-retain-gids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..8ba3b02
--- /dev/null
+++ b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.drop-hints-retain-gids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.retain-gids.63,64,65,6F,70,71,72.ttf b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.retain-gids.63,64,65,6F,70,71,72.ttf
new file mode 100644
index 0000000..cc0e68f
--- /dev/null
+++ b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.retain-gids.63,64,65,6F,70,71,72.ttf
Binary files differ
diff --git a/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.retain-gids.retain-all-codepoint.ttf
new file mode 100644
index 0000000..cc0e68f
--- /dev/null
+++ b/test/subset/data/expected/glyf_bug_3131/glyf_bug_3131.retain-gids.retain-all-codepoint.ttf
Binary files differ
diff --git a/test/subset/data/fonts/glyf_bug_3131.ttf b/test/subset/data/fonts/glyf_bug_3131.ttf
new file mode 100644
index 0000000..a251936
--- /dev/null
+++ b/test/subset/data/fonts/glyf_bug_3131.ttf
Binary files differ
diff --git a/test/subset/data/tests/glyf_bug_3131.tests b/test/subset/data/tests/glyf_bug_3131.tests
new file mode 100644
index 0000000..d0fd5dc
--- /dev/null
+++ b/test/subset/data/tests/glyf_bug_3131.tests
@@ -0,0 +1,11 @@
+# Tests for https://github.com/harfbuzz/harfbuzz/issues/3131
+FONTS:
+glyf_bug_3131.ttf
+
+PROFILES:
+drop-hints-retain-gids.txt
+retain-gids.txt
+
+SUBSETS:
+cdeopqr
+*
diff --git a/test/subset/meson.build b/test/subset/meson.build
index a42839b..8c1c61c 100644
--- a/test/subset/meson.build
+++ b/test/subset/meson.build
@@ -5,6 +5,7 @@
'japanese',
'cff-japanese',
'cff.notoserifmyanmar',
+ 'glyf_bug_3131',
'layout',
'layout.gpos',
'layout.gpos2',