Failing-malloc fuzzing exposed two holes in the GPU draw path.
Accumulation ignored push failures, and encode reused scratch vectors
that could remain poisoned after a previous allocation failure.
Poison the draw object on accumulator OOM, bail out of the remaining
path-building callbacks, and have hb_gpu_draw_encode() return NULL once
the object has failed. Also check the encode scratch resizes and reset
poisoned vectors before reuse. Resetting the draw now fully resets the
curve vector as well, so callers can recover after an OOM by calling
hb_gpu_draw_reset().
Testing:
- meson test -C build --suite fuzzing --print-errorlogs
- meson test -C build
Co-authored-by: OpenAI Codex <codex@openai.com>
Document that raster, vector, and gpu still must not crash,
access out of bounds, or corrupt memory under failing-malloc,
but best-effort early failure is acceptable and complex rollback
logic is not required after OOM.
Co-authored-by: OpenAI Codex <codex@openai.com>
Add an explicit commit-guidance rule to keep each commit focused on a
single issue or concern, instead of combining unrelated fixes,
renames, refactors, or behavior changes.
Co-authored-by: OpenAI Codex <codex@openai.com>
Encode used adjacent endpoint equality to infer contour breaks, which
fails when two contours touch at the same point. Track contour starts
explicitly during accumulation instead, and use that flag when packing
shared endpoints.
Encode also rounded blob bounds to the nearest quarter unit. That can
shrink the encoded extents and clip coverage at glyph edges. Quantize
mins downward and maxes upward so the blob header always encloses the
actual geometry.
Add focused API tests for both regressions.
Testing:
- meson test -C build
Co-authored-by: OpenAI Codex <codex@openai.com>
Check navigator.gpu synchronously in main() before calling
the WebGPU C API. Previously the error was reported in an
async callback that raced with onRuntimeInitialized, which
hid the loading div before the error message could appear.
Also re-show the loading div and set window._webgpuError in
the adapter callback as a fallback.
Assisted-by: Claude <noreply@anthropic.com>
Docs are built in the dedicated docs CI workflow. Remove
gtk-doc-tools and disable docs in the Linux build.
Assisted-by: Claude <noreply@anthropic.com>
Compute pixelsPerEm once in hb_gpu_render and pass it down,
so MSAA samples share one fwidth call instead of each
computing their own. Required for WGSL (fwidth must be
called from uniform control flow) and a minor win for all
backends.
Assisted-by: Claude <noreply@anthropic.com>
Add hb_gpu_draw_set_scale() API and store x/y scale in the
glyph blob header (buf[1].b/a). hb_gpu_draw_glyph() sets it
automatically from the font.
hb_gpu_render() now reads the scale, computes ppem via fwidth,
and automatically blends 4 corner samples at ±1/3 pixel when
ppem < 16 to reduce moiré at small sizes. Define
HB_GPU_NO_MSAA to disable.
Add hb_gpu_ppem() public shader helper so clients can get
ppem without touching internal functions (e.g. for
hb_gpu_darken).
Remove hb_gpu_render_aaa(), u_upem uniform, and set_upem
plumbing from the demo — no longer needed.
GLSL only for now.
Assisted-by: Claude <noreply@anthropic.com>
Replace the two-program MSAA toggle with hb_gpu_render_aaa()
that takes ppem from the caller and auto-selects single-sample
(ppem >= 16) or 4-corner MSAA (ppem < 16). This keeps
hb_gpu_render() lean for the fast path while letting the
adaptive function handle small sizes.
The previous approach had the ppem calculation inside the
library shader using 1/fwidth(texcoord), which was wrong by
a factor of upem — MSAA fired at all sizes. Now the demo
passes correct ppem via a u_upem uniform.
Remove the 'm' key toggle, two-program compilation, and
set_msaa plumbing — no longer needed.
GLSL only for now.
Assisted-by: Claude <noreply@anthropic.com>
Use 4 samples at ±1/3 pixel corners instead of the full 3x3
grid. Diagonal placement provides good moiré reduction at
half the cost.
Assisted-by: Claude <noreply@anthropic.com>
The previous commit added the generation parameter to the
display interface but missed passing it from demo_view_display.
Assisted-by: Claude <noreply@anthropic.com>
The GL renderer cached the vertex buffer upload by comparing
the data pointer and count. After clearing and refilling the
buffer with a new font's glyphs, std::vector reused the same
allocation, so the pointer and count matched — the upload was
skipped and the GPU drew with stale vertex data containing old
atlas offsets.
Fix by adding a generation counter to demo_buffer_t that
increments on clear(). The renderer compares generation and
count to decide whether to re-upload.
Assisted-by: Claude <noreply@anthropic.com>
Add hb_gpu_render_msaa() that evaluates 9 samples (3x3 grid
at ±1/3 pixel) to reduce moiré at small sizes. GLSL only.
The demo compiles two shader programs and toggles between them
with the 'm' key, so the MSAA program's register pressure
does not affect the fast single-sample path.
Assisted-by: Claude <noreply@anthropic.com>
At ppem < 16, blend in 4 extra samples at ±1/3 pixel offsets
to reduce moiré patterns and aliasing at small sizes. The
blend factor transitions smoothly from full MSAA at ppem 8
to single-sample at ppem 16.
GLSL only for now; MSL, WGSL, and HLSL still use single-sample.
Assisted-by: Claude <noreply@anthropic.com>
The HB_NO_DRAW closure must run before the HB_NO_CFF closure
so that HB_NO_DRAW → HB_NO_CFF → HB_NO_OT_FONT_CFF propagates
correctly in a single pass.
Assisted-by: Claude <noreply@anthropic.com>
CFF parsing requires the draw infrastructure, so it belongs
in the HB_NO_DRAW closure rather than being unconditionally
disabled by HB_LEAN. This allows HB_LEAN and HB_TINY builds
that re-enable draw (via config-override.h) to also get CFF
support without explicitly undefining HB_NO_CFF.
Assisted-by: Claude <noreply@anthropic.com>
Implies --demo and --type '30=f ' (zoom 30x, fullscreen,
animate). Quits automatically after 3 fps reports.
Uses a GOption parse callback so --demo is set early enough
for the default font/text machinery.
Assisted-by: Claude <noreply@anthropic.com>
Allows simulating keyboard input at launch, e.g. -T '30= f'
zooms 30x, toggles fullscreen and starts animation.
Assisted-by: Claude <noreply@anthropic.com>
Show subset, raster, vector, GPU logos inline at 64px
next to the main HarfBuzz logo.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move raster, vector, GPU to Experimental. Remove hb-fontations
and hb-harfrust from the integration list.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add config.h with HB_LEAN and config-override.h to re-enable
draw, metrics, and variable font support. Strips color, paint,
math, bitmap, deprecated APIs, and other unused features.
WebGL: 635KB → 513KB (-19%)
WebGPU: 655KB → 533KB (-19%)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dictionary-style definition with Persian etymology, calque
explanation, noun/adjective meanings, and logo description.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>