Commit Graph
919 Commits
Author SHA1 Message Date
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 27d9aff7b8 [raster] Add custom palette overrides for COLR and SVG 2026-02-25 15:33:44 -03:00
Behdad Esfahbod 533bac1da0 [raster] Add --font-palette and pass palette to paint 2026-02-25 15:16:44 -03:00
Behdad Esfahbod c447a79dc2 [raster-all] Accept SVG 2026-02-25 14:27:03 -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 7d8c136fd5 [vector] Make paint_glyph use context palette and foreground 2026-02-24 19:20:49 -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 4b730621f8 [vector] Fix cached paint body writes and bounded SVG header scan 2026-02-24 13:49:05 -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 5c8115e5ad [vector] Subset SVG glyph content and fix SVG slicing 2026-02-24 12:30:30 -03:00
Behdad Esfahbod 08b8cf5c66 [hb-vector] Skip zero-advance gid1 fallback draw 2026-02-24 10:27:50 -03:00
Behdad Esfahbod 6653d62480 [test/util] Rename draw suite and tools to vector 2026-02-24 10:17:18 -03:00
Behdad Esfahbod 612e996780 [hb-vector] Apply foreground color to draw output 2026-02-24 10:07:06 -03:00
Behdad Esfahbod e75024e104 [util] Share margin parser and add vector background/margin options 2026-02-24 10:05:32 -03:00
Behdad Esfahbod a9598bf99f [hb-vector] Route --ink through glyph extents mode 2026-02-24 09:57:54 -03:00
Behdad Esfahbod c0a895613d [vector] Add extents mode to glyph APIs and make setters expand 2026-02-24 09:46:55 -03:00
Behdad Esfahbod 5314059602 [vector] Fix combined SVG slicing for nested SVG content 2026-02-24 09:24:09 -03:00
Behdad Esfahbod 344c12ca15 Add vector paint glyph convenience API and auto-extents 2026-02-24 09:19:04 -03:00
Behdad Esfahbod f108e8b349 Fix hb-vector baseline by computing extents in SVG space 2026-02-24 09:11:14 -03:00
Behdad Esfahbod a343292e5d Improve hb-vector SVG reuse output orientation and units 2026-02-24 09:09:53 -03:00
Behdad Esfahbod f67799a819 Use hb-raster glyph convenience APIs in raster tools 2026-02-24 09:05:12 -03:00
Behdad Esfahbod b4b0134493 Add draw_glyph pen placement API for reusable SVG output 2026-02-24 09:00:26 -03:00
Behdad Esfahbod 5b67629871 Port hb-vector utility to hb_vector API 2026-02-24 08:55:27 -03:00
Behdad Esfahbod 3c099ee71c Add initial libharfbuzz-vector SVG backend and utility rename 2026-02-24 08:52:34 -03:00
Behdad Esfahbod daba58ea97 util/raster-all: render paint output only on success 2026-02-24 05:34:40 -03:00
Behdad Esfahbod bcd19a4c39 raster: add draw/paint scale-factor API 2026-02-24 05:02:35 -03:00
Behdad Esfahbod 5ea04afcda raster: adopt create_or_fail and strict render semantics 2026-02-24 04:46:51 -03:00
Behdad Esfahbod 0727834314 raster-image: consolidate configuration API 2026-02-24 04:22:51 -03:00
Behdad Esfahbod e13b688611 util: use hb_memcpy/hb_memset for raster paths 2026-02-24 04:08:43 -03:00
Behdad Esfahbod 3fd6adf678 util/raster: use hb_raster_image_t as output buffer 2026-02-24 04:05:44 -03:00
Behdad Esfahbod 8bb0641ad3 [util] Add -n/--num-iterations to raster-all tools 2026-02-23 22:35:30 -03:00
Behdad Esfahbod 90ef078e46 [util] Centralize --num-iterations and skip repeat shaping for raster 2026-02-23 22:34:19 -03:00
Behdad Esfahbod f1e6108523 [util] Add raster --num-iterations loops and recycle draw image 2026-02-23 22:34:14 -03:00
Behdad Esfahbod 87c8946640 util/hb-ft-raster: remove upem_font normalization 2026-02-23 22:31:24 -03:00
Behdad Esfahbod 426ab081d3 util/raster-output: remove upem_font normalization
Was leftover from hb-draw design picked up by agents.
2026-02-23 22:31:24 -03:00
Behdad Esfahbod 742f79da08 raster: remove extents_from_glyph_extents API
Remove hb_raster_extents_from_glyph_extents and switch callers to the new transform-aware set_glyph_extents APIs on raster draw/paint. Also add test coverage for transformed glyph extents and update section symbol listings.
2026-02-23 12:10:41 -03:00
Behdad Esfahbod dfcdf16c0f [hb-raster] Don't write out to terminal 2026-02-22 19:09:51 -03:00
Behdad Esfahbod 550a52009a Merge pull request #5749 from harfbuzz/hb-raster
Add `harfbuzz-raster` CPU rasterization library
2026-02-22 14:35:36 -07:00
Behdad Esfahbod 646fef15fb util: drop PNG-only color detection in raster tools 2026-02-22 15:29:17 -03:00
Behdad Esfahbod 603ea5e1f2 raster-paint: require explicit extents and add helper 2026-02-22 15:18:40 -03:00
Behdad Esfahbod 830c097d09 raster-paint: clear internal render state between calls 2026-02-22 15:03:39 -03:00
Behdad EsfahbodandClaude Opus 4.6 c24ade3596 raster: emit PPM from all raster tools, add color support to hb-raster-all
hb-raster-all now renders color glyphs via hb_raster_paint_t and checks
the image format (A8 vs BGRA32) when writing PPM output. hb-ft-raster-all
also switched from PGM to PPM for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:41:40 -03:00
Behdad EsfahbodandClaude Opus 4.6 917d18735f raster: always emit PPM for consistent output format
Both hb-raster and hb-ft-raster now always produce PPM (color) output,
compositing alpha over foreground/background colors. This makes the
output format consistent regardless of whether the font has color data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:21:09 -03:00
Behdad Esfahbod 6ebc871e8a [hb-draw] Remove --no-color 2026-02-22 02:31:00 -03:00
Behdad EsfahbodandClaude Opus 4.6 7951782491 hb-raster: add --foreground and --background CLI options
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:47:34 -03:00
Behdad EsfahbodandClaude Opus 4.6 49838acdad raster: add hb_raster_paint_t for color glyph rendering
Implement a software paint backend (hb_raster_paint_t) that renders
COLRv0/v1 color glyphs into BGRA32 pixel buffers with no external
dependencies. Implements all 14 hb_paint_funcs_t callbacks including
solid fills, linear/radial/sweep gradients, glyph clipping, rectangle
clipping, group compositing, and BGRA image blitting.

Update hb-raster utility to detect color fonts and use the paint path,
outputting PPM (RGB) instead of PGM (greyscale).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:24:44 -03:00
Behdad Esfahbod 5e4c105c6f cairo: remove raster mode API and hb-view --raster 2026-02-22 00:20:31 -03:00