Commit Graph
2680 Commits
Author SHA1 Message Date
Behdad Esfahbod a4ce5caeea Add handwriting fuzzer text trailers 2026-03-10 01:38:06 -03:00
Behdad Esfahbod acdf518d42 [fuzzing] Add noto handwriting color fonts
From https://github.com/googlefonts/color-fonts
2026-03-09 23:00:03 -03:00
Behdad Esfahbod b18092024a Add raster and vector fuzzers 2026-03-09 22:13:03 -03:00
Ze Sheng 3db272507d [fuzzer] Fix hb-set-fuzzer reading pointer address instead of input data (#5786)
reinterpret_cast<const instructions_t &>(data) reads the bytes of the
pointer variable itself (stack address, determined by ASLR), not the
fuzzer input buffer. This makes operation and first_set_size effectively
uncontrollable by the fuzzer.

Fix by dereferencing: reinterpret_cast<const instructions_t &>(*data)

This also removes the #pragma suppressing -Wstrict-aliasing, which was
warning about exactly this problem.

Coverage comparison (10-min libFuzzer run):
- Original: 15 lines (0.05%), 2 functions
- Fixed:   486 lines (1.47%), 144 functions (29x improvement)
2026-03-05 07:49:51 -07:00
Behdad Esfahbod 451f32c88e test/fuzzing: rename record-shape script 2026-03-04 17:11:12 -03:00
Behdad Esfahbod 19f54f2cfd Merge pull request #5784 from harfbuzz/downgrade-cff-hintmask
[subset] Fix CFF2->CFF1 specializer hintmask encoding
2026-03-04 12:55:54 -07:00
Behdad Esfahbod b7846647e4 Merge pull request #5781 from harfbuzz/better-fuzzing
Better fuzzing
2026-03-04 10:52:06 -07:00
Behdad Esfahbod d8d5068341 Fix shape fuzzer build 2026-03-04 14:33:24 -03:00
Behdad Esfahbod f111ed9d67 Add shared shape fuzzer seed support 2026-03-04 14:17:00 -03:00
Behdad Esfahbod 638ae0edc8 Support comment-prefixed fuzzing seeds 2026-03-04 14:07:40 -03:00
Behdad Esfahbod 6913fd88b8 [fuzzing] Add --downgrade-cff seed using new facilities 2026-03-04 14:07:08 -03:00
Behdad Esfahbod 7905d59aae Adjust subset seed recorder output paths 2026-03-04 13:59:15 -03:00
Behdad Esfahbod 7672d6bd52 [fuzzing] Add test for --downgrade-cff 2026-03-04 13:58:38 -03:00
Behdad Esfahbod c4ef89c63d Add extended hb-subset fuzzer seed recorder 2026-03-04 13:56:40 -03:00
Khaled Hosny b91d4b8d75 Add meson options to disable building harfbuzz-subset 2026-03-04 18:12:45 +02:00
Khaled Hosny 9520926168 Add meson options to disable building harfbuzz-raster 2026-03-04 18:12:45 +02:00
Behdad Esfahbod 90b252507d Update vector test expectations 2026-03-03 17:21:02 -03:00
Behdad Esfahbod ce292d3c10 [test/vector] Add Nastaliq Y-offset regression 2026-03-03 15:45:33 -03:00
Behdad Esfahbod ddafa6637c [test/vector] Handle empty option arrays in recorder 2026-03-03 15:45:28 -03:00
Behdad Esfahbod 12989d4e6a [util] Align vector/raster defaults with view and update vector baselines 2026-02-26 16:54:28 -03:00
Behdad Esfahbod 7929d24ed2 [test] Rename hb-vector-compare to hb-vector-svg-compare 2026-02-24 12:55:11 -03:00
Behdad Esfahbod 032c0931c1 [test] Remove old draw suite paths after vector rename 2026-02-24 10:17:32 -03:00
Behdad Esfahbod 6653d62480 [test/util] Rename draw suite and tools to vector 2026-02-24 10:17:18 -03:00
Behdad Esfahbod 3c099ee71c Add initial libharfbuzz-vector SVG backend and utility rename 2026-02-24 08:52:34 -03:00
Behdad Esfahbod 5ea04afcda raster: adopt create_or_fail and strict render semantics 2026-02-24 04:46:51 -03:00
Behdad Esfahbod 742f79da08 raster: remove extents_from_glyph_extents API
Remove hb_raster_extents_from_glyph_extents and switch callers to the new transform-aware set_glyph_extents APIs on raster draw/paint. Also add test coverage for transformed glyph extents and update section symbol listings.
2026-02-23 12:10:41 -03:00
Behdad EsfahbodandClaude Opus 4.6 3bed6db1d9 Move hb-draw-all, hb-paint-all, hb-raster-all to util/ as uninstalled binaries
Move perf tools from perf/ and test/raster/ to util/ alongside the
other uninstalled utilities.  Remove the now-empty test/raster/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-21 17:29:05 -03:00
Behdad EsfahbodandClaude Opus 4.6 7d008bf735 hb-raster: add hb_raster_draw_recycle_image() for zero-malloc rendering
Add API to recycle a rendered image back to the rasterizer.  The draw
object keeps the image and its buffer for reuse by the next render()
call.  After the first render+recycle cycle, render() does zero
mallocs (the image struct and pixel buffer are both reused).

Also switch hb_raster_image_t to use hb_vector_t<uint8_t> for its
pixel buffer so resize tracking is automatic.

Update hb-raster-all benchmark to use recycling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-21 17:29:05 -03:00
Behdad EsfahbodandClaude Sonnet 4.6 153c42522e hb-raster: add test/raster/hb-raster-all perf tool
Renders every glyph in a font through the rasterizer.
Args: font-file [font-size-px] [output-dir]
font-size defaults to upem; output-dir writes per-glyph PGMs when given.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 17:29:05 -03:00
Behdad EsfahbodandKhaled Hosny 99a84d7f02 Update src/hb-raster.h
Co-authored-by: Khaled Hosny <khaled@aliftype.com>
2026-02-21 17:29:05 -03:00
Behdad EsfahbodandClaude Sonnet 4.6 35ba082aa2 hb-raster: add test_glyph to test-raster
Renders glyph IDs 2-5 from fonts/adwaita.ttf at upem scale, writes
PGMs to /tmp/ for visual inspection, and asserts non-zero coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 17:29:05 -03:00
Behdad EsfahbodandClaude Sonnet 4.6 c9d459b8e9 hb-raster: fix tile bounds clipping; move test to test/api/
Fix out-of-bounds pixel write in rasterize_tile: border tiles that
extend past the image edge were writing px-x_origin beyond the row
stride, wrapping into the start of the next row and overwriting
correctly-rasterized pixels with zero.  Pass px1/py1 (exclusive
bounds) to rasterize_tile and clip the pixel loops accordingly.

Also: drop unused ex0 in pass 2 of tile assignment; move test-raster
from src/ to test/api/ and convert it to the GLib g_assert/hb_test_add
framework.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 17:29:05 -03:00
Behdad EsfahbodandClaude Sonnet 4.6 63fb2eec90 Monotone characters fixups (#5752)
* [buffer] Fix a typo and doc string

* [buffer] Add merge_grapheme_clusters / merge_out_grapheme_clusters

Cluster merges serve two distinct purposes that require different level
gates:

- Grapheme grouping: combining marks merged into their base cluster.
  Correct gate: IS_GRAPHEMES (levels 0 and 3).
  New functions: merge_grapheme_clusters / merge_out_grapheme_clusters.

- Monotonicity maintenance: clusters merged to prevent non-monotone
  output after ligature formation, reordering, etc.
  Correct gate: IS_MONOTONE (levels 0 and 1).
  Existing functions: merge_clusters / merge_out_clusters.

Previously both paths shared merge_clusters_impl's single IS_MONOTONE
gate, so GRAPHEMES (level 3) was incorrectly blocked from merging
grapheme clusters.  This also caused a regression in the Thai and
Hangul shapers for MONOTONE_CHARACTERS (level 1): when their explicit
== MONOTONE_GRAPHEMES call-site guards were removed in #5069, the
impls' IS_MONOTONE gate no longer protected them.

Gates are now in the inline wrappers in hb-buffer.hh; the _impl
functions are gate-free.  hb_form_clusters, CoreText grapheme
detection, and the Thai/Hangul shapers are updated to call the
grapheme-semantic variants.  Fixes #5750.

Fixes https://github.com/harfbuzz/harfbuzz/issues/5751
Fixes https://github.com/harfbuzz/harfbuzz/issues/5750

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* [thai] Adjust grapheme merging logic

* [hangul] Tweak grapheme merging

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:25:24 -07:00
Behdad Esfahbod 78f11ed726 Update test results for previous commit 2026-02-16 16:20:33 -03:00
Khaled Hosny c763763662 [buffer-serialize] Fix calculating absolute offsets with partial range
Fixes https://github.com/harfbuzz/harfbuzz/issues/5743
2026-02-15 17:30:16 +02:00
Behdad Esfahbod 3a827474c0 Merge pull request #5735 from harfbuzz/hb-draw
Add `hb-draw`
2026-02-14 17:26:33 -07:00
Behdad EsfahbodandClaude Sonnet 4.5 49c1678b75 [test] Update draw tests after removing --quiet option
- Remove tests for --quiet/-q option
- Change --ned to --flat in remaining tests
- Remove expected output files for quiet tests

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 18:28:48 -03:00
Garret Rieger 07e48ef1f0 Fix two bugs in hb_set_is_subset().
1. If smaller set has empty pages the subset checking logic was incorrectly incrementing the larger page index after skipping the empty smaller page index.
2. The logic for is_subset() on mixed inverted/not inverted sets was wrong.
2026-02-13 15:06:01 -07:00
Behdad EsfahbodandClaude Opus 4.6 1c32b69fe3 [hb-draw] Fix color font scaling by creating upem_font from face directly
Creating upem_font as a sub-font of the main font (which has scale =
upem * 64 due to subpixel bits) caused the paint API to emit spurious
parent→child scale transforms. With precision=2 rounding, 1/64 rounds
to 0.02 and 0.02*64 = 1.28, destroying the mathematical cancellation
and making color glyphs ~1.6x too large.

Fix by creating upem_font directly from the face, eliminating the
parent-child relationship. Update expected test outputs accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:26:19 -07:00
Behdad Esfahbod fe9a8de890 [hb-svg-compare] Try normalize paths to drop degenerate lineto's
Such that we can compare to both FreeType and Fontations.
2026-02-12 15:26:19 -07:00
Behdad Esfahbod 77d3ed5e75 [hb-draw] Use 6 bits of subpixel
Helps hb-ft since that doesn't work in floats all through.
Other backends should be unaffected.
2026-02-12 15:26:19 -07:00
Behdad Esfahbod fe58d1bd0d [hb-draw-compare] Fix sorting 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 8a5e9536e3 [hb-draw-compare] Simplify sharding; remove non-sharded path 2026-02-12 15:26:19 -07:00
Behdad Esfahbod abb15ee099 [hb-draw-compare] Implement multiprocessing for hb-svg-compare stage 2026-02-12 15:26:19 -07:00
Behdad Esfahbod aff053af24 [hb-draw-compare] Switch from hb-view to hb-draw
MASSIVE speedup!
2026-02-12 15:26:19 -07:00
Behdad Esfahbod 431502033b [draw/run-tests.py] Use batching 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 8121167f69 [draw/run-tests] Simplify 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 2caa4c22a5 [draw] Change conditional tests 2026-02-12 15:26:19 -07:00
Behdad Esfahbod e6346b63bf [draw] Add VARC tests 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 7bbc027e11 [test/draw] Add more tests / change naming 2026-02-12 15:26:19 -07:00