Commit Graph

731 Commits

Author SHA1 Message Date
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
Behdad Esfahbod cf02d13302 [cairo] Remove unused struct 2022-12-23 13:37:59 -07:00
Matthias Clasen a3ba723876 Drop an unneeded include 2022-12-23 13:37:59 -07:00
Matthias Clasen 0800d1879c Try to fix autotools build 2022-12-23 13:37:59 -07:00
Matthias Clasen 5451b78f4a Don't use alloca
It complicates things on Windows, for no
big win. Just preallocate a reasonable amount.
2022-12-23 13:37:59 -07:00
Matthias Clasen 7c12db46ff Try to fix msvc build 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
Matthias Clasen c65f580b93 Drop hb-test
This was a test binary to assist in developing
the hb-paint code. Not needed anymore, now that
hb-view has the same code in the cairo userfont
backend.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 9672aa8610 [util] Fix compiler warning 2022-12-23 13:37:59 -07:00
Matthias Clasen 955bd30365 Fix hb-cairo-utils
This was a stupid mistake, and hard to track down.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 3573956705 [util] Include stdio.h 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 7accbe97d8 [util] Fix argument order and root transform PNGs 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 529dc40d7d [util] Adjust scaling
Still doesn't render PNGs.

Fix a few compiler warnings
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 6cadf280f2 Use hb-cairo-utils in hb-test
Just to prove that it works.
2022-12-23 13:37:59 -07:00
Matthias Clasen 8bcd13dd91 small fixup to hb-cairo-utils 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 3b32eab38e [colr] Fix compiler warning 2022-12-23 13:37:59 -07:00
Behdad Esfahbod e3153654cb [colr] Fix PNG placement 2022-12-23 13:37:59 -07:00
Behdad Esfahbod f07ce68f9c Remove unused function 2022-12-23 13:37:59 -07:00
Matthias Clasen 0a2f3673b9 [paint] Use tags for image formats
This fits better with the rest of the
HarfBuzz API.
2022-12-23 13:37:59 -07:00
Matthias Clasen 485ba9beb3 [paint] Spell out rectangle in the API
No need to abbreviate this.
2022-12-23 13:37:59 -07:00
Matthias Clasen 37f3f0fcc2 [paint] Change the image callback
Instead of passing the glyph ID, give
it the image blob, a mimetype, and
glyph extents (if available).

Update all callers.
2022-12-23 13:37:59 -07:00
Matthias Clasen 9876e30c6e test: Support png images via paint_image 2022-12-23 13:37:59 -07:00
Matthias Clasen 0d890061d1 Rename 'solid' to 'color'
'solid' does not really describe well what
the function does, and there is no strong
reason to stick 1:1 to the terminology used
in the spec.
2022-12-23 13:37:59 -07:00
Matthias Clasen 2c07828603 test: More debug spew 2022-12-23 13:37:59 -07:00
Behdad Esfahbod fdf17dbf34 Try fixing bots 2022-12-23 13:37:59 -07:00
Matthias Clasen 5c6329555e Apply root transform
This commit applies scale, slant is still missing.
2022-12-23 13:37:59 -07:00
Matthias Clasen 794fa4c3c1 sweep gradients etc 2022-12-23 13:37:59 -07:00
Matthias Clasen d07fdc69dd test: dump color lines 2022-12-23 13:37:59 -07:00
Matthias Clasen 627c857f8b rename pop_group_and_composite 2022-12-23 13:37:59 -07:00
Matthias Clasen c9350838c7 assorted fixes and changes 2022-12-23 13:37:59 -07:00
Matthias Clasen 5a123e8691 quick testcase 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 0066e824f0 [util] Fix vertical positioning with --glyphs 2022-12-23 13:37:38 -07:00
Behdad Esfahbod 265b699fbd [util] Improve --glyphs 2022-12-23 13:31:48 -07:00
Behdad Esfahbod d45f7265e9 [hb-view/hb-shape] Add --glyphs
This makes hb-view take output of hb-shape and render it.
2022-12-23 13:13:29 -07:00
Garret Rieger 1a51f71afd [subset] don't segfault when --help-all is specified w/ instancing options. 2022-12-19 16:02:05 -07:00
Nirbheek Chauhan c7dd63d1a0 meson: Provide binaries when built as a subproject 2022-12-18 08:28:55 +02: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
Garret Rieger 9fbe52b88d [subset] enable instancing tests by default. 2022-12-12 20:24:24 +00:00
Garret Rieger eda02c2ebd [subset] Move hb_subset_preprocess to be non-experimental. 2022-12-08 16:32:24 -07:00
Behdad Esfahbod 1b86753031 [hb-subset] Support -u, -g, -t
For --unicodes, --gids, --text.
2022-12-05 11:44:52 -07:00
Behdad Esfahbod a4a4078632
Merge pull request #3893 from googlefonts/preprocess_test
[subset] Fix testing of preprocess
2022-11-24 11:56:58 -07: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
Garret Rieger 4c49daf7cd [subset] actually use the preprocessed face in hb-subset.
Tests weren't actually using the preprocessed face due to this typo in util/hb-subset.
2022-11-23 22:33:57 +00:00
Behdad Esfahbod 8f15fb1252 [util] Move variable closer to use 2022-11-13 17:06:58 -07:00
Behdad Esfahbod 0e4f579493 [util/hb-view] Default HB_DRAW to 1
See comments.
2022-10-31 13:51:24 -06:00
Garret Rieger 515863e57c [subset] Remove add accelerator flag, replace with new api method.
Adds hb_subset_preprocess() which preprocesses the face and attaches accelerator data.
2022-10-13 23:42:00 +00:00
Garret Rieger 3394ec7048 [subset] use subset accelerator in tests.
This ensures it produces equivalent subsets as without the accelerator.
2022-10-13 23:02:54 +00: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 f43dadb8ee Rename kashida -> tatweel 2022-07-30 10:23:03 -06:00
Behdad Esfahbod 4f09ea5e6b [hb-shape] Add --safe-to-insert-kashida flag
https://github.com/harfbuzz/harfbuzz/pull/3762
2022-07-30 10:12:24 -06:00
Behdad Esfahbod 61d0c54701 [ft] Pass design, not normalized, coords to freetype
Needed for avar2 to work.
2022-07-23 13:26:18 -06:00
Behdad Esfahbod a66ba594b4 [util] Fix stack-underflow
Fixes https://github.com/harfbuzz/harfbuzz/issues/3737
2022-07-19 16:32:32 -06:00
Behdad Esfahbod c6ef11daf5 [util] Fix build with HB_NO_VAR 2022-07-19 15:19:52 -06:00
Qunxin Liu 2a4773e43d add option "--instance", store axes_location in subset_plan and drop all
variation tables when all axes are pinned at default
2022-07-18 14:59:07 -06:00
Behdad Esfahbod 1eb8e82086 [util] Accept space as delimiter for --features/--variations
Fixes https://github.com/harfbuzz/harfbuzz/issues/3715
2022-07-18 14:49:04 -06:00
Behdad Esfahbod faac252f9f [util/hb-ot-shape-closure] Fix showing glyph names 2022-07-18 12:23:57 -06:00
Behdad Esfahbod 38f2ec1703 [hb-shape] Move shape_output_t into separate file 2022-07-18 12:17:08 -06:00
Behdad Esfahbod 94be459808 [hb-shape] Internal rename 2022-07-18 12:13:48 -06:00
Behdad Esfahbod faa8cdc898 [util] Allow HB_CHAFA=2/3 to enable wedges/all symbols in Chafa 2022-07-18 10:22:19 -06:00
Behdad Esfahbod b4e95965c8 [util] Revert Chafa to use simple blocks only
The wedges are nice but not available on Mac.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3729
2022-07-18 10:14:14 -06:00
Behdad Esfahbod ab21c4c283 [hb-view] Add one to row of padding 2022-07-14 16:02:10 -06:00
Behdad Esfahbod 2da36cf99a [hb-view] Use envvar HB_CHAFA=0 to disable Chafa output 2022-07-14 15:57:43 -06:00
Behdad Esfahbod 76e6feb77f [util/ansi] Enable all symbols in Chafa
Gives vastly smoother output. The previous setting was
equivalent to our in-house renderer.
2022-07-14 13:45:39 -06:00
Behdad Esfahbod 679c87ca36 [util/ansi] Fix chafa cell width/height
No idea why it was set to 10/20 instead of 8/16.
2022-07-14 13:39:14 -06:00
jfkthame 0cd404d0b8 Typo fix in hb-subset
s/substract/subtract/
2022-07-09 13:34:48 -06:00
Garret Rieger 38e81f2be9 [subset] Add --layout-scripts command line flag. 2022-06-30 21:09:11 +00:00
Behdad Esfahbod f8d052df6d [ansi-print] Remove impossible condition 2022-06-22 18:35:48 -06:00
Behdad Esfahbod 251320ea22 [ansi-print] Whitespace 2022-06-22 16:44:07 -06:00
Behdad Esfahbod 0d59d7952c [ansi-print] Precision 2022-06-22 16:41:02 -06:00
Behdad Esfahbod c695a09154 [ansi-print] Reorder cases; harmless 2022-06-22 16:33:37 -06:00
Behdad Esfahbod ae0fce31cd [ansi-print] Fix quadrants 2022-06-22 16:31:21 -06:00
Behdad Esfahbod 2ebaf0c5ba [ansi-print] Fix unicolor detection 2022-06-22 16:22:02 -06:00
Behdad Esfahbod a4db80ca0a [ansi-print] Fix color calculation
Still something's wrong.
2022-06-22 16:13:53 -06:00
Behdad Esfahbod 6dd7e31f71 [util] Accept | as delimiter in Unicode parsing 2022-05-31 04:09:59 -06:00
Cosimo Lupo cc0f1f3b60 Expose --passthrough-tables option to hb-subset CLI tool 2022-04-12 10:40:46 -06:00
Behdad Esfahbod 56f11ec938 [buffer] Add HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT
Fixes https://github.com/harfbuzz/harfbuzz/issues/3454
2022-02-18 17:52:27 -06: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 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 640b6ffddd [util] Default font-funcs to 'ot' instead of 'ft' 2022-02-13 13:21: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 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 6a3dec357c [util/draw] Use hb-draw in hb-view only if HB_DRAW=1 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 5c558586eb [util/draw] Apply slant to non-user-fonts as well 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 4818b7ed72 [util] Add --font-slant 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 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 d35f380126 [util] Change "All shapers failed." message to "Shaping failed."
Since we now emit this when verification fails as well.
2022-01-29 09:08:20 -07:00
Behdad Esfahbod 61823838f9 [buffer] Add HB_BUFFER_FLAG_VERIFY
Move buffer verification code inside the library, from util/.

Part of https://github.com/harfbuzz/harfbuzz/issues/3010
2022-01-28 13:53:44 -07:00
Behdad Esfahbod 36b1561715 Implement hb-shape --verify unsafe-to-concat flag
15 tests failing. Those look like legit places that unsafe-to-concat
needs more implementation.
2022-01-22 11:53:18 -07:00
luz paz e2e305066a Fix various typos
Found via `codespell -q 3 -S ./perf/texts -L actualy,ba,beng,fo,gir,inout,nd,ot,pres,ro,te,teh,timne`
2022-01-16 05:39:03 -08:00
Behdad Esfahbod 52f5711ed0 [buffer] Add hb_buffer_create_similar()
Fixes https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:57:42 -07:00
Behdad Esfahbod d0c3515ce4 [util] Copy unicode_funcs in copy_buffer_properties()
Part of https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:26:41 -07:00
Behdad Esfahbod 34f5b855aa [util] Simplify copy_buffer_properties()
Now that hb_buffer_append() overlays segment_properties we can do this.

Part of https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:25:45 -07:00
Behdad Esfahbod 101d07efd9 [util] Move copy_buffer_properties() out of loop
Now that hb_buffer_append() overlays properties, we can do this.

Part of https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:25:40 -07:00
Behdad Esfahbod 720ab0883b [util] Add --single-par
Use it in aots tests

Fixes https://github.com/harfbuzz/harfbuzz/issues/3129
Related https://github.com/harfbuzz/harfbuzz/issues/3298
2021-11-25 11:49:16 -07:00
Behdad Esfahbod b58afe586f [util] Undo treat as single-paragraph text provided on cmdline
Reverts d92ee726ce
except that it does so even in batch mode.

Am going to add a --single-par mode that will affect all input
modes.

Part of https://github.com/harfbuzz/harfbuzz/issues/3129
Fixes https://github.com/harfbuzz/harfbuzz/issues/3298
2021-11-25 11:34:24 -07:00
Behdad Esfahbod da500568de [API] Add hb_buffer_[sg]et_not_found_glyph() and --not-found-glyph
Instead of using gid=0 when a character is not found in the font,
client can now set a custom value.  This is useful for shaper-driven
font fallback and to differentiate that from .notdef glyph.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1360
2021-10-26 08:02:29 -06:00
Garret Rieger d700646c33 [subset] In preperation for 3.0.0 release remove legacy subsetting api methods. 2021-09-16 15:31:29 -06:00
Behdad Esfahbod cd77846bd9 [util] Fix leak of an hb_font_t 2021-09-14 08:35:19 -04:00
Behdad Esfahbod da285d511f [util/shape-consumer] Simplify font tracking 2021-09-14 08:28:12 -04:00
Khaled Hosny 838d670752 [subset] Improve alignment of --help-all message 2021-09-08 15:12:52 +02:00
Behdad Esfahbod 04cf6212d7 [util/hb-subset] Fix --version and --help again
38ad093216
2021-08-30 18:35:26 -06:00
Behdad Esfahbod fdce294120 [util/hb-subset] Print error and suggest filing github issue if operation fails
https://github.com/harfbuzz/harfbuzz/issues/3173#issuecomment-906715780
2021-08-29 09:46:42 -06:00
Behdad Esfahbod 38ad093216 [util/hb-subset] Don't ignore errors during face parsing
Was ignoring file-not-found errors.
2021-08-29 09:46:42 -06:00
Garret Rieger 1e1438c4fb
[subset] fix --*-file options in hb-subset. (#3176)
The previous change to add -/+ versions of each set type broke all of the --*-file input options since all of the parse functions now default to replacing the set if the + variant is not being used. This fixes the issue by changing parse_file_for to pass '+' as the name to the parsing function. This triggers the append mode.
2021-08-26 14:59:29 -06:00
Garret Rieger 9db494f517
[subset] Update remaining subset input sets to use inversion for all. (#3172)
* [subset] Update remaining subset input sets to use inversion for all.

* [subset] Update flag help for remaining sets to mention -=.
2021-08-26 10:51:38 -06:00
Behdad Esfahbod 99356ea5f0
Merge pull request #3150 from harfbuzz/item-context-tests
[test] Add tests for item context
2021-08-25 17:19:06 -06:00
Garret Rieger 75efade7a4 [subset] format --gids and --unicodes help messages better. 2021-08-25 14:51:21 -07:00
Garret Rieger fa4bf7cf58 [subset] use inverted sets for glyph id input.
Adds --gids-=, --glyphs-=, --text-=, --unicodes-= options. Use inverted sets to represent all glyphs and/or all unicodes.
2021-08-25 14:31:11 -07:00
Garret Rieger 8f4f47df7c [subset] use inverted set for all unicodes.
Modify the code that handles input->unicodes to be safe with possibly inverted sets. Also adds --unicodes-= and --unicodes+= flags.
2021-08-25 13:34:05 -07:00
Garret Rieger f2441a4b65 [subset] Remove retain all layout features flag.
Instead use inverted sets to handle requesting all features. Modifies feature collection in subset plan to intersect the set of requested features against the features in the font. This prevents iterating a fully filled feature tag set.
2021-08-24 18:17:07 -06:00
Khaled Hosny 430224b1a0 [buffer] Handle pre/post-context in buffer_append
Fixes https://github.com/harfbuzz/harfbuzz/issues/1843
2021-08-24 02:11:17 +02:00
Khaled Hosny 6ca0ffd42e [util] Add --unicodes-before/after
Parallel to --unicodes for --text-before/after. To be used in tests.
2021-08-24 02:08:01 +02:00
Behdad Esfahbod 829b0f3353
Merge pull request #3154 from harfbuzz/set-invert
Resurrect hb_set_invert()
2021-08-20 01:28:15 -06:00
Behdad Esfahbod 7115af23eb [util] Fix glib deprecation warning re g_memdup() 2021-08-19 15:55:21 -06:00
Simon Cozens e29f56354a Replace "langstr" with more helpful help. 2021-08-18 09:31:44 -06:00
Behdad Esfahbod ccc2a1921a [util/hb-subset] Whitespace 2021-08-12 13:00:28 -06:00
Behdad Esfahbod 4dfc668e0a [util/hb-subset] Move glyph name parsing inline instead of post_parse
Now that we have face around we can just do it as it happens.
2021-08-12 13:00:28 -06:00
Behdad Esfahbod 08d43d1ba1 [util/hb-subset] Move add_all_unicodes inline, instead of post_parse
Now that we have the font loaded, we can do it as it happens.
2021-08-12 13:00:28 -06:00
Behdad Esfahbod 11b0b68853 [util/hb-subset] Pre-parse font-face so we can use it during main parsing 2021-08-12 13:00:28 -06:00
Behdad Esfahbod c45d2a9c9d [util] Allow setting cli summary / description 2021-08-12 11:19:59 -06:00
Behdad Esfahbod 4f3b7b7035 [util] Remove unused usage 2021-08-12 11:05:31 -06:00
Behdad Esfahbod 1cb621d35d [util/hb-subset] Minor move parsing 2021-08-12 10:58:19 -06:00
Behdad Esfahbod 3f94177ee8 [util] Use g_set_error() in one more place 2021-08-12 10:43:31 -06:00
Behdad Esfahbod 4d73b3d9b1 [util] Add --batch to hb-view / hb-ot-shape-closure 2021-08-12 10:39:46 -06:00
Behdad Esfahbod 23282c9c9d [util/hb-subset] Support ranges in --unicodes / --unicodes-file
Fixes https://github.com/harfbuzz/harfbuzz/issues/3109
2021-08-11 22:49:47 -06:00
Behdad Esfahbod f60f005b1f [util/hb-subset] Remove wrong hb_set_destroy() in error paths 2021-08-11 22:36:00 -06:00
Behdad Esfahbod 49cf36027c [util/hb-subset] Parse --gids-file, --glyphs-file, --text-file, --unicodes-file
Fixes https://github.com/harfbuzz/harfbuzz/issues/2455
Fixes https://github.com/harfbuzz/harfbuzz/issues/3002
2021-08-11 22:34:14 -06:00
Behdad Esfahbod bf80b7ea45 [util/hb-subset] Add --glyphs for passing glyph names
Part of https://github.com/harfbuzz/harfbuzz/issues/2455
2021-08-11 22:07:45 -06:00
Behdad Esfahbod 5b07c3c7d0 [util/hb-subset] Parse --text & --unicodes 2021-08-11 21:32:28 -06:00
Behdad Esfahbod 4ec727e55f [util] Minor edit of failure messages 2021-08-11 20:46:16 -06:00
Behdad Esfahbod b83f25c749 [util/hb-subset] Revamp option groups 2021-08-11 20:42:20 -06:00
Behdad Esfahbod 9a6055caa8 [util/hb-ot-shape-closure] Remove unnecessary include 2021-08-11 20:30:25 -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 ba418cfc52 [util] Use automatic casts 2021-08-11 19:29:07 -06:00
Behdad Esfahbod 97a9e4e41e [util] Separate shape_text_options_t from text_options_t 2021-08-11 19:28:16 -06:00
Behdad Esfahbod 6ba7ddafed [util] Move text-file opening to post_parse 2021-08-11 19:06:57 -06:00
Behdad Esfahbod 23298bc846 [util] Remove unnecessary check 2021-08-11 18:58:25 -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 c0ea4e2d33 [util] Use post_parse to validate 2021-08-11 18:30:08 -06:00