Behdad Esfahbod
bec407b6ab
util: prefer PNG as the default image format
2026-03-09 21:35:30 -03:00
Behdad Esfahbod
2609adb6f9
util: share terminal image output helpers
2026-03-09 23:37:36 +02:00
Behdad Esfahbod
46bf94ef0e
[util] Centralize foreground/background parsing in view options
2026-02-26 21:04:18 -03:00
Behdad Esfahbod
164d58c8d7
[util] Parse custom palette once in view-options and reuse
2026-02-26 21:00:21 -03:00
Behdad Esfahbod and Claude Sonnet 4.5
f33645dd8b
[util] Fix multiple bugs in drawing utilities
...
Fixed three bugs found during code review:
1. Division by zero in normalize_pt(): Added check to return {0, 0}
when normalizing a zero-length vector, preventing NaN values in
sweep gradient rendering.
2. Memory leak in get_color_stops(): Now properly frees old memory
before reallocating and checks for malloc failure to prevent
null pointer dereference.
3. Integer division in helper_cairo_create_context(): Fixed missing
decimal point causing integer division (br / 255) instead of
floating-point division, which resulted in incorrect alpha
channel calculations for color blending.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-15 10:12:43 -03:00
Behdad Esfahbod
ff4d329ef1
[hb-view] Add --stroke=
2026-02-08 20:18:50 -07:00
Behdad Esfahbod
e1410a30e4
[hb-view] Add --foreground color list and --rainbow
2026-02-08 20:03:43 -07:00
Khaled Hosny
d054ebd5da
[cairo] Drop fallback code for versions we don’t support
...
We require cairo 1.10.0, so drop checks for older versions.
2025-07-02 20:14:51 +03:00
Behdad Esfahbod
2ddae77179
[util/cairo] Handle all null matrices
2024-11-17 00:02:03 -07:00
Khaled Hosny
667ce682a2
[hb-view] Support cairo script as output format
...
Can be handy for debugging the series of operations cairo performs.
2024-09-23 22:08:41 +03:00
Behdad Esfahbod
7a390b5095
[hb-view] Simplify background drawing
...
Works around a Firefox bug.
Fixes https://github.com/harfbuzz/harfbuzz/issues/4811
2024-09-23 12:16:05 -06:00
Behdad Esfahbod
91a174f151
[hb-view] Hide --annotate and make it alias for --show-extents
2023-01-24 11:27:35 -07:00
Behdad Esfahbod
c54a7022fe
[hb-view] Require cairo 1.17.5 for HB_DRAW=1 default again
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/4051
2023-01-21 14:07:41 -07:00
Behdad Esfahbod
61719a8350
[hb-view] Support specifying color indices again
2023-01-20 15:52:09 -07:00
Behdad Esfahbod
f21b15dcc3
[hb-view] Update to alternative cairo custom-palette API
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
638e0ed4fd
[paint] Overlay custom-palette on top of chosen palette
...
Got to agree this is more ergonomic.
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
03e2e58642
[hb-view] Improve color parsing
...
Now supports 3, 4, 6, 8 digit colors.
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
dc4af478d1
[hb-view] Default background to white when parsing
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
e998cec1d9
[hb-view] Move palette options to --help-view
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
253b4cecae
[hb-view] Simplify palette format
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
52b78d526b
[hb-view] Fix leak
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
5847ec24ff
Fix bots
2023-01-20 13:57:39 -07:00
Behdad Esfahbod
0bff570491
[hb-view] Use custom palette if any set
2023-01-20 13:57:39 -07:00
Matthias Clasen
c41892a012
hb-view: Add a --custom-palette option
2023-01-20 13:57:39 -07:00
Khaled Hosny
00060d99f3
[hb-cairo] Silence warning when building with FreeType
...
In file included from ../util/hb-view.cc:33:
In file included from ../util/view-cairo.hh:32:
../util/helper-cairo.hh:102:7: warning: variable 'cairo_face' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (use_hb_draw)
^~~~~~~~~~~
../util/helper-cairo.hh:129:64: note: uninitialized use occurs here
cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face,
^~~~~~~~~~
../util/helper-cairo.hh:102:3: note: remove the 'if' if its condition is always true
if (use_hb_draw)
^~~~~~~~~~~~~~~~
../util/helper-cairo.hh:101:32: note: initialize the variable 'cairo_face' to silence this warning
cairo_font_face_t *cairo_face;
^
= nullptr
We know that cairo_face will always be assigned since use_hb_draw will
always be true, but the compiler does not know that.
2022-12-30 22:55:56 +02:00
Behdad Esfahbod
0d98c79b10
[util] Centralize includes again
2022-12-29 21:07:38 -07:00
Behdad Esfahbod
d90ccc1c5c
[view] More includes
2022-12-29 21:02:06 -07:00
Behdad Esfahbod
969914b2b5
[view] Clean up includes
2022-12-29 21:01:16 -07:00
Behdad Esfahbod
ab8b9b4443
[view] Streamline cairo-ft face lifecycle management
2022-12-29 18:33:12 -07:00
Behdad Esfahbod
228a415470
[view-cairo] Minor subpixel-bits
2022-12-29 18:19:06 -07:00
Behdad Esfahbod
74d29cd168
[helper-cairo] Remove a method
2022-12-29 18:11:41 -07:00
Behdad Esfahbod
b1de87b7f1
[cairo] Document get_glyphs() arguments as inout
2022-12-29 10:41:35 -07:00
Behdad Esfahbod
5efb3bc691
[hb-view] Set hb-cairo scale-factor
...
Unused.
2022-12-27 17:47:46 -07:00
Behdad Esfahbod
81c04b0c21
[cairo] Add separate x/y scale factors
2022-12-27 17:46:25 -07:00
Behdad Esfahbod
c38abcb3fb
[cairo] Add x,y args to get_glyphs
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
847ed69547
[cairo] Reorder arguments of a call
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
ea993af8e7
[view] Don't double-slant
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
cf001f6ec7
[cairo] Add constructor from hb_face_t
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
20a50acc91
[hb-cairo] Make hb_cairo_glyphs_from_buffer public
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
a230eb8cf5
[hb-cairo] Factorize hb_cairo_glyphs_from_buffer
...
To be made public.
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
5c3da76a43
[hb-cairo] Change API again
...
We need to work with a hb-font for variations and font-funcs
to be fetched properly.
2022-12-26 17:01:08 -07:00
Behdad Esfahbod
9f7538c260
[hb-cairo] Change API
2022-12-26 17:01:08 -07:00
Matthias Clasen
0d6ee4621e
wip: Make hb-view use hb-cairo
...
This is a quick hack to prove that the
hb-cairo apis work
2022-12-26 17:01:08 -07:00
Matthias Clasen
5d7553d38f
view: Add a --font-palette option
2022-12-23 13:37:59 -07:00
Khaled Hosny
6add69a6ec
[hb-view] Allow building without cairo-ft
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3925
2022-12-16 21:10:15 +02:00
Behdad Esfahbod
2e9b270a49
[hb-view] Fix cairo slanting condition
...
hb-draw already does slanting. If NOT hb-draw, we should slant
through cairo path. Donno why this was untested before.
This was double-slanting with hb-draw, and not slanting without it.
2022-11-23 16:18:39 -07:00
Behdad Esfahbod
0e4f579493
[util/hb-view] Default HB_DRAW to 1
...
See comments.
2022-10-31 13:51:24 -06:00
Wez Furlong
e3548c2069
hb-view: Detect WezTerm and use iterm2 image protocol
...
Similar to the logic that detects iterm2, but look for
TERM_PROGRAM=WezTerm which identifies wezterm is present.
This allows hb-view to output an image directly to the terminal.
2022-09-03 17:15:03 +02:00
Behdad Esfahbod
c0b2f50c0b
[util] Rename template typenames to avoid clashing with actual types
...
Apparently MSVC2015 can confuse them
Fixes https://github.com/harfbuzz/harfbuzz/issues/3379
2022-02-18 12:29:14 -06:00
Behdad Esfahbod
9cc9ffe352
[util/draw] If HB_DRAW is not set, choose depending on cairo version
...
If HB_DRAW=0, don't use it, if HB_DRAW=1, use it, if unset, choose depending
on cairo version
2022-02-13 13:21:14 -06:00