[instancer] dont return false when variation data is empty after partial instancing

This commit is contained in:
Qunxin Liu 2024-08-12 14:08:06 -07:00 committed by Garret Rieger
parent f35b0a63b1
commit 72502ef02b
6 changed files with 28 additions and 4 deletions

View file

@ -2339,7 +2339,11 @@ struct COLR
c->plan->colrv1_varstore_inner_maps.as_array ()))
return_trace (false);
if (!out->varStore.serialize_serialize (c->serializer,
/* do not serialize varStore if there's no variation data after
* instancing: region_list or var_data is empty */
if (item_vars.get_region_list () &&
item_vars.get_vardata_encodings () &&
!out->varStore.serialize_serialize (c->serializer,
item_vars.has_long_word (),
c->plan->axis_tags,
item_vars.get_region_list (),
@ -2347,7 +2351,9 @@ struct COLR
return_trace (false);
/* if varstore is optimized, update colrv1_new_deltaset_idx_varidx_map in
* subset plan */
* subset plan.
* If varstore is empty after instancing, varidx_map would be empty and
* all var_idxes will be updated to VarIdx::NO_VARIATION */
if (optimize)
{
const hb_map_t &varidx_map = item_vars.get_varidx_map ();

View file

@ -1663,7 +1663,9 @@ struct item_variations_t
}
}
if (!all_regions || !all_unique_regions) return false;
/* regions are empty means no variation data, return true */
if (!all_regions || !all_unique_regions) return true;
if (!region_list.alloc (all_regions.get_population ()))
return false;
@ -1728,7 +1730,8 @@ struct item_variations_t
bool as_item_varstore (bool optimize=true, bool use_no_variation_idx=true)
{
if (!region_list) return false;
/* return true if no variation data */
if (!region_list) return true;
unsigned num_cols = region_list.length;
/* pre-alloc a 2D vector for all sub_table's VarData rows */
unsigned total_rows = 0;

Binary file not shown.

View file

@ -0,0 +1,14 @@
FONTS:
sixtyfour_subset.ttf
PROFILES:
default.txt
SUBSETS:
*
INSTANCES:
SCAN=0,XELA=0,YELA=0
OPTIONS:
no_fonttools

View file

@ -78,6 +78,7 @@ tests = [
'feature_variation_instance_collect_lookups',
'sync_vmetrics',
'empty_region_vardata',
'colrv1_partial_instance',
]
if get_option('experimental_api')