[subset] offset format fix in gvar table

pull/4529/head
Qunxin Liu 5 months ago committed by Garret Rieger
parent 63d09dbefc
commit 6fd76e1f67
  1. 10
      src/hb-ot-var-gvar-table.hh
  2. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.default.all.ttf
  3. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.all.ttf
  4. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.all.ttf
  5. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.gids.all.ttf
  6. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.glyph-names.all.ttf
  7. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.keep-all-layout-features.all.ttf
  8. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.layout-features.all.ttf
  9. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.all.ttf
  10. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.name-languages.all.ttf
  11. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.name-legacy.all.ttf
  12. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.no-prune-unicode-ranges.all.ttf
  13. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.notdef-outline.all.ttf
  14. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids-glyph-names.all.ttf
  15. BIN
      test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.all.ttf
  16. BIN
      test/subset/data/expected/update_def_wght/SourceSerifVariable-Roman.default.all.wght=300-600.iup_optimize.ttf
  17. BIN
      test/subset/data/expected/update_def_wght/SourceSerifVariable-Roman.default.all.wght=300-600.ttf

@ -359,7 +359,10 @@ struct gvar
out->glyphCountX = hb_min (0xFFFFu, num_glyphs);
unsigned glyph_var_data_size = glyph_vars.compiled_byte_size ();
bool long_offset = glyph_var_data_size & ~0xFFFFu || force_long_offsets;
/* According to the spec: If the short format (Offset16) is used for offsets,
* the value stored is the offset divided by 2, so the maximum data size should
* be 2 * 0xFFFFu, which is 0x1FFFEu */
bool long_offset = glyph_var_data_size > 0x1FFFEu || force_long_offsets;
out->flags = long_offset ? 1 : 0;
HBUINT8 *glyph_var_data_offsets = c->allocate_size<HBUINT8> ((long_offset ? 4 : 2) * (num_glyphs + 1), false);
@ -440,7 +443,10 @@ struct gvar
subset_data_size += get_glyph_var_data_bytes (c->source_blob, glyph_count, old_gid).length;
}
bool long_offset = (subset_data_size & ~0xFFFFu);
/* According to the spec: If the short format (Offset16) is used for offsets,
* the value stored is the offset divided by 2, so the maximum data size should
* be 2 * 0xFFFFu, which is 0x1FFFEu */
bool long_offset = subset_data_size > 0x1FFFEu;
#ifdef HB_EXPERIMENTAL_API
long_offset = long_offset || (c->plan->flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS);
#endif

Loading…
Cancel
Save