Commit Graph

279 Commits

Author SHA1 Message Date
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
Ebrahim Byagowi 70e13ade81
[subset] Fix Windows issue on endlines (#756) 2018-02-06 13:20:38 +03:30
Garret Rieger 2ea228935d ssize_t -> size_t 2018-02-05 15:10:01 -08:00
Garret Rieger c25898eb54 Switch to fopen() instead of open() in subset test. open wasn't compiling on windows. 2018-02-05 14:35:32 -08:00
Garret Rieger fc04f11ce1 Rename HB_SUBSET_sources -> HB_SUBSET_CLI_sources to match what cmake is looking for. 2018-02-05 11:12:33 -08:00
Garret Rieger e428f7b1c2 Wrap unistd.h include in ifdef. 2018-02-05 10:24:16 -08:00
Behdad Esfahbod ae39fc8171 [subset] Build hb-subset into separate libharfbuzz-subset.so 2018-02-04 20:18:52 -05:00
Behdad Esfahbod eac20e4595 [subset] Minor 2018-02-04 20:08:50 -05:00
Rod Sheeter edcd3b80e9 Actually call hb_subset 2018-02-04 12:57:34 -08:00
Garret Rieger f83a43b561 Add CMake configuration for all of the new subsetting code. 2018-02-04 12:57:34 -08:00
Garret Rieger 5bc0cda179 Add missing unistd header to hb-subset. 2018-02-04 12:57:34 -08:00
Garret Rieger 058b1260ad Re-write hb-subset utility to use main-font-text driver. 2018-02-04 12:57:34 -08:00
Garret Rieger ede84ffa42 Whitespace 2018-02-04 12:57:34 -08:00
Rod Sheeter e9d154ac8d tweak test failure output. write to a temp file not stdout. test still fails because expected is not just an identical copy of input 2018-02-04 12:57:33 -08:00
Rod Sheeter 9ccb8366f6 Start to sketch APIs for subsetting 2018-02-04 12:57:33 -08:00
Behdad Esfahbod 4c4a9fc861 Typo
Fixes https://github.com/harfbuzz/harfbuzz/issues/711
2018-01-17 09:48:08 -08:00
Behdad Esfahbod 7c32e01d04 Minor 2018-01-11 10:47:31 +01:00
Behdad Esfahbod 746a37d5bd [util] Replace setlinebuf 2018-01-10 16:47:47 +01:00
Behdad Esfahbod ff2083c53e [util] Set stdio files to line buffering
So we can stream lines to hb-shape and read output.
2018-01-10 13:58:41 +01:00
Behdad Esfahbod 3b1e97f364 Add HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES
New API:
HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES
hb-shape / hb-view --remove-default-ignorables

One more text-rendering-tests test passing.  Eleven failing.
2018-01-10 03:36:03 +01:00
Behdad Esfahbod 3f29ea9144 [util] Add hb-shape --ned
For not displaying extra data: no clusters, no advance. Just data pertaining
to where glyphs end up on the screen.
2018-01-10 02:50:49 +01:00
Behdad Esfahbod 71fd6325b6 Add option to buffer serialization to not output glyph advances
When advances are not printed, glyph offsets reflect absolute glyph
positions.

New API:
HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES
hb-shape --no-advances
2018-01-10 02:50:49 +01:00
Behdad Esfahbod 7b837e20d2 [util] Add TODO item 2018-01-03 12:46:29 +00:00
Olivier Blin 0fd89dc61c [hb-ft] Fix build when Multiple Master font support is disabled in freetype
FT_Set_Var_Blend_Coordinates() is not available when "Multiple Master
font interface" is disabled in freetype's modules.cfg
2017-12-04 10:52:06 -08:00
Behdad Esfahbod bb7cc4eada Minor 2017-11-20 19:39:47 -08: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 dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod c3448e8d21 Use static_assert instead of custom ASSERT_STATIC 2017-10-15 12:02:00 +02:00
Behdad Esfahbod dad431e75b [util] Include hb-private.hh
Simplifies compatibility issues by centralizing all boilerplate code
in hb-private.hh.
2017-10-15 10:55:32 +02:00
Behdad Esfahbod 9355218f58 [util] Add a few shorthand forms for commandline options
-o, -O, -u, -v, -V
2017-09-09 11:21:07 -07:00
Behdad Esfahbod d03f11f246 Fix buffer_diff for empty buffers
If buffers are empty, content type should be ignored.

This fixes last of the failing tests: fuzzed.tests.  Green again!
2017-09-04 20:14:13 -07:00
Behdad Esfahbod 03a5a6f873 [util] Add --unicodes to hb-view / hb-shape
Fixes https://github.com/behdad/harfbuzz/issues/154
2017-09-01 19:12:22 -07:00
Behdad Esfahbod b262ebcc9c [util] Fix cluster sweeping during --verify
If *I* get this wrong in 2017, I have no idea how others get their head around
cluster math...

Fixes tests/arabic-fallback-shaping.tests
2017-08-30 17:26:07 -07:00
Behdad Esfahbod 69d701b02e [util] When --verify fails, return reconstructed shape results 2017-08-30 17:07:29 -07:00
Behdad Esfahbod 099472e08b hb_buffer_diff() tweak
I like to have a mode where CONTAINS_NOTDEF and CONTAINS_DOTTEDCIRCLE are not
returned.  Abused a value of -1 for that.  hb-shape now uses it.  Fixes two
of the six tests failing with --verify in test/shaping/run-tests.sh.
2017-08-30 16:45:06 -07:00
Behdad Esfahbod a9e52a1af4 [util] Prefix trace lines with "trace:", and error lines with "error:" 2017-08-15 17:30:18 -07:00
Behdad Esfahbod 7ea10c35a3 [util] Respect eot/bot in safe-to-break test; hook up hb_buffer_diff() 2017-08-15 17:25:04 -07:00
Behdad Esfahbod a88e2a73f3 [util] Fix leaks 2017-08-14 14:49:21 -07:00
Behdad Esfahbod 05fabbd03e [unsafe-to-break] Towards verifying unsafe-to-break in --verify
We break and shape fragments and reconstruct shape result from them.
Remains to compare to original buffer.  Going to add some buffer
comparison API and use here, instead of open-coding.
2017-08-11 20:00:55 -07:00
Behdad Esfahbod d2052278f2 [util] Add --verify to hb-shape / hb-view that verifies shape results
Right now it checks for monotone cluster values.  Other checks to be added.
2017-08-11 15:12:25 -07:00
Behdad Esfahbod 40bd7e9a1c [unsafe-to-break] Add UNSAFE_TO_BREAK flag
Not all shapers code is updated to set this properly.
GSUB and Arabic shaper are updated.
GPOS and other shapers are NOT.

Fixes https://github.com/behdad/harfbuzz/issues/224
2017-08-10 15:02:28 -07:00
Behdad Esfahbod 3e44748ebe [util] Fix two other Coverity warnings 2017-08-09 22:09:01 -07:00
Behdad Esfahbod 356f93b64b [util] Fix warning 2017-08-09 22:06:53 -07:00
Behdad Esfahbod 6f38845d9c [hb-shape] Rename --show-messages to --trace
https://github.com/behdad/harfbuzz/issues/506
2017-07-19 17:20:55 -07:00
Behdad Esfahbod e60350551a [hb-shape] Improve shaping-debug output
Before, that was printed using --debug (and in both hb-shape and hb-view).
Changed it, now hb-shape has a new command-line argument called --show-messages.
When invoked, it also respects other output formatting options.  The messages
are better formatted and printed to te same place that hb-shape output is
directed to.  Previously they were written to stderr.

Fixes https://github.com/behdad/harfbuzz/issues/506
2017-07-18 19:16:09 -07:00
Philip Withnall 925ceacfed util: Add missing field initialisers in constructor (#410)
Coverity ID: 141042
2017-02-07 18:17:48 -08:00
Behdad Esfahbod a429090572 [var] Flesh out --variations documentation 2017-01-22 19:01:07 -08:00
Behdad Esfahbod 7647a05a0b Minor 2017-01-22 17:47:49 -08:00
Behdad Esfahbod 47ee34e847 [var] Hook up variations to FreeType face
hb-view correctly renders variations with ft font-funcs now.
hb-ot-font needs HVAR implementation.
2017-01-21 18:10:08 -08:00
Behdad Esfahbod 111f3e5517 [util] Add --variations
Is hooked up to the font, but not to FreeType, so raster doesn't show yet.

Documentation needs to be done.
2017-01-21 17:51:41 -08:00
Behdad Esfahbod de508516cb [util] Print out --debug buffer to stderr 2016-04-26 11:28:37 -07:00
Chun-wei Fan 35ded3af74 build: Move source listings into separate Makefile snippets
This moves all the source listings in src/Makefile.am,
src/hb-ucdn/Makefile.am and util/Makefile.am into separate Makefile
snippets, so that they may be shared between different Makefile-based
build systems, such as NMake for Visual Studio.
2016-02-03 18:14:29 +08:00
Behdad Esfahbod 0475ef2f97 [buffer] Add debugging, aka, message, API
Currently just announces lookup applications.  Message-API *will* change.
hb-shape / hb-view are updated to print-out messages to stder if --debug
is specified.
2015-12-18 19:29:06 +00:00
Behdad Esfahbod 21e5d7edc4 [util] Use O_BINARY instead of _O_BINARY
The latter doesn't seem to be available in Cygwin.  I'm surprised it
compiled before...
2015-12-17 16:28:38 +00:00
Behdad Esfahbod 808d3fc0ea [util] Port hb-view to use font metrics from HarfBuzz instead of cairo 2015-12-10 16:55:16 +01:00
Chun-wei Fan a49e7b7e40 MSVC builds: Add fallback implementation for pre-2013 MSVC
Pre-2013 MSVC does not have scalbn() and scalbnf(), which are used in the
utility programs.  Add  fallback implementations for these, which can be
used when necessary.
2015-11-16 23:04:36 +08:00
Chun-wei Fan 998e8dda93 util: Fix build on Visual Studio
Use the fallback implementation for lround() only on pre-2013 Visual
Studio, and ensure we are clear about the types of the parameters for
lround() and scalbnf(), since Visual Studio can be quite picky on
ambiguous parameter types.  Also, use g_ascii_strcasecmp() rather than
strcasecmp() as we are already using GLib for this code and we are
assured that g_ascii_strcasemp() is available.

For scalbnf() on pre-2013 Visaul Studio, a fallback implementation is
needed, but use another forced-included header for those compilers, which
will be added later.

Also use (char)27 on Visual Studio builds as '\e' is not a recognized
escape sequence, which will do the same thing.
2015-11-16 23:04:35 +08:00
Behdad Esfahbod e97835ad43 [util] Fix crash when --output-file is specified but not --output-format 2015-11-10 11:37:01 -08:00
Behdad Esfahbod 6c0ebd02c9 [util] If font has color, generate PNG with color 2015-11-05 11:37:48 -08:00
Behdad Esfahbod 3530cc2d7c [util] Fix option-parsing leaks 2015-11-03 12:13:28 -08:00
Behdad Esfahbod 642135f3b2 [util] In --debug mode, duplicate font data
This has the effect that the font data will end up in a memory
section malloc()ed exactly to its size.  This gives us better
valgrind detection of out-of-bounds access.

Previously, the font data was placed in a mmap()ed section or
GString-allocated area, which didn't have proper protections
at the end when running under valgrind.
2015-11-03 11:26:34 -08:00
Behdad Esfahbod fdd1770e00 Add API/cmdline to show glyph extents when serializing buffer
New API: HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS

hb-shape now accepts --show-extents.

Patch from Simon Cozens.
2015-08-24 13:49:55 +01:00
Behdad Esfahbod 376d587f36 Implement more granular cluster-merging
TODO: Documentation.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71445
2015-07-22 16:51:12 +01:00
Behdad Esfahbod cd042fc8c4 [util] Disable hb-fc-list for now
Until I figure out what to do about the API, and finalize
the tool.
2015-06-18 11:07:52 -07:00
Behdad Esfahbod 16dac7eccf Fix build 2015-06-03 12:07:46 -07:00
Behdad Esfahbod ff0f210519 [util] Minor 2015-05-18 18:37:46 -07:00
Behdad Esfahbod 820505a186 Whitespace 2015-04-13 23:51:45 -07:00
Behdad Esfahbod 76d5733111 Merge pull request #86 from cpfair/hb-shape-output-help-improvement
Improve hb-shape/hb-view's help text w.r.t. output options
2015-04-13 23:40:35 -07:00
Behdad Esfahbod fe97b65a54 [utils] Add hb-fc-list
This is a tool that lists all fonts that can render a given string.
It uses hb_shape() to do so, and as such is aware of HarfBuzz's
normalizer.
2015-04-09 19:16:57 -07:00
Behdad Esfahbod e8fd83932a [util/hb-view] Fix rendering with all combinations of negative scales 2015-04-09 15:52:26 -07:00
Behdad Esfahbod 69d5af9316 [util] Minor 2015-04-09 15:17:16 -07:00
Behdad Esfahbod a664810e38 [util] Accept comma as well as space when separating components of args
Applies to --font-size and --margin.

Hopefully the scanf usage here doesn't have compatibility issues
(star being counted in the return value, etc).
2015-04-09 15:05:07 -07:00
Behdad Esfahbod e2d4e8480d [util] Add convenience "make lib" target 2015-02-25 15:43:24 -08:00
Collin Fair 9ee176ee97 Stop hb-shape docs leaking into hb-view 2015-02-14 09:59:44 -05:00
Collin Fair 952b8dbdf6 'All' of the above, not 'each' 2015-02-14 09:45:20 -05:00
Collin Fair 9e867b6446 Remove reference to --help-output-content in --help-output (as --help-output-format's options aren't available in hb-view) 2015-02-14 09:32:50 -05:00
Collin Fair 1d55ffeb66 Add serialization syntax documentation. Clarify naming and wording in --help-output/--help-format 2015-02-14 09:29:35 -05: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 5789ca69d7 [util] Minor 2015-01-20 12:45:13 -08:00