Commit Graph
972 Commits
Author SHA1 Message Date
Behdad Esfahbod 870ba327f7 [util] Preserve --ned positioning in --glyphs input
When `--glyphs` input omitted advances but still carried `@`
positions, the util-side parser synthesized default advances from the
font. That changed the logical width of `hb-shape --ned` output and
broke same-size round-trips through `hb-view --glyphs`.

Only synthesize advances when the glyph string has neither explicit
advances nor explicit positions.

Tested:
- meson test -C build

Fixes: https://github.com/harfbuzz/harfbuzz/issues/5377
Assisted-by: OpenAI Codex
2026-03-13 14:39:42 +02:00
Khaled Hosny 3e2897e631 [hb-raster] Fix building with PNG disabled
In file included from ../util/hb-raster.cc:30:
../util/raster-output.hh:828:16: error: a type specifier is required for all declarations
  828 |     HB_UNUSED (img);
      |                ^
../util/raster-output.hh:829:16: error: a type specifier is required for all declarations
  829 |     HB_UNUSED (protocol);
      |                ^
2 errors generated.
2026-03-12 17:36:39 +02:00
Behdad Esfahbod 2ea0e18a43 [util] Move shared ANSI image helpers out of Cairo wrapper
The RGB24-to-ANSI output path was implemented in helper-cairo-ansi.hh,
so hb-raster picked up a Cairo header dependency even though it only
needed the shared image-output code. That broke builds configured with
-Dcairo=disabled.

Move the shared callback, Chafa, and RGB24-to-ANSI helpers into
helper-image-output.hh, keep helper-cairo-ansi.hh focused on adapting
Cairo surfaces, and switch raster-output.hh to include only the shared
image helper.

Testing:
meson test -C build

Assisted-by: OpenAI Codex
2026-03-11 22:12:40 -03:00
Jan Alexander Steffens (heftig) 2bf4ba5f26 util: Add missing chafa_dep to hb-raster 2026-03-11 14:16:51 +02:00
Behdad Esfahbod cfd9a52c9d [svg] Gate SVG table processing under HB_NO_SVG (#5814)
Skip the SVG table accelerator and do not define the public
SVG color APIs when HB_NO_SVG is set. Guard internal
callers so SVG-table-dependent code compiles out cleanly,
and add HB_NO_SVG to the HB_TINY profile.

Tested: meson setup build-nosvg -Dc_args=-DHB_NO_SVG -Dcpp_args=-DHB_NO_SVG
Tested: meson compile -C build-nosvg hb-shape hb-info hb-vector main
Tested: meson compile -C build-nosvg (libharfbuzz/libharfbuzz-raster/libharfbuzz-vector linked; full tree stopped on unrelated missing chafa.h in util/hb-raster.cc)
Tested: nm -gU build-nosvg/src/libharfbuzz.0.dylib | grep -E "hb_ot_color_.*svg" (no matches)

Assisted-by: OpenAI Codex
2026-03-10 00:19:39 -06:00
Behdad Esfahbod bec407b6ab util: prefer PNG as the default image format 2026-03-09 21:35:30 -03:00
Behdad Esfahbod a4ddc4c35c util: composite hb-raster PNG output against background 2026-03-09 21:27:08 -03:00
Behdad Esfahbod 7623e5524c util: add terminal output modes to hb-raster 2026-03-09 23:37:36 +02:00
Behdad Esfahbod 2609adb6f9 util: share terminal image output helpers 2026-03-09 23:37:36 +02:00
Behdad Esfahbod 24a703b51f util: show default in output format help 2026-03-09 23:37:36 +02:00
Behdad Esfahbod e36b7a3f5d util: add PNG output support to hb-raster 2026-03-09 23:37:36 +02:00
Behdad Esfahbod 9c6f4c201f raster: add PNG paint_image support via libpng 2026-03-09 18:18:52 +02:00
Khaled Hosny 0faf041ef7 [man] Add hb-raster, and hb-vector to “See also” section 2026-03-08 00:03:57 +02:00
Khaled Hosny 1ccd8e5395 [util] Install hb-raster 2026-03-07 22:19:06 +02:00
Behdad Esfahbod 4191cf20c0 Fix -Wdouble-promotion warnings
Fixes https://github.com/harfbuzz/harfbuzz/issues/5785
2026-03-05 01:24:29 -03:00
Khaled Hosny b91d4b8d75 Add meson options to disable building harfbuzz-subset 2026-03-04 18:12:45 +02:00
Khaled Hosny 72ee0c2dfd Add meson options to disable building harfbuzz-vector 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 3a8f96efa0 [util] Use SVG-safe extents overlay colors in hb-vector 2026-03-03 17:28:58 -03:00
Behdad Esfahbod 1936dd4ce5 [util] Scale hb-vector stroke width with font size 2026-03-03 17:26:11 -03:00
Behdad Esfahbod c2efaa5ced Unify view extents defaults 2026-03-03 17:19:15 -03:00
Behdad Esfahbod 2299ad8c4e [hb-vector] Remove non-sensical gid=1 check
AI hallucination.
2026-03-01 13:14:41 -03:00
Behdad Esfahbod 46bf94ef0e [util] Centralize foreground/background parsing in view options 2026-02-26 21:04:18 -03:00
Behdad Esfahbod 164d58c8d7 [util] Parse custom palette once in view-options and reuse 2026-02-26 21:00:21 -03:00
Behdad Esfahbod 0edadf2aa0 [vector] Revert hb-vector-svg-all custom palette wiring 2026-02-26 17:14:31 -03:00
Behdad Esfahbod 781bcead34 [vector] Document and wire custom palette paint APIs 2026-02-26 17:13:03 -03:00
Behdad Esfahbod 1e857b2e5f [util] Make hb-vector palette var cache mutable 2026-02-26 17:02:37 -03:00
Behdad Esfahbod 23e2c603f4 [util] Resolve hb-vector CPAL vars with lazy per-index cache 2026-02-26 17:01:43 -03:00
Behdad Esfahbod f7a0ca52ff [util] Refactor hb-vector palette var rewrite helpers 2026-02-26 17:00:51 -03:00
Behdad Esfahbod 90bd83dfc2 [util] Cache active CPAL colors for hb-vector SVG var rewrite 2026-02-26 17:00:09 -03:00
Behdad Esfahbod 412f215d02 [util] Harden hb-vector var(--colorN) rewrite parser 2026-02-26 16:58:01 -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 2c4c862758 [util] Keep hb-vector default margin at zero 2026-02-26 16:52:25 -03:00
Behdad Esfahbod a4a7f9af84 [util] Resolve SVG var(--colorN) to concrete colors in hb-vector output 2026-02-26 16:32:11 -03:00
Behdad Esfahbod 9b3583f2f6 [util] Emit CPAL CSS vars for SVG var(--colorN) in hb-vector 2026-02-26 16:30:33 -03:00
Behdad Esfahbod fec0d08b76 [util] Hoist shared stroke attrs in hb-vector rainbow draw output 2026-02-26 16:26:54 -03:00
Behdad Esfahbod 1ed094ac68 [util] Apply rainbow colors per glyph in hb-vector draw output 2026-02-26 16:24:45 -03:00
Behdad Esfahbod 51c599ccb9 [vector] Hook --custom-palette in hb-vector paint output 2026-02-26 16:18:56 -03:00
Behdad Esfahbod 8b961af787 [util] Support --rainbow foreground cycling in hb-vector paint path 2026-02-26 16:17:48 -03:00
Behdad Esfahbod 79fdf3ac84 [util] Let hb-vector inherit shared view options 2026-02-26 16:10:17 -03:00
Behdad Esfahbod 953f222c2e [raster] Remove extents safety pad for view parity 2026-02-25 18:32:45 -03:00
Behdad Esfahbod 24912d7990 [raster] Fix logical bounds to avoid trailing empty line 2026-02-25 18:31:25 -03:00
Behdad Esfahbod 3f0bee360f [raster] Fix non-rainbow A8 output extents usage 2026-02-25 18:25:18 -03:00
Behdad Esfahbod b141d47b8e [raster] Implement show-extents overlays 2026-02-25 16:40:09 -03:00
Behdad Esfahbod acaf6b3f43 [view] Keep foreground palette cycling across lines 2026-02-25 16:37:06 -03:00
Behdad Esfahbod 21b8e0a4c4 [raster] Apply foreground palette cycling to non-color glyphs 2026-02-25 16:35:16 -03:00
Behdad Esfahbod f5e211094b [raster] Honor font-extents for line step with scaling 2026-02-25 16:32:28 -03:00
Behdad Esfahbod ba51d73241 [raster] Scale line-space to font units 2026-02-25 16:30:35 -03:00
Behdad Esfahbod d0149e5e2f [raster] Honor view line-space in line step 2026-02-25 16:28:24 -03:00
Behdad Esfahbod 323ae8bd6c [raster] Implement logical/ink extents selection 2026-02-25 16:26:07 -03:00