Commit Graph

657 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 9468e46998 [util] Rename main_font_text back to main_font_text_t 2021-08-11 16:46:04 -06:00
Behdad Esfahbod 7e4fcf1be8 [util] Rename add_main_options 2021-08-11 12:12:49 -06:00
Behdad Esfahbod 62fb102184 [util] Move add_main_options() invocation 2021-08-11 12:03:07 -06:00
Behdad Esfahbod 9d8bbe3e53 [util] Make main_font_text a struct again
Going to move to G_OPTION_REMAINING.
2021-08-11 11:53:32 -06:00
Behdad Esfahbod 5bd463f130 [util/hb-subset] Access input directly 2021-08-10 14:26:48 -06:00
Behdad Esfahbod 6905f6fa60 [util/hb-subset] Use templated function to parse flags directly 2021-08-10 14:24:42 -06:00
Behdad Esfahbod 3e3e1801a5 [util] Small tweaks in --help output 2021-08-10 14:24:42 -06:00
Behdad Esfahbod f3acb977ec [test/shaping;util] Use ';' instead of ':' to separate test fields
Accept that in --batch mode. Also in batch mode don't send the 0th arg.

Related discussion: https://github.com/harfbuzz/harfbuzz/pull/3102
2021-08-10 11:08:36 -06:00
Behdad Esfahbod b83fd3a564 [util] Refactor batch-processing code into batch.hh 2021-08-10 02:32:55 -06:00
Behdad Esfahbod d92ee726ce [util/hb-shape] Treat as single-paragraph text other than provided by a file
Fixes https://github.com/harfbuzz/harfbuzz/issues/3129
2021-08-09 19:16:13 -06:00
Behdad Esfahbod 7d2e9164ab [util] Move text options into text_options_t
Remove now empty options.cc.
2021-08-07 13:38:19 -06:00
Behdad Esfahbod 93bc62e9b2 [util] Move output options into output-options.hh 2021-08-07 13:13:58 -06:00
Behdad Esfahbod af9d2495dc [util] Use inheritance for output_options_t 2021-08-07 13:09:56 -06:00
Behdad Esfahbod 9db0fd4821 [util] Don't show --output-format if no supported formats provided 2021-08-07 12:22:17 -06:00
Behdad Esfahbod 5545eea7e5 [util] Remove main_font_text_t class, use bare function 2021-08-07 11:04:46 -06:00
Behdad Esfahbod 58c223357b [util] Move face/font options into face/font-options.hh 2021-08-06 23:47:48 -06:00
Behdad Esfahbod 6edd50ae7f [util] Move option_parser_t code into options.hh 2021-08-06 23:36:45 -06:00
Behdad Esfahbod 798bb89c96 [util] Move shape format options into shape-format.hh 2021-08-06 23:30:55 -06:00
Behdad Esfahbod c3599fded7 [util] Move shape options into shape-options.hh 2021-08-06 23:24:28 -06:00
Behdad Esfahbod cfb2d6ad9e [util] Move view options into view-options.hh 2021-08-06 23:14:30 -06:00
Behdad Esfahbod 167f58a2ca [util] Move subset options into subset-options.hh 2021-08-06 23:10:49 -06:00
Behdad Esfahbod 370e961faf [util/hb-subset] Use hb-subset.h public API instead of poking inside
Oops.
2021-08-06 22:59:50 -06:00
Behdad Esfahbod 4e97678ebb [util] Use inheritence to embed inherent options of objects 2021-08-06 22:53:44 -06:00
Behdad Esfahbod 06d661803c [util] Fix compiler error
../util/options.cc:588:3: error: narrowing conversion of ‘font_size_flags’ from ‘unsigned int’ to ‘gint {aka int}’ inside { } [-Werror=narrowing]
2021-08-06 19:20:47 -06:00
Behdad Esfahbod c5337c43e9 [util] Fold helper-cairo.cc into helper-cairo.hh 2021-08-06 19:19:50 -06:00
Behdad Esfahbod c329ce1000 [util] Also hide ppem settings in hb-ot-shape-closure
Leaving ptem, as that can in theory change shape closure if we apply it
to optical-size axis (we currently don't).
2021-08-06 19:17:12 -06:00
Behdad Esfahbod c40e00796c [util] Fold helper-cairo-ansi.cc into helper-cairo-ansi.hh 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 4fe43ccbf1 [util] Fold ansi-print.cc into ansi-print.hh 2021-08-06 19:17:12 -06:00
Behdad Esfahbod b1db0e4a0f [util] Fold view-cairo.cc into view-cairo.hh 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 6500f68f1f [util] Change hb-subset to use face_options_t instead of font_options_t 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 869e20e09f [util] separate face options from font options 2021-08-06 19:17:12 -06:00
Behdad Esfahbod b3a2f2bfcf [util/main-font-text] Simplify 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 71440dbd90 [util] Move font-size and upem to be extern variables 2021-08-06 19:17:12 -06:00
Behdad Esfahbod fc0339eef0 [util] Simplify shape-consumer by removing buffer arg 2021-08-06 19:17:12 -06:00
Behdad Esfahbod e014c6fa2d [util/main-font-text] Move eol from template arg to main() arg 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 463411a1de [util] Remove unused option_group_t 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 8588173ee6 [util] Rework post_parse() handling 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 3362b48f5a [util] Templatize add_group logic 2021-08-06 19:17:12 -06:00
Behdad Esfahbod fe90fbeba3 [util] Remove unused pre_parse callback logic 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 09e4d7dd30 [util] Simplify output_options_t 2021-08-06 19:17:12 -06:00
Behdad Esfahbod e109f9a6f9 [util] Collect cmdline arg options outside of constructor 2021-08-06 19:17:12 -06:00
Behdad Esfahbod e57dd66889 [util] Initialize struct members inline 2021-08-06 19:17:12 -06:00
Behdad Esfahbod 21f1054d47 [util/hb-subset] Keep face around instead of font 2021-08-06 19:17:12 -06:00
Behdad Esfahbod db6fbe29e4 [util/hb-subset] Use driver_t<> in outer block as well
a363ce573c (r54282223)
2021-08-04 10:25:03 -06:00
Behdad Esfahbod 47d47e8c43 [util/hb-shape/hb-subset] Don't terminate on first error in batch mode
There's no reason to quit processing.  The failure is already
communicated via stdout in both cases.
2021-08-01 22:12:08 -06:00
Behdad Esfahbod a363ce573c [util/hb-subset] Minor refactor of batch mode
To match recent changes to hb-shape.
2021-08-01 22:11:13 -06:00
Khaled Hosny 10e73d188a [test] Add batch mode to hb-subset and use it
time meson test --suite=subset down from:
real	0m22.822s
user	0m44.561s
sys	0m9.255s

to:
real	0m19.418s
user	0m38.171s
sys	0m3.587s

Does not seem to help much, but it is something.

Part of https://github.com/harfbuzz/harfbuzz/issues/3089
2021-08-01 22:08:28 -06:00
Behdad Esfahbod ed99c80623 [util/hb-shape] Refactor driver type duplication 2021-08-01 08:14:59 -06:00
Behdad Esfahbod 05cf81283b [util/hb-shape] Fix use of EOF as end-of-line
EOF is -1, which was being treated as a valid char (255).
Use int instead.
2021-08-01 08:12:40 -06:00
Garret Rieger f9d8e4a976 [subset] switch ..._set_flags to not take a mask. 2021-07-29 18:30:27 -07:00
Garret Rieger 3d534b146c [subset] convert subset input flags into bit flags.
Store the flags in a bit set. Updates the public api to work with the bit set directly.
2021-07-29 18:02:34 -07:00
Behdad Esfahbod d7541f7b55 [util/hb-shape] Free cached resources on termination 2021-07-29 00:34:52 -06:00
Behdad Esfahbod ad03f34df7 [util/hb-shape] Cache blob/face in batch mode 2021-07-29 00:34:52 -06:00
Behdad Esfahbod 5dae8297bb [util] Minor followup to https://github.com/harfbuzz/harfbuzz/pull/3083 2021-07-28 11:35:40 -06:00
Khaled Hosny 50379fbb15 [util] Don’t split text at new lines in batch mode
In batch mode (which is used for testing) we are probably not interested
in splitting text into lines as we could have split the string into
different tests. This fixes a bunch of AOTS tests that use newlines as
input.
2021-07-28 11:35:09 -06:00
Khaled Hosny 92b85749f2 [util] Strip quotes when parsing features
When running in batch mode, the quotes are not stripped by the shell and
end up in the feature string. This breaks one of the AOTS tests.

Alternatively, we can remove the quotes from the test files, not sure
which is less hacky, though!
2021-07-28 11:35:09 -06:00
Qunxin Liu 71b5509c19 [subset] support option --glyph-names 2021-07-23 13:57:39 -07:00
Garret Rieger 668f2bd93e [subset] Add hb_subset_or_fail () to public subset api. 2021-07-22 12:12:36 -07:00
Qunxin Liu eee7b459ee [subset] add option --no-prune-unicode-ranges 2021-06-24 11:44:20 -07:00
Qunxin Liu d07f789ae3 [subset] support option "--notdef-outline" 2021-06-18 15:35:02 -07:00
Behdad Esfahbod bdfed8f113 [blob] Add failing versions of create API
Fixes https://github.com/harfbuzz/harfbuzz/issues/2567

New API:
+hb_blob_create_or_fail()
+hb_blob_create_from_file_or_fail()

Use these in util/ to distinguish empty file from not-found file.
Only err on the latter.
2021-06-15 13:56:30 -06:00
Behdad Esfahbod c61ce962cf [buffer] In hb_buffer_get_positions(), return NULL if inside message callback
As discussed in https://github.com/harfbuzz/harfbuzz/issues/2468#issuecomment-645666066

Part of fixing https://github.com/harfbuzz/harfbuzz/issues/2468
2021-06-10 17:36:38 -06:00
Qunxin Liu cb5a6b5a27 [subset] support option --layout-features 2021-05-26 18:04:18 -06:00
Garret Rieger 73ff04a324 [subset] add option to have the subsetter set the mac overlaps flag on each glyph. 2021-05-26 16:04:56 -06:00
Garret Rieger 1bb00cd54b [subset] add num-iterations flag to util/hb-subset. 2021-05-26 15:20:44 -06:00
Behdad Esfahbod 42bf8e3d49 [util] Disable chafa's truecolor mode
See https://github.com/harfbuzz/harfbuzz/pull/2959#issuecomment-827056111
2021-04-26 12:31:44 -06:00
Hans Petter Jansson 8298c2f93b [hb-view] Use Chafa for terminal graphics if available
This produces high-quality terminal graphics using symbols or sixels
according to the detected terminal capabilities.

Fixes #2430.
2021-04-26 12:13:10 -06:00
Behdad Esfahbod b3159ed8d2 [util] Silence compiler warning 2021-03-30 20:52:56 -06:00
Khaled Hosny c30349d54e [hb-view] Support kitty inline images protocol
https://github.com/harfbuzz/harfbuzz/issues/2758
2021-03-29 15:55:40 -06:00
Khaled Hosny f7d5889b3e [hb-view] Support iTerm2 inline images protocol
https://github.com/harfbuzz/harfbuzz/issues/2758
2021-03-29 15:55:40 -06:00
Khaled Hosny 97a093c52f [hb-subset] Improve error handling a bit
* Check that output-file option is actually set before trying to open
  it.
* Print file name and errno when opening the output file fails.
* Be more resilient when writing output file and use ferror() to check
  for errors.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2711
2020-10-13 11:18:59 -07:00
Simon Cozens c0716bb5dc Move delimiter addition into hb-buffer-serialize 2020-10-09 22:27:55 -06:00
Simon Cozens a0203a28bb Use hb_buffer_serialize to trace in utils 2020-10-09 22:27:55 -06:00
Ebrahim Byagowi 5193357832 Revert "Remove autotools build support"
This reverts commit 01ac32aab2.
2020-08-11 23:51:59 +04:30
Ebrahim Byagowi 01ac32aab2 Remove autotools build support 2020-08-07 23:28:12 +04:30
Ebrahim Byagowi 58a5961ca1 minor spacing tweak 2020-07-29 08:44:23 +04:30
Ebrahim Byagowi 07c43b8cf6 minor spacing tweak 2020-07-29 08:42:52 +04:30
Ebrahim Byagowi 5a7cc7fd8b minor spacing tweak 2020-07-29 08:33:38 +04:30
Ebrahim Byagowi ba810ce83d [tests] Replace space with colon in batch mode 2020-07-06 13:53:19 +04:30
Christoph Reiter 03bd6ead44 [meson] Only pass required dependencies to everything
Instead of passing dependencies as required we used one giant shared
dependency list containing all dependencies for every library/executable.
While this kinda works, the specified deps are also used for generating
the pkg-config files and this leads to lots of Requires.private and Libs.private
entries which aren't really needed.

This removes the "deps" array and replaces it with a few smaller ones and
makes sure the public libraries only get passed the dependencies actually
needed.

Fixes #2441
2020-06-04 23:28:57 +04:30
Behdad Esfahbod 069c5de9f8 [util/hb-view] Add --font-extents
Fixes https://github.com/harfbuzz/harfbuzz/issues/2402
2020-05-14 19:00:37 -07:00
Qunxin Liu b2a965df5e [subset] Add support for "--gids" option
cmap subsetting now retains entries associated with any glyph ids explicitly requested
2020-05-11 15:28:58 -07:00
David Corbett 5a0936f53e Increase the size of the serialization buffer 2020-04-23 16:32:20 -07:00
Ebrahim Byagowi 2a549aadd3
minor 2020-04-21 00:32:34 +04:30
Ebrahim Byagowi 2be859d289 minor, replace nullptr checks with implicit ones 2020-04-21 00:30:34 +04:30
Ebrahim Byagowi 1dd3896688 [meson] Make it work on autotools dist 2020-03-12 14:49:40 +03:30
Aaron Boxer 68f982415b meson: update to latest master 2020-03-11 19:18:57 +03:30
Tim-Philipp Müller 618584e923 meson: rename incbase to incconfig
Makes it clearer what it's for: config.h. See #4.
2020-03-11 19:18:57 +03:30
Tim-Philipp Müller 49ba211a9d meson: add options to enable/disable various features
And fix build without GLib. Fixes #2.
2020-03-11 19:18:57 +03:30
Mathieu Duponchelle 484313ff36 meson: install 2020-03-11 19:18:57 +03:30
Mathieu Duponchelle 99b26789d2 meson: more windows fixes 2020-03-11 19:18:57 +03:30
Mathieu Duponchelle 920efc0ef7 Add Meson build definitions
Fixes #490

http://mesonbuild.com
2020-03-11 19:18:57 +03:30
Qunxin Liu 36a5c042d7 [subset] Add "--name-languages" and "--name-legacy" options
Make name table subsetting consistent with fontTools
2020-01-24 23:17:04 +03:30
Ebrahim Byagowi e171beeb5f Revert "[subset] Add "--name-languages" and "--name-legacy" options"
Causes tests failures, please reapply when tests are fixed, thanks.

This reverts commit fd85818b5b.
2020-01-24 19:51:32 +03:30
Qunxin Liu fd85818b5b [subset] Add "--name-languages" and "--name-legacy" options
Make name table subsetting consistent with fontTools
2020-01-23 17:24:05 -08:00
Ebrahim Byagowi ce114d6b27 minor, tweak spaces 2019-12-31 15:53:02 +03:30
Evgeniy Reizner b79ceac3c6 Prefer UINT_MAX instead of uint overflow.
Also, prefer HB_FEATURE_GLOBAL_START and HB_FEATURE_GLOBAL_END.
2019-12-15 11:46:05 -08:00
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Zero King 6d53cda1ba [util] Fix memory leak 2019-07-26 08:56:47 -07:00
Qunxin Liu 1da1b4dc94 [subset] For option "--unicodes", add support for "*" to retain all code points 2019-07-15 11:18:50 -07:00
Bruce Mitchener 659eeddb2d Use C++11 override keyword. 2019-06-04 20:31:32 -07:00
Bruce Mitchener 5846884f86 test: Use nullptr in C++ code. (#1744) 2019-06-03 12:30:25 +04:30
Qunxin Liu 993d81b9c5 [subset] Add one ttf file with fvar/STAT tables to integration test
Ignore gvar/MVAR/HVAR table
add support for --nameIDs=* option
2019-05-22 17:20:45 -07:00
Garret Rieger 0ff3618c2d [subset] Use hb_subset_input_t inside of subset_options_t so that input defaults are shared between the library and cli. 2019-05-20 13:35:46 -07:00
Garret Rieger 67064294a0 [subset] Add drop-tables option to hb-subset util. 2019-05-20 13:35:46 -07:00
Qunxin Liu e501ea143d [subset] Subset name table step 3, add --nameids option to guide the
selection of which name records to keep in the subset method.
2019-04-26 15:24:47 -07:00
David Corbett 45adc18526 Fix or document unsupported font-feature-settings 2019-02-25 17:48:16 -05:00
Garret Rieger 490d52f908 [subset] Add retain-gids option to hb-subset executable. 2019-01-29 13:19:21 -08:00
Behdad Esfahbod 60022ecced Fix -Wcast-function-type warnings in util/ with gcc 4.8 2019-01-26 14:04:51 +01:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod 3f8e7a98d3 [util/hb-subset] Add --layout to keep GDEF/GSUB/GPOS
Will become default and option removed in the future.
2018-12-12 11:32:57 -05:00
Behdad Esfahbod 9844c880e2 Minor 2018-12-11 17:28:04 -05:00
Michiharu Ariza b403be8ad9 Merge branch 'master' into cff-subset 2018-11-16 12:29:18 -08:00
Ebrahim Byagowi 11aa0468ac [subset] minor, adjust spaces 2018-11-16 00:02:47 +03:30
Michiharu Ariza 43ee0e4d00 Merge branch 'master' into cff-subset 2018-11-06 09:57:17 -08:00
Behdad Esfahbod 9bddfde25d [util] Fix up previous commit 2018-11-06 11:03:34 -05:00
Behdad Esfahbod 3ec2e4fa7b [util] Don't terminate string after a a 0 in -u
Fixes https://github.com/harfbuzz/harfbuzz/issues/1361
2018-11-06 10:49:19 -05:00
Michiharu Ariza 481fdfdc23 Merge branch 'cff-subset' of https://github.com/harfbuzz/harfbuzz into cff-subset 2018-11-02 15:28:09 -07:00
Michiharu Ariza 6186dbf1be added hb_subset_input_set_desubroutinize API
hooked up with CFF1 subroutinizer
a renaming
2018-11-01 17:25:23 -07:00
Michiharu Ariza e600e5440b Merge branch 'master' into cff-subset 2018-11-01 16:13:56 -07:00
Michiharu Ariza d56e338a90 CFF1 no-desubroutinize + no-hinting
no-desubroutinize option is disabled for now
code cleanup (esp. CFF1 width handling)
bug fixes & renaming
2018-10-31 22:30:34 -07:00
Behdad Esfahbod edaa768253 [util] Use fgets instead of getline such that windows passes 2018-10-30 01:35:58 -07:00
Behdad Esfahbod 83a612739a [util] Minor 2018-10-30 01:29:58 -07:00
Ebrahim Byagowi f7a08cd41d
Fix extra semicolon issues and test that on CI (#1330) 2018-10-30 11:29:09 +03:30
Behdad Esfahbod 58e20f53bf [util] Add hb-shape --batch 2018-10-30 00:52:22 -07:00
Behdad Esfahbod 6131fb6283 [util] Don't close stdin/stdout 2018-10-30 00:52:22 -07:00
Khaled Hosny cf92cb7e00 Use g_strdup instead of strdup
Cygwin does not seem to have strdup.
2018-10-19 22:46:40 +02:00
Ebrahim Byagowi eeddda3ec6
[util] Better file-not-found error from hb-shape / hb-view
fixes #1266
2018-10-18 07:38:47 +03:30
Behdad Esfahbod 1e8fdd285f Remove HAVE_OT
We never tested compiling without it.  Just kill it.  We always build
our own shaper.
2018-10-10 16:32:35 -04:00
Behdad Esfahbod e42cd58c99 Rename invisible_codepoint to invisible_glyph in API
Deleted recently added API:
    hb_buffer_set_invisible_codepoint()
    hb_buffer_get_invisible_codepoint()

    hb-shape / hb-view --invisible-codepoint

New API:
    hb_buffer_set_invisible_glyph()
    hb_buffer_get_invisible_glyph()

    hb-shape / hb-view --invisible-glyph

Fixes https://github.com/harfbuzz/harfbuzz/issues/1216
2018-10-07 20:47:30 -04:00
Behdad Esfahbod 71b65eb27d Add API for setting invisible-codepoint
Fixes https://github.com/harfbuzz/harfbuzz/issues/1216

New API:
hb_buffer_set_invisible_codepoint()
hb_buffer_get_invisible_codepoint()

hb-shape / hb-view --invisible-codepoint
2018-10-07 18:43:26 +02:00
Behdad Esfahbod 310bdac4a0 Fix a warning 2018-10-04 16:31:14 +02:00
Ebrahim Byagowi 6353cc1f83
[circleci] Fix some of warnings from clang-everything bot (#1211)
* -Wshift-sign-overflow
* -Wmissing-prototypes
2018-10-02 21:39:19 +03:30
Ebrahim Byagowi 0fa1edbd3b
[circleci] Couple of fixes (#1200)
* Raise error on warnings on -everything
* Enable fontconfig to two bots
* Fix msan bot now that all of its real complain are gone
2018-10-01 09:40:29 +03:30
Behdad Esfahbod b5285b3479 [util] Remove unneeded virtual
clang warning:

../../util/options.hh:72:13: warning: destination for this 'memset' call is a pointer to dynamic class
      'option_parser_t'; vtable pointer will be overwritten [-Wdynamic-class-memaccess]
    memset (this, 0, sizeof (*this));
    ~~~~~~  ^
../../util/options.hh:72:13: note: explicitly cast the pointer to silence this warning
    memset (this, 0, sizeof (*this));
            ^
            (void*)
2018-09-30 12:23:01 +02:00
Behdad Esfahbod 89ed040b21 [util] Fix more non-virtual-destructor warnings 2018-09-30 06:08:11 -04:00
Behdad Esfahbod 2382dd07fa Minor 2018-09-30 06:08:11 -04:00
Behdad Esfahbod 9caa432d0c [util] Use HB_FALLTHROUGH
Sure, gcc knows to warn about this as well:

../../util/options.cc:175:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
     case 1: m.r = m.t;
             ~~~~^~~~~
../../util/options.cc:176:5: note: here
     case 2: m.b = m.t;
     ^~~~

But HOLY SMOKES, look at clang -Weverything bot message:

options.cc:176:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    case 2: m.b = m.t;
    ^
options.cc:176:5: note: insert 'HB_FALLTHROUGH;' to silence this warning
    case 2: m.b = m.t;
    ^
    HB_FALLTHROUGH;

Right, it's telling me to insert "HB_FALLTHROUGH;" there!!!!!!!!!
2018-09-30 06:08:11 -04:00
Behdad Esfahbod 2e728a7d86 [util] Mark var static
From clang -Weverything bot:

options.cc:39:3: warning: no previous extern declaration for non-static variable 'supported_font_funcs' [-Wmissing-variable-declarations]
2018-09-30 06:08:11 -04:00
Behdad Esfahbod e910a1aef4 [util] Add empty virtual destructor to option_group_t
From clang -Weverything bot:

./options.hh:57:8: warning: 'option_group_t' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]
struct option_group_t
       ^
2018-09-30 06:08:11 -04:00
Behdad Esfahbod 04caf11608 [hb-view] Change subpixel bits from 8 to 6
To match FreeType units, such that FreeType gets correct size from us.
This matters more now that we allow setting --ft-load-flags.
2018-09-26 12:13:47 -04:00
Behdad Esfahbod 606bf57430 Revert forcing use of single-parameter static_assert()
Some clang versions define static_assert as a macro apparently, so we cannot
redefine it...

This reverts commit 94bfea0ce6.
This reverts commit 4e62627831.
2018-09-16 19:34:39 +02:00
Behdad Esfahbod 94bfea0ce6 Fix build, another try 2018-09-16 19:12:19 +02:00
Behdad Esfahbod f90bab8560 [util] Add --ft-load-flags
Useful for performance testing.

Not hooked to cairo yet.  Just changes shaping, not rasterization.
2018-09-11 14:23:35 +02:00
Behdad Esfahbod 93f7596254 [util] Add -n shorthand for --num-iterations
Meh.
2018-09-11 14:11:10 +02:00
Behdad Esfahbod 93fe0faaee [subset] Clean up hb_subset_input_t API 2018-08-29 18:24:03 -07:00
Behdad Esfahbod f39166f0c0 [subset] Remove unused hb_subset_profile_t
We might reintroduce it later, but for now remove, as it was unused.
Some things that should have been in this object (drop_hints, etc)
are already in hb_subset_input_t.  So, for now, keep everything there.
2018-08-29 18:09:55 -07: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
Ebrahim Byagowi 159ddb8729
Treat - just as /dev/stdin and remove one extra file reader (#1065) 2018-06-24 23:09:16 +04:30
Ebrahim Byagowi d0c2889dfc
Revert file blob sanitization and index checking (#1062)
As https://github.com/harfbuzz/harfbuzz/pull/1059#issuecomment-397912812 we
like to still work with blobs that harfbuzz itself can't handle directly that are failing sanitization
currently apparently.
2018-06-18 19:59:33 +04:30
Ebrahim Byagowi c53697d3f2
Verbose fail when something is wrong with hb-shape/hb-view input font file (#1059)
This checks if the blob isn't empty and uses `hb_face_count`
to see if the font file passes the simple font file sanitization
so can detect if the input is actually a font and checks also
whether input font-index is out of range.
2018-06-17 17:04:55 +04:30
Ebrahim Byagowi aa0c5df419
Fix reading fonts from stdin (#1060)
We were passing the font path directly to freetype so rendering
was broken when we are getting the font from stdin.

This fixes it by using FT_New_Memory_Face instead.

This fixes:
* build/util/hb-view /dev/stdin text < font.ttf
* build/util/hb-view - text < font.ttf
* cat font.ttf | build/util/hb-view - text

but doesn't work on
* cat font.ttf | build/util/hb-view /dev/stdin text

which I will try to fix separately.
2018-06-17 16:49:34 +04:30
Ebrahim Byagowi eaf649450a Resolve clang's conditional-uninitialize warnings 2018-04-23 11:38:45 -07:00
Ebrahim Byagowi ce17340b23 Add hb_blob_create_from_file, a new API (#926) 2018-04-20 07:59:06 +02:00
Khaled Hosny 6fdeeb2ae3 [util] Check all specified shapers are known (#993)
A bit brute force and requires all shapers to be known, not just one.

Fixes https://github.com/harfbuzz/harfbuzz/issues/956
2018-04-19 22:41:37 +02:00
David Corbett 8269791900 Allow trailing non-numeric chars in --unicodes 2018-03-26 01:36:37 -07:00
Behdad Esfahbod 127096e474 [util] Remove line buffering
Something weird seems to be going on. Just kill it.

Fixes https://github.com/harfbuzz/harfbuzz/issues/888
2018-03-15 13:23:27 -07:00
rsheeter 4a1d51ef15
Merge pull request #818 from googlefonts/drophints
[subset] Drop hints
2018-02-26 20:23:41 -08:00
Ebrahim Byagowi bb82f01383 [aat] trak sanitization 2018-02-26 00:15:26 -08:00
Rod Sheeter d78393b554 Merge branch 'master' of https://github.com/harfbuzz/harfbuzz into drophints 2018-02-23 17:53:26 -08:00
Ebrahim Byagowi 4f6f7c3b22
[util] Implement ppem/ptem on hb-{shape,view} (#811) 2018-02-23 02:54:12 +03:30
Rod Sheeter 74e0c13a4a [subset] drop hint tables if so flagged. Still need to dump glyf instructions. 2018-02-21 11:19:18 -08:00
Rod Sheeter 0bd100e144 [subset] add --hinting flag 2018-02-21 10:34:00 -08:00
Behdad Esfahbod 9046e92442 [subset] Rename constructor to hb_subset_input_create_or_fail()
To signify that unlike rest of library, returns nullptr on failure.
2018-02-13 22:07:12 -08:00
Behdad Esfahbod d5b33f2fe1 [subset] hb_subset_input_t changes 2018-02-13 13:55:10 -08:00
Behdad Esfahbod 70b06cc6e7 More fixes 2018-02-10 16:13:06 -06:00
Behdad Esfahbod 4011d885b7 [util] Remove use of ssize_t which was failing on MSVC 2018-02-10 14:09:06 -06:00
Behdad Esfahbod 570d523761 [subset] Merge remote-tracking branch 'googlefonts/master' 2018-02-10 13:24:22 -06:00
Behdad Esfahbod d0f3e7f597 [util] Use setlinebuf() if present
To work around mysterious bug on OS X.

Fixes https://github.com/harfbuzz/harfbuzz/issues/727
2018-02-10 12:46:11 -06:00
Rod Sheeter 8431c38cdc remove output noise 2018-02-08 19:20:58 -08:00
Behdad Esfahbod 194140d3f3 [util] Minor 2018-02-08 16:27:57 -06:00
Behdad Esfahbod af02812fc5 [subset] Change hb_subset API to remove hb_subset_face_t 2018-02-07 13:07:46 -05:00
Rod Sheeter 6c52d94fd1 capture the set of codepoints passed by --unicodes 2018-02-07 12:41:21 -05:00
Garret Rieger 7481f0ce21 Add codepoints to subset input. 2018-02-07 12:41:21 -05:00