mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 18:13:53 +01:00
[subset] Skip remaining instancing paths for avar2
Add has_avar2 guards to all remaining tables that apply variation deltas to base values using normalized_coords: - post: skip MVAR delta application to underline metrics - OS/2: skip MVAR delta application to typo/win/sub/super metrics - head: skip updating xMin/xMax/yMin/yMax from instanced bounds - maxp: skip instancing_update_fields - glyf-helpers: skip head bounds update from instanced glyphs - COLR: skip VarStore instancing and paint value delta folding - BASE: route to non-instancing VarStore subset path For avar2, base values must remain unchanged because the offset compensation keeps all variation data in the original coordinate space. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0428189b2c
commit
483bd446cb
7 files changed
+10
-10
No files matched your search
@@ -2437,7 +2437,7 @@ struct COLR
|
||||
return_trace (true);
|
||||
|
||||
const ItemVariationStore& var_store = this+varStore;
|
||||
if (c->plan->normalized_coords)
|
||||
if (c->plan->normalized_coords && !c->plan->has_avar2)
|
||||
{
|
||||
item_variations_t item_vars;
|
||||
/* turn off varstore optimization when varIdxMap is null, so we maintain
|
||||
@@ -2587,9 +2587,9 @@ struct COLR
|
||||
* after instancing */
|
||||
if (!subset_varstore (c, colr_prime)) return_trace (false);
|
||||
|
||||
ItemVarStoreInstancer instancer (get_var_store_ptr (),
|
||||
get_delta_set_index_map_ptr (),
|
||||
c->plan->normalized_coords.as_array ());
|
||||
ItemVarStoreInstancer instancer (c->plan->has_avar2 ? nullptr : get_var_store_ptr (),
|
||||
c->plan->has_avar2 ? nullptr : get_delta_set_index_map_ptr (),
|
||||
c->plan->has_avar2 ? hb_array<const int> () : c->plan->normalized_coords.as_array ());
|
||||
|
||||
if (!colr_prime->baseGlyphList.serialize_subset (c, baseGlyphList, this, instancer))
|
||||
return_trace (false);
|
||||
|
||||
@@ -64,7 +64,7 @@ _add_head_and_set_loca_version (hb_subset_plan_t *plan, bool use_short_loca)
|
||||
|
||||
head *head_prime = (head *) hb_blob_get_data_writable (head_prime_blob, nullptr);
|
||||
head_prime->indexToLocFormat = use_short_loca ? 0 : 1;
|
||||
if (plan->normalized_coords)
|
||||
if (plan->normalized_coords && !plan->has_avar2)
|
||||
{
|
||||
head_prime->xMin = plan->head_maxp_info.xMin;
|
||||
head_prime->xMax = plan->head_maxp_info.xMax;
|
||||
|
||||
@@ -66,7 +66,7 @@ struct head
|
||||
head *out = c->serializer->embed (this);
|
||||
if (unlikely (!out)) return_trace (false);
|
||||
|
||||
if (c->plan->normalized_coords)
|
||||
if (c->plan->normalized_coords && !c->plan->has_avar2)
|
||||
{
|
||||
if (unlikely (!c->serializer->check_assign (out->xMin, c->plan->head_maxp_info.xMin,
|
||||
HB_SERIALIZE_ERROR_INT_OVERFLOW)))
|
||||
|
||||
@@ -726,7 +726,7 @@ struct BASE
|
||||
TRACE_SUBSET (this);
|
||||
if (!c->serializer->allocate_size<Offset32To<ItemVariationStore>> (Offset32To<ItemVariationStore>::static_size))
|
||||
return_trace (false);
|
||||
if (!c->plan->normalized_coords)
|
||||
if (!c->plan->normalized_coords || c->plan->has_avar2)
|
||||
return_trace (out->varStore.serialize_subset (c, varStore, this, c->plan->base_varstore_inner_maps.as_array ()));
|
||||
|
||||
if (c->plan->all_axes_pinned)
|
||||
|
||||
@@ -111,7 +111,7 @@ struct maxp
|
||||
if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
|
||||
drop_hint_fields (dest_v1);
|
||||
|
||||
if (c->plan->normalized_coords)
|
||||
if (c->plan->normalized_coords && !c->plan->has_avar2)
|
||||
instancing_update_fields (c->plan->head_maxp_info, dest_v1);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ struct OS2
|
||||
if (unlikely (!os2_prime)) return_trace (false);
|
||||
|
||||
#ifndef HB_NO_VAR
|
||||
if (c->plan->normalized_coords)
|
||||
if (c->plan->normalized_coords && !c->plan->has_avar2)
|
||||
{
|
||||
auto &MVAR = *c->plan->source->table.MVAR;
|
||||
auto *table = os2_prime;
|
||||
|
||||
@@ -103,7 +103,7 @@ struct post
|
||||
return_trace (false);
|
||||
|
||||
#ifndef HB_NO_VAR
|
||||
if (c->plan->normalized_coords)
|
||||
if (c->plan->normalized_coords && !c->plan->has_avar2)
|
||||
{
|
||||
auto &MVAR = *c->plan->source->table.MVAR;
|
||||
auto *table = post_prime;
|
||||
|
||||
Reference in new issue
Block a user