Commit Graph

47 Commits

Author SHA1 Message Date
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
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Behdad Esfahbod 17f40b7cad Include hb-private.hh more consistently
Part of fixing https://github.com/behdad/harfbuzz/issues/585
2017-10-27 09:22:42 -06:00
Behdad Esfahbod 6c0ebd02c9 [util] If font has color, generate PNG with color 2015-11-05 11:37:48 -08:00
Behdad Esfahbod cd4eb96abb [util] Add --font-size to hb-shape
Also makes hb-view to use 8 bits of subpixel precision and shape at
requested size, instead of always shaping at upem and scaling results.
2015-01-20 12:45:13 -08:00
Behdad Esfahbod ea5e8a02eb [util] Plug minor leak 2014-03-19 15:38:02 -07:00
Behdad Esfahbod 9815a88111 [util] List supported output formats in --help output 2012-12-21 16:46:53 -05:00
Behdad Esfahbod 95cefdf96e Add --utf8-clusters
Also fix cairo cluster generation.
2012-04-16 18:08:20 -04:00
Behdad Esfahbod 69b84a8f6c Fix hb-view surface size calc for vertical text
For some reason it doesn't quite work with IranianNastaliq, but
that looks like a font issue.
2012-04-12 15:50:40 -04:00
Behdad Esfahbod 8b8b19056d [util] Add hb-shape utility
Like hb-view, but prints out buffer contents.

The output format is kinda cryptic.  Suggestions welcome.
2011-09-19 16:41:17 -04:00