[ot-font] Keep vertical origins available without variations

The glyf vertical-origin path also handles static VARC-backed fonts, but
its point aggregator and origin helper were hidden by HB_NO_VAR. The
caller also accessed the absent gvar accelerator in that configuration.

Keep the static-capable helpers available and guard only variation cache
acquisition and release. Do not change glyph placement or origin math.

Testing: C++11 syntax checks of harfbuzz-world.cc with and without
HB_NO_VAR; full Meson suite: 281 passed, one skipped.

Assisted-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Behdad Esfahbod committed 2026-10-02 11:20:28 -06:00
1 parent c034548995
commit cafaa1d886
2 files changed
+7 -4

No files matched your search

+1 -3
View File
@@ -390,7 +390,6 @@ struct glyf_accelerator_t
public:
#ifndef HB_NO_VAR
struct points_aggregator_t
{
hb_font_t *font;
@@ -485,6 +484,7 @@ struct glyf_accelerator_t
: phantoms[glyf_impl::PHANTOM_RIGHT].x - phantoms[glyf_impl::PHANTOM_LEFT].x;
return hb_clamp (roundf (result), 0.f, (float) UINT_MAX / 2);
}
#endif
float
get_v_origin_with_var_unscaled (hb_codepoint_t gid,
@@ -508,8 +508,6 @@ struct glyf_accelerator_t
return phantoms[glyf_impl::PHANTOM_TOP].y;
}
#endif
#endif
public:
+6 -1
View File
@@ -734,9 +734,12 @@ hb_ot_get_glyph_v_origins (hb_font_t *font,
ot_font->v_origin.release_origin_cache (origin_cache);
return false;
}
OT::hb_scalar_cache_t *gvar_cache = font->has_nonzero_coords ?
OT::hb_scalar_cache_t *gvar_cache = nullptr;
#ifndef HB_NO_VAR
gvar_cache = font->has_nonzero_coords ?
ot_font->draw.acquire_gvar_cache (*ot_face->gvar) :
nullptr;
#endif
for (unsigned i = 0; i < count; i++)
{
@@ -756,8 +759,10 @@ hb_ot_get_glyph_v_origins (hb_font_t *font,
first_y = &StructAtOffsetUnaligned<hb_position_t> (first_y, y_stride);
}
#ifndef HB_NO_VAR
if (gvar_cache)
ot_font->draw.release_gvar_cache (gvar_cache);
#endif
glyf.release_scratch (scratch);
ot_font->v_origin.release_origin_cache (origin_cache);
return true;