mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 14:01:10 +01:00
Consolidate the {vector,raster,gpu}_{draw,paint}_glyph APIs
to match the hb_font_{draw,paint}_glyph / _or_fail pattern:
* Each existing *_glyph() public function now returns void.
For the draw variants this is purely a return-value drop.
For the paint variants the void entry additionally gains a
synthesize fallback for non-color glyphs (calls
hb_font_paint_glyph instead of _or_fail) so a mono glyph
still produces output via a foreground-colored outline.
* New *_glyph_or_fail() variants return hb_bool_t, reporting
exactly what hb_font_{draw,paint}_glyph_or_fail() would.
Callers that care about distinguishing color paint from
synthesized outline now have a clean boolean signal.
Refactors the internal impls behind a shared static helper
parameterised by a `fallible` flag; the two public entries
delegate, passing true (for _or_fail) or false (for the void
alias).
For GPU specifically, paint_glyph_or_fail no longer folds the
encoder's unsupported flag into its return -- that state was
always better reported from hb_gpu_paint_encode() (which
returns NULL), and conflating the two prevented callers from
telling "font has no paint data" from "encoder hit a limit".
While in there, remove a dead branch at the end of
hb_vector_paint_glyph's SVG case (both inner blocks had
already returned; the tail was unreachable).
Updates docs/harfbuzz-sections.txt with the six new symbols
and the NEWS note with the Changed API callouts. Updates
in-tree callers (hb-vector-svg-all, hb-raster-all, test-gpu,
util/vector-output.hh) to the _or_fail variants where they
previously read the return value.
Fixes: https://github.com/harfbuzz/harfbuzz/issues/5926
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>