Commit Graph

60 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 6a3dec357c [util/draw] Use hb-draw in hb-view only if HB_DRAW=1 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 5c558586eb [util/draw] Apply slant to non-user-fonts as well 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 542f8269cb [util/draw/ft] Use hb-draw for font-funcs=ft as well
If cairo is >= 1.17.5.

This essentially breaks emoji and bitmap fonts for now.
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
Behdad Esfahbod c98773ebb0 [util/hb-subset] Move output-file validation code into post_parse 2021-08-11 20:22:03 -06:00
Behdad Esfahbod 58bfe40794 [util] Move hb-subset away from main-font-text 2021-08-11 20:12:36 -06:00
Behdad Esfahbod fd0778aa2a [util] Use post_parse in output_options_t 2021-08-11 18:54:46 -06:00
Behdad Esfahbod 24a9d8c78d [util] Use post_parse in font_options_t 2021-08-11 18:49:59 -06:00
Behdad Esfahbod e4b33d9d36 [util] Use post_parse in face_options_t 2021-08-11 18:49:58 -06:00
Behdad Esfahbod 93bc62e9b2 [util] Move output options into output-options.hh 2021-08-07 13:13:58 -06:00
Behdad Esfahbod c5337c43e9 [util] Fold helper-cairo.cc into helper-cairo.hh 2021-08-06 19:19:50 -06:00