Commit Graph
20650 Commits
Author SHA1 Message Date
Behdad EsfahbodandClaude Sonnet 4.5 e0362c34a4 [hb-draw] Add --background option for SVG background color
Adds --background command-line option to hb-draw, similar to hb-view/hb-cairo.
Supports RGB and RGBA color formats (rrggbb[aa]). Background is rendered as
an SVG rect element covering the viewBox when specified.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 11:41:45 -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 Esfahbod 6675656bff Update Unicode tables to packtab 1.2.0 2026-02-12 20:06:26 -05:00
Behdad Esfahbod 8f7733c7ff Regenerate Unicode tables with newer packtab 1.1.0 2026-02-12 19:44:29 -05:00
Behdad EsfahbodandClaude Sonnet 4.5 e5ebd0465c [hb-draw] Add color glyph reuse in defs for smaller SVG output
Color glyphs are now defined once in <defs> and reused via <use> elements,
similar to non-color glyphs. Previously each color glyph instance rendered
the full paint operations inline, causing duplication.

Tested with repeating emoji: reduces SVG size by ~44% for files with
repeated color glyphs (e.g., 3 emoji instances: 5.8KB vs 11KB without reuse).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 15:26:19 -07:00
Behdad EsfahbodandClaude Opus 4.6 e5a8f3c325 [hb-draw] Fix color glyph rendering at non-upem font sizes
In reuse mode, the outer scale(font_scale_x, -font_scale_y) wrapper
already flips Y. The color glyph wrapper was incorrectly also applying
scale(1,-1), causing a double Y-flip that made the output appear
off-bounds at any font size other than upem.

Now only apply scale(1,-1) in upem_scale mode (no outer wrapper).
Also restore precision 9 for 1/upem scale values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:26:19 -07:00
Behdad EsfahbodandClaude Opus 4.6 585be5163e [hb-draw] Double sweep gradient subdivision for smoother rendering
Reduce MAX_ANGLE from pi/8 to pi/16, producing ~32 slices per full
circle instead of ~16. This reduces visible color banding in sweep
gradient approximation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:26:19 -07:00
Behdad EsfahbodandClaude Opus 4.6 2965686b15 [hb-draw] Use higher precision (min 5) for transform/scale values
Coordinate data uses the user's --precision (default 2), but scale and
transform matrix values need more decimal places to avoid compounding
rounding errors. Add scale_precision() helper that returns max(precision, 5).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:26:19 -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 EsfahbodandClaude Opus 4.6 6ec56f5442 [hb-draw] Add color font rendering via paint API → SVG
Render COLRv0/v1, CBDT/sbix bitmaps, and SVG table glyphs as rich SVG
with colors, gradients, compositing, and inlined bitmap images using
hb_font_paint_glyph(). Falls back to monochrome outlines when no color
data is available.

New options: --no-color, --palette N, --foreground rrggbb[aa]

Glyph outline paths are stored as shared <defs> and reused by both
display <use> elements and <clipPath> references, avoiding duplicate
path data.

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 1fdfbcd78e Revert "[glyf/path-builder] Don't emit no-op contour-final line-to"
This reverts commit b53ce9c7efe73443e7b73a3b1898891c1954b1a6.
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 8c525f0abe [glyf/path-builder] Don't emit no-op contour-final line-to
Match FT/fontations better.
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 bac47189b2 [hb-draw] viewbox only use logical extents
Removes the get_glyph_extents loop completely. Simpler.
2026-02-12 15:26:19 -07:00
Behdad Esfahbod b405bc1724 [hb-draw] Centralize layout math 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
Behdad Esfahbod 092c7aaa8b [hb-draw] Use logical bounding box 2026-02-12 15:26:19 -07:00
Behdad Esfahbod e9573900e1 [util] Add initial hb-draw implementation 2026-02-12 15:26:19 -07:00
Behdad Esfahbod bac5128a11 Update Unicode tables to packtab 1.0.0 2026-02-12 15:24:50 -07:00
Behdad Esfahbod 2deabfbc90 [cmap/format4] Try to ignore wrong subtable length (#5740)
* WIP [cmap/format4] Try to ignore wrong subtable length

Fixes https://github.com/harfbuzz/harfbuzz/issues/5739

See comments.

* [cmap/format4] Followup fix for unreliable subtable length field

* [cmap/format4] Try to fix previous commit

Let's see..
Let's see..

* [cmap/format4] Another try at fixing recent changes

* [cmap/format4] Still try to fix

* [cmap/format4] Refactor duplicated code and disable unsafe path
2026-02-11 16:55:08 -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
dependabot[bot] 0e496a6b70 Bump setuptools from 80.10.2 to 82.0.0 in /.ci
Bumps [setuptools](https://github.com/pypa/setuptools) from 80.10.2 to 82.0.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v80.10.2...v82.0.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-version: 82.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-09 15:46:55 +02:00
dependabot[bot] 9674709b29 Bump github/codeql-action from 4.32.0 to 4.32.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.0 to 4.32.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/b20883b0cd1f46c72ae0ba6d1090936928f9fa30...45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-09 15:45:00 +02:00
Behdad Esfahbod 2dc20f649b [hb-view] Make rainbow colors slightly translucent
Better visualization for overlapping glyphs.
2026-02-08 20:33:12 -07:00
Behdad Esfahbod ff4d329ef1 [hb-view] Add --stroke= 2026-02-08 20:18:50 -07:00
Behdad Esfahbod e1410a30e4 [hb-view] Add --foreground color list and --rainbow 2026-02-08 20:03:43 -07:00
Behdad Esfahbod b91e920af8 [hb-view] Add --logical counterpart to --ink
Make the default union the two boxes.
2026-02-08 15:45:45 -07:00
Behdad Esfahbod e43abc6140 [hb-view] Add --ink
At long last https://github.com/harfbuzz/harfbuzz/issues/79

Thanks codex.
2026-02-08 02:31:25 -07:00
Behdad Esfahbod 07afd2ccff [hb-svg-compare] Write out error with %g, not %.5f 2026-02-06 22:29:12 -07:00
Behdad Esfahbod 1daff76c28 [VARC] TCenter really is parsed after Skew according to spec 2026-02-06 14:56:29 -07:00
Behdad Esfahbod 5f2df0a3b2 [VARC] Convert a division to mult 2026-02-06 13:12:57 -07:00