Commit Graph

28 Commits

Author SHA1 Message Date
Behdad Esfahbod 6ccbfabd4f [paint] Return bool from paint_image()
Fixes https://github.com/harfbuzz/harfbuzz/issues/3974
2022-12-24 10:44:25 -07:00
Matthias Clasen dfd371e976 Cosmetics 2022-12-24 10:13:44 -05:00
Behdad Esfahbod 56a48f8b0a [paint] Don't use extents in hb-view
Let the clipbox do its magic. Currently works for ft backend only.
2022-12-23 16:45:04 -07:00
Matthias Clasen ecd7420456 Debug spew
To get a dump of the hb-paint callbacks,
set HB_PAINT_DEBUG=1 when running hb-view.

For now, leave this code in place, since it
comes in handy for various debugging.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod c5f903872f [paint] Add bitmap width/height to paint_image callback
Such that we can add raw data as well.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 237955dffc [paint] Add slant to image() callback
And slant images in hb-view.
2022-12-23 13:37:59 -07:00
Matthias Clasen c221933977 [paint] Preserve foreground information 2022-12-23 13:37:59 -07:00
Matthias Clasen 6387004cad [paint] Simplify api
Drop the hb_paint_context_t struct from the API, and
only pass the font where we need it.
2022-12-23 13:37:59 -07:00
Matthias Clasen 71bd5a0dfc [paint] Resolve colors
We don't need to pass the index/alpha pairs to
client callbacks, and can just resolve the colors
internally.

Update test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 5d7553d38f view: Add a --font-palette option 2022-12-23 13:37:59 -07:00
Matthias Clasen d094e76cbc hb-view: Pass fg color to hb_font_paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 9be01b6bff [paint] Pass hb_paint_context_t along
Replace the font argument with a hb_paint_context_t
that carries the font, the palette index and the
foreground color.

The hb_font_paint_glyph() api now takes the palette
index and the foreground color as extra arguments.

Update all callers and regenerate test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen b1500babaa utils: Some cairo helper tweaks 2022-12-23 13:37:59 -07:00
Matthias Clasen 97224f3b63 [paint] Pass font to all callbacks
This will lead to easier implementations.

At the same time, we change the push_clip_glyph
callback to use the font as-is, no unscaling needed.

Update all callers and expected test results.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 3590ee74f4 [util] Fix bot 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 81bf089273 [hb-view] Use color render callback if HB_DRAW >= 2 2022-12-23 13:37:59 -07:00
Behdad Esfahbod bcc9ab27fc [hb-view] Fix transformation
No need for cairo patch; that patch was wrong.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod c996fc58ec [hb-view] Remove redundant check 2022-12-23 13:37:59 -07:00
Behdad Esfahbod bec5354030 [hb-view] Fix render_color_glyph extents coordinate system
Needs cairo fix:
https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/371
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 95ccd66481 [hb-view] Set glyph extents in render_color_glyph
Works around limitation in cairo-recording-surface unboundedness.

Extents are wrong but at least renders something now.
2022-12-23 13:37:59 -07:00
Matthias Clasen 6c49822cad wip: Use hb-paint in hb-view
This doesn't paint anything yet.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 096121badb [util] Implement --sub-font
Internally creates a font at 2x and creates a sub-font from it...
2022-02-13 13:21:15 -06:00
Behdad Esfahbod 57aa8c3b3a [draw] Another try at a stable draw moveto semantic 2022-02-13 13:21:15 -06:00
Behdad Esfahbod 22f2c78c28 [util/draw] Explicitly chain from render_color_glyph to render_glyph
This seems to be more robust.  See:
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033176635
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 18b8a1c345 [draw] Fix conversion warnings 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 6812f7ee1e [draw] Implement COLRv0 fonts 2022-02-13 13:21:14 -06:00
Behdad Esfahbod cfc06c24d5 [util/draw] Render color glyphs if cairo API available 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 5d2df1208a [util] Use hb-draw to render alternatively to cairo-ft
Is automatically enabled if cairo is recent enough, and font-funcs are
not 'ft'.

Uses cairo-user-font backend internally.
2022-02-13 13:21:14 -06:00