Commit Graph
20923 Commits
Author SHA1 Message Date
Behdad EsfahbodandOpenAI Codex c111ff82ff [gpu] Fail cleanly on OOM in draw encode
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>
2026-04-03 16:29:27 -06:00
Behdad EsfahbodandOpenAI Codex 92b9b1ed82 [docs] Clarify OOM policy for experimental libraries
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>
2026-04-03 16:24:31 -06:00
Behdad EsfahbodandOpenAI Codex 63c7d00e75 [docs] Require single-issue commits in AGENTS.md
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>
2026-04-03 16:04:14 -06:00
Behdad EsfahbodandOpenAI Codex a4aff49856 [gpu] Fix contour breaks and bounds quantization in encode (#5892)
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>
2026-04-03 12:09:02 -06:00
Behdad Esfahbod 0234df4db6 [gpu] Fix WebGPU error page not showing when adapter unavailable
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>
2026-04-02 01:26:54 -06:00
Behdad Esfahbod 63cff45ae8 [ci] Disable docs build in Linux CI
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>
2026-04-02 01:22:44 -06:00
Behdad Esfahbod 72bd5d3ae7 [ci] Move doc_tests from Linux CI to docs CI
The doc tests belong with the docs build, not the general
Linux build.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-02 01:22:03 -06:00
Behdad Esfahbod 84f15592dc [gpu] Hoist fwidth out of _hb_gpu_render_single
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>
2026-04-02 01:20:10 -06:00
Behdad Esfahbod 33baa306b2 [gpu] Fix docs for hb_gpu_draw_set_scale
Use XSince: REPLACEME and add to harfbuzz-sections.txt.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-02 01:19:42 -06:00
Behdad Esfahbod 60629a665d [gpu] Port scale/ppem/MSAA to MSL, WGSL, and HLSL shaders
Port the font-scale header, hb_gpu_ppem(), and adaptive MSAA
from hb_gpu_render() to all shader languages.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-02 01:11:07 -06:00
Behdad Esfahbod b4958570cf [gpu] Trim hb_gpu_render() doc comment
Assisted-by: Claude <noreply@anthropic.com>
2026-04-02 01:01:08 -06:00
Behdad Esfahbod e7c5b839eb [gpu] Store font scale in blob header; auto-MSAA in hb_gpu_render
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>
2026-04-02 00:59:39 -06:00
Behdad Esfahbod a255d9745b [gpu] Rework MSAA into hb_gpu_render_aaa with caller-provided ppem
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>
2026-04-02 00:40:49 -06:00
Behdad Esfahbod fcfed99ce0 [gpu] Reduce MSAA from 3x3 grid to 4 corner samples
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>
2026-04-02 00:21:12 -06:00
Behdad Esfahbod 39d3b83b47 [gpu] Add GLFW_KEY_M to web GL stub for MSAA toggle
Assisted-by: Claude <noreply@anthropic.com>
2026-04-02 00:19:04 -06:00
Behdad Esfahbod 4f9048cd27 Revert "Revert small-size MSAA experiment"
This reverts commit 3c291a5015.
2026-04-02 00:18:05 -06:00
Behdad Esfahbod 5eb52c7407 [gpu] Fix display() signature in D3D11, Metal, and WebGPU renderers
Drop HB_UNUSED from the generation parameter — it's not
available in MinGW or Emscripten build contexts.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-01 23:52:54 -06:00
Behdad Esfahbod 61db984844 [gpu] Pass buffer generation to renderer display
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>
2026-04-01 23:29:15 -06:00
Behdad Esfahbod c86cb51bf6 [gpu] Fix garbled rendering after font change in web demo
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>
2026-04-01 23:25:48 -06:00
Behdad Esfahbod 3c291a5015 Revert small-size MSAA experiment
Reverts dc19a8002 and 7ac851ab6.  The improvement was not
worth the complexity or performance cost.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-01 23:09:36 -06:00
Behdad Esfahbod dc19a8002a [gpu] Add optional MSAA mode for small-size antialiasing
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>
2026-04-01 23:08:30 -06:00
Behdad Esfahbod 7ac851ab6f [gpu] Add small-size MSAA to reduce moiré aliasing
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>
2026-04-01 22:50:46 -06:00
Behdad Esfahbod 5151ae0b34 [config] Fix HB_TINY build after HB_NO_CFF closure move
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>
2026-04-01 15:03:53 -06:00
Behdad Esfahbod bd645e5573 [config] Move HB_NO_CFF from HB_LEAN to HB_NO_DRAW closure
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>
2026-04-01 14:58:49 -06:00
Khaled Hosny a243dcb5c4 [ci] Fix docs deploy
We now have a subdir (hb-gpu-demo) so  needs .
2026-04-01 15:05:28 +02:00
Khaled Hosny da69b6585c 14.0.0 14.0.0 2026-04-01 14:54:05 +02:00
Behdad Esfahbod 4b2bce0d74 [gpu] Disable vsync in --bench mode
Pre-type 'v' before zoom/fullscreen/animate so that
benchmarking measures uncapped frame rate.

Assisted-by: Claude <noreply@anthropic.com>
2026-03-31 19:32:07 -06:00
Behdad Esfahbod 90e2f5f8b9 [docs] Update vector and subset library logos
New artwork from hb-libs2.png.

Assisted-by: Claude <noreply@anthropic.com>
2026-03-31 19:16:46 -06:00
Behdad Esfahbod 5d24cb5bf3 [gpu] Add --bench option for automated benchmarking
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>
2026-03-31 16:25:05 -06:00
Behdad Esfahbod 6c1bd94816 [gpu] Add --type / -T option to replay keystrokes on startup
Allows simulating keyboard input at launch, e.g. -T '30= f'
zooms 30x, toggles fullscreen and starts animation.

Assisted-by: Claude <noreply@anthropic.com>
2026-03-31 16:12:25 -06:00
Behdad Esfahbod 355bd4b011 Tweak logos 2026-03-31 11:31:42 -06:00
Behdad EsfahbodandClaude Opus 4.6 be79d54265 [docs] Point to GitHub README for overview, clarify this is API reference
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:39:15 -06:00
Behdad EsfahbodandClaude Opus 4.6 c68696c4fa [docs] Update docs opening paragraph
Mention subsetting, rasterization, GPU, and platform integrations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:34:24 -06:00
Behdad EsfahbodandClaude Opus 4.6 30ed85024d [docs] Add library logos to docs front page
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>
2026-03-31 00:31:59 -06:00
Behdad EsfahbodandClaude Opus 4.6 2a31d1c745 [docs] Add per-library logos
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:22:06 -06:00
Behdad EsfahbodandClaude Opus 4.6 9705be1315 Remove HB_NO_VAR_COMPOSITES and HB_NO_VAR_HVF from HB_MINI
These should not be disabled in HB_MINI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:36:31 -06:00
Behdad EsfahbodandClaude Opus 4.6 94be1485ae [gpu] Use HB_TINY for web demo builds
HB_TINY = HB_LEAN + HB_MINI + HB_OPTIMIZE_SIZE_MORE.

WebGL: 635KB → 351KB (-45%)
WebGPU: 655KB → 371KB (-43%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:35:10 -06:00
Behdad EsfahbodandClaude Opus 4.6 7dda04c95e [docs] Reorganize README libraries into Core and Experimental
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>
2026-03-30 22:31:50 -06:00
Behdad EsfahbodandClaude Opus 4.6 73616f9808 [gpu] Drop HB_NO_VAR override now that draw works without gvar
WebGL: 513KB → 478KB, WebGPU: 533KB → 498KB.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:23:49 -06:00
Behdad EsfahbodandClaude Opus 4.6 e96cbf4a12 [gpu] Shrink web demo WASM with HB_LEAN
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>
2026-03-30 22:18:06 -06:00
Behdad EsfahbodandClaude Opus 4.6 664085f0ae Remove HB_NO_OT_SHAPE_FRACTIONS from HB_LEAN
Fractions shaping should never be disabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:17:34 -06:00
Behdad Esfahbod 4d8aec2d3f Revert "[gpu] Hint --demo when no font file is provided"
This reverts commit 452f742628.
2026-03-30 21:00:03 -06:00
Behdad EsfahbodandClaude Opus 4.6 452f742628 [gpu] Hint --demo when no font file is provided
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:59:48 -06:00
Behdad EsfahbodandClaude Opus 4.6 c332f7210f [docs] Add hb-raster and hb-vector to README tools table
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:56:59 -06:00
Behdad EsfahbodandClaude Opus 4.6 b2cac8f6f0 [docs] hb-gpu is a tool, not just a demo
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:55:31 -06:00
Behdad EsfahbodandClaude Opus 4.6 b26f1a8bc1 [docs] Rename "Core libraries" to "Libraries", update NEWS
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:48:15 -06:00
Behdad EsfahbodandClaude Opus 4.6 491cd26af3 [docs] Remove "complex" from text shaping description
HarfBuzz shapes all text, not just complex scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:41:59 -06:00
Behdad EsfahbodandClaude Opus 4.6 7caa958327 [docs] Expand Name section with etymology and logo description
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>
2026-03-30 20:39:34 -06:00
Behdad EsfahbodandClaude Opus 4.6 7a95244bf3 [docs] Simplify Download section in README
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:34:57 -06:00
Behdad EsfahbodandClaude Opus 4.6 bcdede4464 [docs] Remove Wine note from README
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:33:36 -06:00