[GVAR] Hook up to face and glyf table

This commit is contained in:
Behdad Esfahbod 2025-02-26 13:41:52 -07:00
parent ffe955b9f9
commit 13900ce40d
4 changed files with 22 additions and 5 deletions

View file

@ -386,11 +386,20 @@ struct Glyph
#ifndef HB_NO_VAR
if (coords)
glyf_accelerator.gvar->apply_deltas_to_points (gid,
coords,
points.as_array ().sub_array (old_length),
scratch,
phantom_only && type == SIMPLE);
{
if (glyf_accelerator.GVAR->has_data ())
glyf_accelerator.GVAR->apply_deltas_to_points (gid,
coords,
points.as_array ().sub_array (old_length),
scratch,
phantom_only && type == SIMPLE);
else
glyf_accelerator.gvar->apply_deltas_to_points (gid,
coords,
points.as_array ().sub_array (old_length),
scratch,
phantom_only && type == SIMPLE);
}
#endif
// mainly used by CompositeGlyph calculating new X/Y offset value so no need to extend it

View file

@ -172,6 +172,7 @@ struct glyf_accelerator_t
glyf_table = nullptr;
#ifndef HB_NO_VAR
gvar = nullptr;
GVAR = nullptr;
#endif
hmtx = nullptr;
#ifndef HB_NO_VERTICAL
@ -187,6 +188,7 @@ struct glyf_accelerator_t
glyf_table = hb_sanitize_context_t ().reference_table<glyf> (face);
#ifndef HB_NO_VAR
gvar = face->table.gvar;
GVAR = face->table.GVAR;
#endif
hmtx = face->table.hmtx;
#ifndef HB_NO_VERTICAL
@ -512,6 +514,7 @@ struct glyf_accelerator_t
#ifndef HB_NO_VAR
const gvar_accelerator_t *gvar;
const GVAR_accelerator_t *GVAR;
#endif
const hmtx_accelerator_t *hmtx;
#ifndef HB_NO_VERTICAL

View file

@ -95,6 +95,7 @@ HB_OT_CORE_TABLE (OT, fvar)
HB_OT_CORE_TABLE (OT, avar)
HB_OT_CORE_TABLE (OT, cvar)
HB_OT_ACCELERATOR (OT, gvar)
HB_OT_ACCELERATOR (OT, GVAR)
HB_OT_CORE_TABLE (OT, MVAR)
#ifndef HB_NO_VAR_COMPOSITES
HB_OT_ACCELERATOR (OT, VARC)

View file

@ -325,6 +325,8 @@ struct gvar_GVAR
using GlyphVariationData = TupleVariationData<GidOffsetType>;
bool has_data () const { return version.to_int () != 0; }
bool sanitize_shallow (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -582,6 +584,8 @@ struct gvar_GVAR
public:
struct accelerator_t
{
bool has_data () const { return table->has_data (); }
accelerator_t (hb_face_t *face)
{
table = hb_sanitize_context_t ().reference_table<gvar_GVAR> (face);