Commit Graph
20248 Commits
Author SHA1 Message Date
Behdad Esfahbod a0e6e1de3f Merge pull request #5761 from harfbuzz/raster-svg
[raster] Rasterize simple SVG fonts
2026-02-25 12:10:50 -07:00
Behdad Esfahbod f2edc612ee Merge branch 'main' into raster-svg
# Conflicts:
#	util/raster-output.hh
2026-02-25 15:49:13 -03:00
Behdad Esfahbod 6a90ed9c39 Revert "[util/raster] Use glyph extents for margins; drop AA pad"
This reverts commit 3d48a0bce0.
2026-02-25 15:47:15 -03:00
Behdad Esfahbod fb88a3127c [docs] List new hb-raster custom palette APIs 2026-02-25 15:43:37 -03:00
Behdad Esfahbod 27d9aff7b8 [raster] Add custom palette overrides for COLR and SVG 2026-02-25 15:33:44 -03:00
Behdad Esfahbod 43d1e3fb5b [raster] Honor selected palette in SVG color resolution 2026-02-25 15:28:45 -03:00
Behdad Esfahbod 533bac1da0 [raster] Add --font-palette and pass palette to paint 2026-02-25 15:16:44 -03:00
Behdad Esfahbod bc3c22799f [svg] Inline SVG accelerator cache implementation in table header 2026-02-25 15:03:38 -03:00
Behdad Esfahbod aa41f8cf16 [svg] Move doc cache into SVG table accelerator 2026-02-25 14:34:00 -03:00
Behdad Esfahbod c447a79dc2 [raster-all] Accept SVG 2026-02-25 14:27:03 -03:00
Behdad Esfahbod 6ca6e5bfd1 [svg] Share and use SVG doc cache for raster/vector 2026-02-25 12:20:43 -03:00
Behdad Esfahbod 1997b3c1e6 [raster] Fix gradient href inheritance and bbox units 2026-02-25 12:07:34 -03:00
Behdad Esfahbod 1d1c64070b [raster] Implement SVG clip-path and gradient conformance fixes 2026-02-25 12:02:49 -03:00
Behdad Esfahbod 58ba1b6cdb [raster] Improve SVG renderer inheritance and child parsing 2026-02-25 11:51:29 -03:00
Behdad Esfahbod 3d48a0bce0 [util/raster] Use glyph extents for margins; drop AA pad 2026-02-25 11:46:42 -03:00
Behdad Esfahbod eaa141fdd0 [util/raster] Add --margin option to hb-raster 2026-02-25 11:27:25 -03:00
Behdad EsfahbodandClaude Opus 4.6 291bc6e1f2 [raster] Add SVG table rasterizer
Implement a minimal SVG parser/renderer that translates OpenType SVG
table documents into paint commands through the existing hb_paint_funcs_t
interface. All pixel-level rendering (gradients, compositing, clipping)
is handled by the existing hb_raster_paint_t infrastructure.

Features:
- XML tokenizer and SVG path data parser (all commands including arcs)
- Shape-to-path converters (rect, circle, ellipse, line, polyline, polygon)
- Gradient support (linearGradient, radialGradient with stops and transforms)
- SVG color parser (#RGB, #RRGGBB, rgb(), named colors, currentColor)
- CPAL palette colors via var(--colorN) with fallback support
- Transform parser (matrix, translate, scale, rotate, skewX, skewY)
- Defs/use resolution, clipPath support, group opacity
- Hook into hb-raster utility for SVG font rendering

New files: hb-raster-svg.cc, hb-raster-svg.hh, hb-raster-paint.hh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 11:10:35 -03:00
Behdad Esfahbod 6d23a8a211 Merge pull request #5759 from harfbuzz/hb-vector
Add `harfbuzz-vector` library for outputing to SVG (so far)
2026-02-25 05:43:15 -07:00
Behdad Esfahbod 9551492902 [vector] Use tag-valued format enum with INVALID sentinel 2026-02-24 20:44:43 -03:00
Behdad Esfahbod cbf83f2f71 [vector] Cache SVG decimal point lookup via singleton 2026-02-24 20:30:19 -03:00
Behdad Esfahbod a8e59bc6fb [vector] Emit shorthand hex colors when possible 2026-02-24 20:26:55 -03:00
Behdad Esfahbod 236d080d9f [vector] Drop linear '<svg' scan in color-glyph cache path 2026-02-24 20:23:10 -03:00
Behdad Esfahbod 4e99a69776 [vector] Make SVG subset ref/defs dedup near-linear 2026-02-24 20:19:36 -03:00
Behdad Esfahbod 591be6472a [vector] Share SVG path sink funcs and move number formatting to utils 2026-02-24 20:14:47 -03:00
Behdad Esfahbod 5870854182 [vector] Remove leftover cross-context structs after split 2026-02-24 20:06:56 -03:00
Behdad Esfahbod c694d2583c [vector] Split SVG backend into draw/paint translation units 2026-02-24 20:02:32 -03:00
Behdad Esfahbod a9dc6a7e91 [vector] Share SVG append helpers between renderer and subsetter 2026-02-24 19:50:12 -03:00
Behdad Esfahbod 87aeb168b2 [vector] Reuse shared instance-transform emitter in draw path 2026-02-24 19:48:51 -03:00
Behdad Esfahbod d56e46e181 [vector] Clamp numeric precision and use static format buffers 2026-02-24 19:46:44 -03:00
Behdad Esfahbod 2ef2ef0527 [vector] Guard glyph-id parsing against overflow 2026-02-24 19:43:32 -03:00
Behdad Esfahbod d316c94abb [vector] Handle single-quoted href refs in SVG subsetter 2026-02-24 19:39:50 -03:00
Behdad Esfahbod 9f464bf067 [vector,raster] Export new getter APIs in headers/docs 2026-02-24 19:32:49 -03:00
Behdad Esfahbod 45c8dcf5e3 [vector,raster] Make out getter args consistently nullable 2026-02-24 19:32:23 -03:00
Behdad Esfahbod 7f3c72c9e5 [vector] Move getter gtk-doc blocks to source file 2026-02-24 19:31:24 -03:00
Behdad Esfahbod f997a0ff52 [vector,raster] Mark get_extents out arg nullable in docs 2026-02-24 19:26:29 -03:00
Behdad Esfahbod 3f39f12e20 [vector,raster] Add get_extents APIs for draw/paint contexts 2026-02-24 19:25:35 -03:00
Behdad Esfahbod 7d8c136fd5 [vector] Make paint_glyph use context palette and foreground 2026-02-24 19:20:49 -03:00
Behdad Esfahbod 75a1058ebb [vector] Use HarfBuzz lazy-loader idiom for funcs singletons 2026-02-24 19:17:29 -03:00
Behdad Esfahbod 2f521510f5 [vector] Remove unused paint body buffer 2026-02-24 19:13:22 -03:00
Behdad Esfahbod e9e1a4bbf6 [vector] Preserve paint configuration across render calls 2026-02-24 19:11:57 -03:00
Behdad Esfahbod b276c5dbba [vector] Restore sweep-gradient approximation in SVG paint 2026-02-24 19:00:52 -03:00
Behdad Esfahbod e39e3f6b13 [vector] Remove uncached SVG subset path and harden ref parsing 2026-02-24 18:54:09 -03:00
Behdad Esfahbod 40ec999ace [docs] Drop 12.2.0 index and use placeholder XSince for new SVG range API 2026-02-24 18:35:06 -03:00
Behdad Esfahbod f7d4646d31 [atomic] Try fixing MSVC
D:\a\harfbuzz\harfbuzz\src\hb-atomic.hh(212): note: 'hb_atomic_t<hb_svg_doc_cache_t *> &hb_atomic_t<hb_svg_doc_cache_t *>::operator =(const hb_atomic_t<hb_svg_doc_cache_t *> &)': function was implicitly deleted because a data member invokes a deleted or inaccessible function 'std::atomic<T *> &std::atomic<T *>::operator =(const std::atomic<T *> &)'
        with
        [
            T=hb_svg_doc_cache_t
        ]
2026-02-24 16:57:44 -03:00
Behdad Esfahbod a448c4e235 [vector] Add API parameter docs and placeholder XSince tags 2026-02-24 16:55:15 -03:00
Behdad Esfahbod 24d5eeb223 [vector] Support PNG paint images and fix draw-glyph def caching 2026-02-24 16:48:06 -03:00
Behdad Esfahbod ebdb23879d [ot-color] Add SVG document glyph-range API and use in vector cache 2026-02-24 16:39:39 -03:00
Behdad Esfahbod c5dffd0dfc [vector] Store glyph span cache as pair<uint32_t,uint32_t> 2026-02-24 16:32:34 -03:00
Behdad Esfahbod 4ef28c3eb2 [vector] Require cached glyph spans and use fixed-depth parse stack 2026-02-24 16:31:15 -03:00
Behdad Esfahbod 7ac198f350 [vector] Build SVG defs and glyph-span cache in one linear pass 2026-02-24 16:26:35 -03:00