mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 06:21:16 +01:00
rebuild_buffer did free(current_text); strdup(text); but was often called with text == current_text (from web_load_font's "custom_text ? current_text : default"). Strdup of freed memory shaped garbage and made multi-char strings look like 1 char. Fix: strdup first, then free. The WebGL rebuild_buffer also called demo_view_display itself, which runs fine from a main loop tick but not from a fetch promise's microtask (the canvas back-buffer doesn't swap). Drop it: demo_view_reset sets needs_redraw=true, and the next main_loop_iter renders inside a proper rAF tick. Emscripten allocates argv on the JS stack, which is unwound when main returns. WebGPU's init is async and reads arg_text/arg_font after main returns, so those pointers were dangling -- early null bytes in freed stack memory made the emoji URL shape to 1 glyph. strdup them in main so they survive. Finally, forward ?font= to argv as --font= (already done for ?text=) so the C side's "skip initial default-font glyph upload when a font fetch is pending" path actually triggers. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>