[subset] layout_features filtering fix

we should not use get_size (), which returns length * item_size
pull/3306/head
Qunxin Liu 3 years ago committed by Behdad Esfahbod
parent 3160789701
commit 903a6baece
  1. 18
      src/hb-subset-plan.cc
  2. 1
      test/subset/data/Makefile.am
  3. 1
      test/subset/data/Makefile.sources
  4. BIN
      test/subset/data/expected/layout.default_features/FranklinGothic-Regular.default.61,63,68,69.ttf
  5. BIN
      test/subset/data/expected/layout.default_features/FranklinGothic-Regular.default.retain-all-codepoint.ttf
  6. BIN
      test/subset/data/expected/layout.default_features/FranklinGothic-Regular.layout-test.61,63,68,69.ttf
  7. BIN
      test/subset/data/expected/layout.default_features/FranklinGothic-Regular.layout-test.retain-all-codepoint.ttf
  8. BIN
      test/subset/data/expected/layout.default_features/FranklinGothic-Regular.retain-gids.61,63,68,69.ttf
  9. BIN
      test/subset/data/expected/layout.default_features/FranklinGothic-Regular.retain-gids.retain-all-codepoint.ttf
  10. BIN
      test/subset/data/fonts/FranklinGothic-Regular.ttf
  11. 11
      test/subset/data/tests/layout.default_features.tests
  12. 1
      test/subset/meson.build

@ -100,11 +100,23 @@ static void _collect_layout_indices (hb_face_t *face,
if (!features.alloc (table.get_feature_count () + 1))
return;
hb_set_t visited_features;
bool retain_all_features = true;
for (unsigned i = 0; i < table.get_feature_count (); i++)
{
hb_tag_t tag = table.get_feature_tag (i);
if (tag && layout_features_to_retain->has (tag))
features.push (tag);
if (!tag) continue;
if (!layout_features_to_retain->has (tag))
{
retain_all_features = false;
continue;
}
if (visited_features.has (tag))
continue;
features.push (tag);
visited_features.add (tag);
}
if (!features)
@ -113,7 +125,7 @@ static void _collect_layout_indices (hb_face_t *face,
// The collect function needs a null element to signal end of the array.
features.push (0);
if (features.get_size () == table.get_feature_count () + 1)
if (retain_all_features)
{
// Looking for all features, trigger the faster collection method.
layout_collect_func (face,

@ -38,6 +38,7 @@ EXTRA_DIST += \
expected/layout.gdef-attachlist \
expected/layout.notonastaliqurdu \
expected/layout.tinos \
expected/layout.default_features \
expected/layout.duplicate_features \
expected/layout.unsorted_featurelist \
expected/layout.drop_feature \

@ -36,6 +36,7 @@ TESTS = \
tests/layout.notonastaliqurdu.tests \
tests/layout.tests \
tests/layout.tinos.tests \
tests/layout.default_features.tests \
tests/layout.duplicate_features.tests \
tests/layout.unsorted_featurelist.tests \
tests/layout.drop_feature.tests \

@ -0,0 +1,11 @@
FONTS:
FranklinGothic-Regular.ttf
PROFILES:
layout-test.txt
default.txt
retain-gids.txt
SUBSETS:
achi
*

@ -33,6 +33,7 @@ tests = [
'layout.duplicate_features',
'layout.unsorted_featurelist',
'layout.drop_feature',
'layout.default_features',
'cmap',
'cmap14',
'sbix',

Loading…
Cancel
Save