[subset] layout_features filtering fix

we should not use get_size (), which returns length * item_size
This commit is contained in:
Qunxin Liu authored and Behdad Esfahbod committed 2021-11-25 11:24:41 -07:00
1 parent 3160789701
commit 903a6baece
12 files changed
+29 -3

No files matched your search

+15 -3
View File
@@ -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,
+1
View File
@@ -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 \
+1
View File
@@ -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 \
Binary file not shown.
@@ -0,0 +1,11 @@
FONTS:
FranklinGothic-Regular.ttf
PROFILES:
layout-test.txt
default.txt
retain-gids.txt
SUBSETS:
achi
*
+1
View File
@@ -33,6 +33,7 @@ tests = [
'layout.duplicate_features',
'layout.unsorted_featurelist',
'layout.drop_feature',
'layout.default_features',
'cmap',
'cmap14',
'sbix',