mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 16:31:14 +01:00
Add web_set_variations(const char *) to both the WebGL and WebGPU hb-gpu-web wasm modules. Parses a comma-separated "wght=400,wdth=100" string via hb_variation_from_string, applies via hb_font_set_variations on the current font, and rebuilds the shaping buffer. Cheap to call repeatedly -- suitable for live slider pushes once a slider UI lands. Shell.html grows a matching applyVariations() helper and a 'variations' postMessage case. config-override.h undefs HB_NO_VAR so the new function actually links. EXPORTED _FUNCTIONS on both build scripts list _web_set_variations. Also plumbed in a small cap (32 axes) on the stack so the parser doesn't need hb's internal containers -- no font has anywhere near that many. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8 lines
387 B
C
8 lines
387 B
C
/* Re-enable features that HB_LEAN disables but the GPU demo needs. */
|
|
|
|
#undef HB_NO_DRAW /* GPU encoder uses draw API */
|
|
#undef HB_NO_METRICS /* Glyph advances / extents */
|
|
#undef HB_NO_COLOR /* COLR palette / layers for paint encoder */
|
|
#undef HB_NO_PAINT /* Paint pipeline the paint encoder walks */
|
|
#undef HB_NO_VAR /* hb_font_set_variations for live axis updates */
|