diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 9c2ce9a93..57d3e11f9 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -183,7 +183,19 @@ struct Glyph { contour_point_vector_t all_points, deltas; unsigned composite_contours = 0; - if (!get_points (font, glyf, all_points, &deltas, &plan->head_maxp_info, &composite_contours, false, false)) + head_maxp_info_t *head_maxp_info_p = &plan->head_maxp_info; + unsigned *composite_contours_p = &composite_contours; + + // don't compute head/maxp values when glyph has no contours(type is EMPTY) + // also ignore .notdef glyph when --notdef-outline is not enabled + if (type == EMPTY || + (gid == 0 && !(plan->flags & HB_SUBSET_FLAGS_NOTDEF_OUTLINE))) + { + head_maxp_info_p = nullptr; + composite_contours_p = nullptr; + } + + if (!get_points (font, glyf, all_points, &deltas, head_maxp_info_p, composite_contours_p, false, false)) return false; // .notdef, set type to empty so we only update metrics and don't compile bytes for diff --git a/test/subset/data/expected/instance_no_double_free/Handjet.default.retain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf b/test/subset/data/expected/instance_no_double_free/Handjet.default.retain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf new file mode 100644 index 000000000..87aa06b31 Binary files /dev/null and b/test/subset/data/expected/instance_no_double_free/Handjet.default.retain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf differ diff --git a/test/subset/data/tests/instance_no_double_free.tests b/test/subset/data/tests/instance_no_double_free.tests index 6be859791..0e9f930fe 100644 --- a/test/subset/data/tests/instance_no_double_free.tests +++ b/test/subset/data/tests/instance_no_double_free.tests @@ -2,6 +2,7 @@ FONTS: Handjet.ttf PROFILES: +default.txt notdef-outline.txt SUBSETS: