Commit Graph

68 Commits

Author SHA1 Message Date
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 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 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
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
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
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 3530cc2d7c [util] Fix option-parsing leaks 2015-11-03 12:13:28 -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 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 8650def735 [util] Add option to set font function implementation to use
Supports ft and ot right now.  hb-view currently not rendering with ot.
Will fix after some clean up.
2014-07-05 15:51:25 -04:00
Behdad Esfahbod 2306ad46dc [util] Fix memory issue 2014-07-04 18:09:29 -04:00
Behdad Esfahbod ea5e8a02eb [util] Plug minor leak 2014-03-19 15:38:02 -07:00
Behdad Esfahbod c2bc818706 Work with old and new glib
Avoids "deprecated" warnings.
2013-10-27 23:37:14 +01:00
Behdad Esfahbod 4dc798de19 Add hb-deprecated.h, and rename a couple enum values
Add deprecated alias for old name.
2013-08-27 11:46:08 -04:00
Behdad Esfahbod 50067e280f [util] Add --num-iterations
Useful for profiling shapers.
2013-04-11 16:31:01 -04:00
Behdad Esfahbod c462b32dcb Disable automatic segment properties guessing
Before, if one called hb_shape() without setting script, language, and
direction on the buffer, hb_shape() was calling
hb_buffer_guess_segment_properties() on the user's behalf to guess
these.

This is very dangerous, since any serious user of HarfBuzz must set
these properly (specially important is direction).  So now, we don't
guess properties by default.  People not setting direction will get
an abort() now.  If the old behavior is desired (fragile, good for
simple testing only), users can call
hb_buffer_guess_segment_properties() on the buffer just before calling
hb_shape().
2013-02-15 07:51:47 -05:00
Behdad Esfahbod e2aab4b5db Improve checks for setmode()
As reported by Jonathan, OS X has setmode() that is something other
than what setmode() is on Win32.  So, limit invocation to Windows
platforms only.
2013-02-12 15:35:32 -05:00
Behdad Esfahbod bc76449f51 Use setmode() instead of _setmode()
Looks like Cygwin / MSVC declare it that way, and it still works on
MinGW32 cross.
2013-01-31 18:18:05 -05:00
Behdad Esfahbod 1172dc7362 Rename hb_buffer_clear() to hb_buffer_clear_contents()
The previous name was clashing with harfbuzz.old.  There are systems
that need to link both...

Clash-free now again.
2013-01-07 16:46:37 -06:00
Behdad Esfahbod 9815a88111 [util] List supported output formats in --help output 2012-12-21 16:46:53 -05:00
Behdad Esfahbod 6bad092aa8 [util] Default to "text" output format in hb-shape
If you say:

  hb-shape font.ttf text --output-file out.txt

This was previously failing:

  Unknown output format `txt'; supported formats are: TEXT / JSON

Now we simply fallback to TEXT if no explicit format was requested.
2012-12-21 16:01:52 -05:00
Behdad Esfahbod f9edf16725 Add buffer serialization / deserialization API
Two output formats for now: TEXT, and JSON.  For example:

  hb-shape --output-format=json

Deserialization API is added, but not implemented yet.
2012-11-15 13:10:07 -08:00
Behdad Esfahbod 407f80d625 [util] Add --bot / --eot / --preserve-default-ignorables 2012-11-13 15:33:27 -08:00
Behdad Esfahbod 321f73c16e [util] Add --text-before and --text-after to hb-shape / hb-view
Use with Arabic, for example, to see the effect on joining.
2012-11-13 15:12:24 -08:00
Behdad Esfahbod ade7459ea7 [util] Fix leaks 2012-08-06 19:49:42 -07:00
Behdad Esfahbod 39b17837b4 Add hb_buffer_normalize_glyphs() and hb-shape --normalize-glyphs
This reorders glyphs within the cluster to a nominal order.  This should
have no visible effect on the output, but helps with testing, for
getting the same hb-shape output for visually-equal glyphs for each
cluster.
2012-07-17 17:09:29 -04:00
Behdad Esfahbod 0594a24484 Cleanup TRUE/FALSE vs true/false 2012-06-05 20:35:40 -04:00
Behdad Esfahbod c188548312 Add --verbose to hb-shape
Just turns all --show-* options on.
2012-06-04 09:09:59 -04:00
Behdad Esfahbod ae62166519 [util] Minor 2012-06-02 12:21:19 -04:00
Behdad Esfahbod 5db0683a82 [util] Make hb-shape continue shaping other lines if shapers failed 2012-06-02 12:13:08 -04:00
Behdad Esfahbod c87b317f0e [util] Add hb-ot-shape-closure tool
Computes all the glyphs that may be generated given a font and
set of Unicode characters.

The order of the Unicode characters is irrelevant.

Sample output:

behdad:util 0$ ./hb-ot-shape-closure Doulos\ SIL\ Regular.ttf f
f f_f

behdad:util 0$ ./hb-ot-shape-closure Doulos\ SIL\ Regular.ttf i
i

behdad:util 0$ ./hb-ot-shape-closure Doulos\ SIL\ Regular.ttf fi
f f_i f_f_i f_f i

behdad:util 0$ ./hb-ot-shape-closure DroidNaskh-Regular.ttf ب
uni0628 uni0628.init uni0628.medi uni0628.fina

behdad:util 0$ ./hb-ot-shape-closure DroidNaskh-Regular.ttf ا
uni0627 uni0627.fina

behdad:util 0$ ./hb-ot-shape-closure DroidNaskh-Regular.ttf با
uni0627 uni0627.fina uni0628 uni0628.init uni0628.medi uni0628.fina

behdad:util 0$ ./hb-ot-shape-closure DroidNaskh-Regular.ttf با --no-glyph-names
5 6 133 134 135 136
2012-05-15 23:53:18 -04:00
Behdad Esfahbod 912c5ff80a Reduce default margin 2012-05-13 12:51:02 +02:00
Behdad Esfahbod 52e7b1424a [util] Make hb-view print out Unicode art if stdout is a terminal 2012-05-13 07:55:00 +02:00
Behdad Esfahbod 30874b4819 [util] Make tools default to stdin if no text is provided
One less argument to type in typical testing workflow!
2012-05-12 15:54:27 +02:00
Behdad Esfahbod 2097951110 [util] Change default font size of hb-view to 256
Most common usecase of hb-view is to test rendering of short words for
testing / inspection.  Not having to type "--font-size 150" each time
isn't such a bad idea...
2012-05-12 15:41:48 +02: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 6bd9b479b8 Hide backend-specific shape functions
Also remove shaper_options argument to hb_shape_full().  That was
unused and for "future".  Let it go.

More shaper API coming in preparation for plan/planned API.
2012-04-12 14:53:53 -04:00
Behdad Esfahbod d530024168 [util] Make clusters work with char offset instead of UTF-8 offset
This means the --features indices also refer to char position
instead of byte position now.  Same for cluster values reported
by hb-shape.

Will add an option for byte indices later.
2012-01-21 19:07:22 -05:00
Behdad Esfahbod cdc673d97c [hb-shape] Add --show-line-num
Ok, much more useful as a test suite driver now.
2012-01-19 12:46:18 -05:00