Behdad Esfahbod and Claude 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
Behdad Esfahbod
59f42efb2c
[vector] Drop eager glyph span indexing to avoid quadratic SVG parse
2026-02-24 16:19:31 -03:00
Behdad Esfahbod
9207a61b35
[ot-color][vector] Add SVG doc-index API and cache by document index
2026-02-24 14:52:45 -03:00
Behdad Esfahbod
ea0d6d1838
[vector] Keep paint_glyph running when extents expansion fails
2026-02-24 14:27:26 -03:00
Behdad Esfahbod
86e0e55b70
[vector] Make format constructor-time and drop set_format APIs
2026-02-24 14:01:39 -03:00
Behdad Esfahbod
ae4038ea62
[vector] Tune down SVG buffer preallocation sizes
2026-02-24 13:58:01 -03:00
Behdad Esfahbod
4b730621f8
[vector] Fix cached paint body writes and bounded SVG header scan
2026-02-24 13:49:05 -03:00
Behdad Esfahbod
ddd5a96983
[vector] Reuse scratch storage for gradient color stops
2026-02-24 13:39:25 -03:00
Behdad Esfahbod
b1b4e93f75
[vector] Format directly into SVG output buffer
2026-02-24 13:37:08 -03:00
Behdad Esfahbod
8a2751e62e
[vector] Simplify SVG blob metadata state handling
2026-02-24 13:32:16 -03:00
Behdad Esfahbod
e2a013ac0a
[vector] Reuse blob metadata across SVG render recycling
2026-02-24 13:29:51 -03:00
Behdad Esfahbod
9ab5ecaac8
[vector] Preallocate SVG buffers in render and subset paths
2026-02-24 13:17:09 -03:00
Behdad Esfahbod
96cbf70c4b
[vector] Move SVG subsetting into dedicated helper
2026-02-24 13:13:54 -03:00
Behdad Esfahbod
7929d24ed2
[test] Rename hb-vector-compare to hb-vector-svg-compare
2026-02-24 12:55:11 -03:00
Behdad Esfahbod
0692853d7d
[util] Split hb-draw-all and hb-vector-svg-all
2026-02-24 12:53:49 -03:00
Behdad Esfahbod
16fb372ed4
[vector] Use xlocale-only decimal separator path
2026-02-24 12:49:40 -03:00
Behdad Esfahbod
18a22b2f08
[vector] Use xlocale-guarded decimal separator lookup
2026-02-24 12:48:41 -03:00