Hide all mentions of name_table_overrides behind EXPERIMENTAL_API
Fixes https://github.com/harfbuzz/harfbuzz/issues/3872
This commit is contained in:
parent
ebc382a847
commit
f6076890c5
|
@ -142,14 +142,19 @@ struct NameRecord
|
|||
return UNSUPPORTED;
|
||||
}
|
||||
|
||||
NameRecord* copy (hb_serialize_context_t *c, const void *base,
|
||||
const hb_hashmap_t<unsigned, hb_bytes_t> *name_table_overrides) const
|
||||
NameRecord* copy (hb_serialize_context_t *c, const void *base
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
, const hb_hashmap_t<unsigned, hb_bytes_t> *name_table_overrides
|
||||
#endif
|
||||
) const
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
auto snap = c->snapshot ();
|
||||
HB_UNUSED auto snap = c->snapshot ();
|
||||
auto *out = c->embed (this);
|
||||
if (unlikely (!out)) return_trace (nullptr);
|
||||
if (name_table_overrides->has (nameID)) {
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
if (name_table_overrides->has (nameID))
|
||||
{
|
||||
hb_bytes_t name_bytes = name_table_overrides->get (nameID);
|
||||
unsigned text_size = hb_ot_name_convert_utf<hb_utf8_t, hb_utf16_be_t> (name_bytes, nullptr, nullptr);
|
||||
|
||||
|
@ -177,7 +182,10 @@ struct NameRecord
|
|||
utf16_be_bytes.copy (c);
|
||||
c->add_link (out->offset, c->pop_pack (), hb_serialize_context_t::Tail, 0);
|
||||
hb_free (name_str_utf16_be);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
out->offset.serialize_copy (c, offset, base, 0, hb_serialize_context_t::Tail, length);
|
||||
}
|
||||
return_trace (out);
|
||||
|
@ -293,8 +301,11 @@ struct name
|
|||
hb_requires (hb_is_source_of (Iterator, const NameRecord &))>
|
||||
bool serialize (hb_serialize_context_t *c,
|
||||
Iterator it,
|
||||
const void *src_string_pool,
|
||||
const hb_hashmap_t<unsigned, hb_bytes_t> *name_table_overrides)
|
||||
const void *src_string_pool
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
, const hb_hashmap_t<unsigned, hb_bytes_t> *name_table_overrides
|
||||
#endif
|
||||
)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
||||
|
@ -316,7 +327,12 @@ struct name
|
|||
|
||||
records.qsort ();
|
||||
|
||||
c->copy_all (records, src_string_pool, name_table_overrides);
|
||||
c->copy_all (records,
|
||||
src_string_pool
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
, name_table_overrides
|
||||
#endif
|
||||
);
|
||||
hb_free (records.arrayZ);
|
||||
|
||||
|
||||
|
@ -345,7 +361,12 @@ struct name
|
|||
})
|
||||
;
|
||||
|
||||
name_prime->serialize (c->serializer, it, std::addressof (this + stringOffset), c->plan->name_table_overrides);
|
||||
name_prime->serialize (c->serializer,
|
||||
it, std::addressof (this + stringOffset)
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
, c->plan->name_table_overrides
|
||||
#endif
|
||||
);
|
||||
return_trace (name_prime->count);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,9 +49,15 @@ hb_subset_input_create_or_fail (void)
|
|||
set = hb_set_create ();
|
||||
|
||||
input->axes_location = hb_hashmap_create<hb_tag_t, float> ();
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
input->name_table_overrides = hb_hashmap_create<unsigned, hb_bytes_t> ();
|
||||
#endif
|
||||
|
||||
if (!input->axes_location || !input->name_table_overrides || input->in_error ())
|
||||
if (!input->axes_location ||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
!input->name_table_overrides ||
|
||||
#endif
|
||||
input->in_error ())
|
||||
{
|
||||
hb_subset_input_destroy (input);
|
||||
return nullptr;
|
||||
|
@ -249,13 +255,14 @@ hb_subset_input_destroy (hb_subset_input_t *input)
|
|||
|
||||
hb_hashmap_destroy (input->axes_location);
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
if (input->name_table_overrides)
|
||||
{
|
||||
for (auto _ : input->name_table_overrides->values ())
|
||||
_.fini ();
|
||||
}
|
||||
|
||||
hb_hashmap_destroy (input->name_table_overrides);
|
||||
#endif
|
||||
|
||||
hb_free (input);
|
||||
}
|
||||
|
@ -487,7 +494,9 @@ hb_subset_preprocess (hb_face_t *source)
|
|||
|
||||
return new_source;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
/**
|
||||
* hb_subset_input_override_name_table:
|
||||
* @input: a #hb_subset_input_t object.
|
||||
|
|
|
@ -61,7 +61,9 @@ struct hb_subset_input_t
|
|||
unsigned flags;
|
||||
bool attach_accelerator_data = false;
|
||||
hb_hashmap_t<hb_tag_t, float> *axes_location;
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
hb_hashmap_t<unsigned, hb_bytes_t> *name_table_overrides;
|
||||
#endif
|
||||
|
||||
inline unsigned num_sets () const
|
||||
{
|
||||
|
@ -81,7 +83,11 @@ struct hb_subset_input_t
|
|||
return true;
|
||||
}
|
||||
|
||||
return axes_location->in_error () || name_table_overrides->in_error ();
|
||||
return axes_location->in_error ()
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
|| name_table_overrides->in_error ()
|
||||
#endif
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -848,6 +848,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
|||
plan->check_success (plan->vmtx_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ());
|
||||
plan->check_success (plan->hmtx_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ());
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
plan->check_success (plan->name_table_overrides = hb_hashmap_create<unsigned, hb_bytes_t> ());
|
||||
if (plan->name_table_overrides && input->name_table_overrides)
|
||||
{
|
||||
|
@ -869,7 +870,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
|||
plan->name_table_overrides->set (name_id, hb_bytes_t (name_str, len));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void* accel = hb_face_get_user_data(face, hb_subset_accelerator_t::user_data_key());
|
||||
|
||||
|
|
|
@ -87,12 +87,14 @@ struct hb_subset_plan_t
|
|||
hb_hashmap_destroy (vmtx_map);
|
||||
hb_hashmap_destroy (layout_variation_idx_delta_map);
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
if (name_table_overrides)
|
||||
{
|
||||
for (auto _ : name_table_overrides->values ())
|
||||
_.fini ();
|
||||
}
|
||||
hb_hashmap_destroy (name_table_overrides);
|
||||
#endif
|
||||
|
||||
if (user_axes_location)
|
||||
{
|
||||
|
@ -198,9 +200,11 @@ struct hb_subset_plan_t
|
|||
//vmtx metrics map: new gid->(advance, lsb)
|
||||
hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *vmtx_map;
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
// name table overrides map: name_id->name string new value or None
|
||||
// to indicate should remove
|
||||
hb_hashmap_t<unsigned, hb_bytes_t> *name_table_overrides;
|
||||
#endif
|
||||
|
||||
const hb_subset_accelerator_t* accelerator;
|
||||
|
||||
|
|
Loading…
Reference in New Issue