diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 42fe78394..5df44997b 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -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 diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index c4a96bec3..d8774bea7 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -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 (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 diff --git a/src/hb-ot-face-table-list.hh b/src/hb-ot-face-table-list.hh index d52f98a78..526bea967 100644 --- a/src/hb-ot-face-table-list.hh +++ b/src/hb-ot-face-table-list.hh @@ -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) diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index b9f1b22db..9cd22f6d6 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -325,6 +325,8 @@ struct gvar_GVAR using GlyphVariationData = TupleVariationData; + 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 (face);