diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index d81640bd5..31d1629dc 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -149,7 +149,19 @@ struct glyf const hb_subset_plan_t *plan) { TRACE_SERIALIZE (this); + unsigned init_len = c->length (); for (const auto &_ : it) _.serialize (c, plan); + + /* As a special case when all glyph in the font are empty, add a zero byte + * to the table, so that OTS doesn’t reject it, and to make the table work + * on Windows as well. + * See https://github.com/khaledhosny/ots/issues/52 */ + if (init_len == c->length ()) + { + HBUINT8 empty_byte; + empty_byte = 0; + c->copy (empty_byte); + } return_trace (true); } diff --git a/test/subset/data/expected/colr/TwemojiMozilla.subset.default.32.ttf b/test/subset/data/expected/colr/TwemojiMozilla.subset.default.32.ttf index b7d70ade9..136e15db8 100644 Binary files a/test/subset/data/expected/colr/TwemojiMozilla.subset.default.32.ttf and b/test/subset/data/expected/colr/TwemojiMozilla.subset.default.32.ttf differ diff --git a/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints-retain-gids.32.ttf b/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints-retain-gids.32.ttf index 279f15bbe..f69b0c5d4 100644 Binary files a/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints-retain-gids.32.ttf and b/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints-retain-gids.32.ttf differ diff --git a/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints.32.ttf b/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints.32.ttf index 279f15bbe..f69b0c5d4 100644 Binary files a/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints.32.ttf and b/test/subset/data/expected/colr/TwemojiMozilla.subset.drop-hints.32.ttf differ diff --git a/test/subset/data/expected/colr/TwemojiMozilla.subset.retain-gids.32.ttf b/test/subset/data/expected/colr/TwemojiMozilla.subset.retain-gids.32.ttf index b7d70ade9..136e15db8 100644 Binary files a/test/subset/data/expected/colr/TwemojiMozilla.subset.retain-gids.32.ttf and b/test/subset/data/expected/colr/TwemojiMozilla.subset.retain-gids.32.ttf differ