Commit Graph
2660 Commits
Author SHA1 Message Date
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
Behdad Esfahbod 529043f033 [hb-draw] More tests 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 69a4f5f501 [hb-draw] Change subpixel bits to 0 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 008402dccf [hb-draw] Default to upem font size 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 0fd8261638 [test/draw] Change directory structure a bit 2026-02-12 15:26:19 -07:00
Behdad Esfahbod f035a1df87 [test/draw] Switch tests to U+XXXX notation instead of text 2026-02-12 15:26:19 -07:00
Behdad Esfahbod e91036cf0b [hb-draw-compare] Remove unused stuff 2026-02-12 15:26:19 -07:00
Behdad Esfahbod e5c227b49b [test] Restructure record-test.sh's a bit
Haven't reviewed, AI code.
2026-02-12 15:26:19 -07:00
Behdad Esfahbod a4381db671 [test] Add draw/record-test.sh
Haven't reviewed. AI code.
2026-02-12 15:26:19 -07:00
Behdad Esfahbod 32a8fd62e8 Move hb-draw-compare and hb-svg-compare to test/draw 2026-02-12 15:26:19 -07:00
Behdad Esfahbod 8150eed010 [test] Start of a draw test suite 2026-02-12 15:26:19 -07:00
Qunxin Liu 7ed158f930 Fix fuzzer issue (#5741)
Fixes: https://oss-fuzz.com/testcase-detail/6406793692774400
2026-02-11 13:12:30 -07:00
Qunxin Liu e601560b77 fix fuzzer issue: https://oss-fuzz.com/testcase-detail/6005602106277888
Do not use pointers that may point outside of the allocated memory region
2026-01-23 11:44:39 -07:00
Behdad Esfahbod dc73849f56 [gvar] Fix padding size calcs (#5718)
The previous state of is_long_offset() is irrelevant here.

Fixes https://oss-fuzz.com/testcase-detail/5920156651159552
2026-01-22 18:08:51 -07:00
Qunxin Liu b17fa8ef39 Fix fuzzer found heap-use-after-free crash (#5717)
Fixes https://oss-fuzz.com/testcase-detail/6005602106277888
2026-01-21 14:42:29 -07:00
Qunxin Liu 1c0a3a14d3 [subset] fix padding in gvar table
Add necessary padding if original font is using long format and
subsetted font is using short format
2026-01-20 14:47:54 -08:00
Behdad Esfahbod bb7dbc25ec Fix some unused-var warnings under NDEBUG 2026-01-10 07:42:07 -07:00
Qunxin Liu cf31e7ac4e [instancer] support full instancing for avar2 (#5676) 2025-12-11 10:54:49 -07:00
Khaled Hosny 46bc4e95f9 [kbts] Update to version 2.0 2025-11-28 12:56:36 +02:00
Garret Rieger 09c14fa4f2 Fix fuzzer found memory leak. (#5643)
Fixes https://oss-fuzz.com/testcase-detail/6083012753424384
2025-11-14 02:27:35 -07:00
Behdad Esfahbod 33f8ee8efc [test] Add HarfBust tests 2025-11-10 02:55:44 -07:00