Commit Graph

583 Commits

Author SHA1 Message Date
Behdad Esfahbod 85e8f2b53f [hb-subset] Initialize preprocess variable 2023-01-01 18:26:08 -07:00
Behdad Esfahbod 4a5bd7a926 [subset] Add hb_subset_input_keep_everything()
Fixes https://github.com/harfbuzz/harfbuzz/issues/3998

New API:
+ hb_subset_input_keep_everything()
2023-01-01 16:53:28 -07:00
Behdad Esfahbod d87add41b3 [hb-subset] Rename --preprocess-face to --preprocess
Keep old name working but hidden.
2023-01-01 16:27:26 -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 2bbc57c3c4 [chafa] Residual 2022-12-29 20:41:55 -07:00
Behdad Esfahbod 962d4925b2 [ansi] Optimize write 2022-12-29 20:39:02 -07:00
Behdad Esfahbod a35f8e340b [ansi] Whitespace 2022-12-29 20:34:23 -07:00
Behdad Esfahbod 0004ec13a6 [view] Write ansi output to --output-file
Was writing to stdout all this time!
2022-12-29 20:32:46 -07:00
Behdad Esfahbod 3a319b59bd [ansi] Write \e directly 2022-12-29 20:26:09 -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 dc9ca63763 [hb-view] Remove stale disabled code path
With color rendering that code path is wrong anyway.
And cairo now supports subpixel text positioning.
2022-12-27 17:49:02 -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
Matthias Clasen 7d3b373925 Fix the autotools build 2022-12-27 08:37:46 -05: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 120419e180 [hb-view] Fix autotools build 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
Behdad Esfahbod 5f168db884 [hb-view] Build with autotools if cairo-ft is not available
Like with meson.
2022-12-26 15:12:27 -07:00
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
Matthias Clasen 4816be9ab5 Work around cairo limitations
If we just draw an image, cairos recording surface
complains that it is unbounded. Its not true of course.

To make things work, clip to the extents.
2022-12-24 09:16:29 -05:00
Matthias Clasen 76c16095fa Fix the build on Windows
No __BYTE_ORDER there.
2022-12-24 05:30:11 -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
Matthias Clasen 13e0cb64f4 hb-view: Interpolate gradients premultiplied
This is what the specs demand.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 381d410b1e [paint] Add HB_PAINT_IMAGE_FORMAT_BGRA and use it in hb-ft
Now hb-ft can render color emoji as well.

Just left COLRv2.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 63db0d2aed [util] Speculatively fix build against non-PNG builds 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