Commit Graph

88 Commits

Author SHA1 Message Date
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod cc8428756a [shape-plan] Cache shape plans with variations based on variation indices 2018-11-12 18:48:10 -05:00
Behdad Esfahbod f33ad6d692 [aat] Fix up previous commit and add files 2018-10-23 14:31:51 -07:00
Behdad Esfahbod 8be0e5fd45 [ot-map] Minor 2018-10-23 13:39:50 -07:00
David Corbett 7f1fbfe2e3 Add hb_ot_tags_to_script_and_language 2018-10-11 13:54:28 -04:00
David Corbett 91067716f5 Refactor the selection of script and language tags
The old hb-ot-tag.cc functions, `hb_ot_tags_from_script` and
`hb_ot_tag_from_language`, are now wrappers around a new function:
`hb_ot_tags`. It converts a script and a language to arrays of script
tags and language tags. This will make it easier to add new script tags
to scripts, like 'dev3'. It also allows for language fallback chains;
nothing produces more than one language yet though.

Where the old functions return the default tags 'DFLT' and 'dflt',
`hb_ot_tags` returns an empty array. The caller is responsible for
using the default tag in that case.

The new function also adds a new private use subtag syntax for script
overrides: "x-hbscabcd" requests a script tag of 'abcd'.

The old hb-ot-layout.cc functions,`hb_ot_layout_table_choose_script` and
`hb_ot_layout_script_find_language` are now wrappers around the new
functions `hb_ot_layout_table_select_script` and
`hb_ot_layout_script_select_language`. They are essentially the same as
the old ones plus a tag count parameter.

Closes #495.
2018-10-11 13:54:28 -04:00
Behdad Esfahbod f048ead84a Some more 2018-09-24 18:04:17 -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 4e62627831 Enforce single-param static_assert() only
So we don't accidentally break it again.
2018-09-16 18:09:36 +02:00
Behdad Esfahbod 71c9f84e7c Make --features rand=1 available to the user
Use rand=255 to mean "randomize".

Part of https://github.com/harfbuzz/harfbuzz/pull/803
2018-09-11 10:47:59 +02:00
David Corbett f05df643b4 Allow requesting a specific glyph for 'rand'
Randomization only happens by default. If the user specifies a value for
'rand', that value is respected.
2018-09-11 10:47:59 +02:00
David Corbett c2a75e07e5 Implement 'rand' 2018-09-11 10:47:59 +02: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
Behdad Esfahbod bddeb2b10c Minor renamings of internal inline functions 2018-07-10 14:13:21 +02:00
Behdad Esfahbod f9abbf83b6 Fix fallout from 975bdd5ef5
Ouch!
2018-06-02 15:46:08 -07:00
Behdad Esfahbod f7515769fd [vector] Use Crap pool in push() as well 2018-06-01 17:48:37 -07:00
Behdad Esfahbod 90869e6962 [ot] Apply langsys's required feature even if no other feature exists 2018-05-07 14:12:17 -07:00
Behdad Esfahbod 978ace6fbb Improve _hb_popcount()
Support 128bit type.
2018-02-16 16:08:45 -08:00
Behdad Esfahbod 12757b6929 Misc warning fixes
Fixes https://github.com/harfbuzz/harfbuzz/issues/712
2018-01-26 18:14:05 -08: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 5287ccc935 [unsafe-to-break] Allocate public bits from 0 2017-08-10 15:02:34 -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 cdf1fd0627 [indic] Add infrastructure to disable ZWNJ-skipping in context-matching
Not used yet.
2017-07-14 12:43:34 +01:00
Behdad Esfahbod 72ada4f0c6 [GX] Hook up feature variations
Shape-plan caching is not implemented.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 7ceadbe981 Shuffle code around 2016-12-16 19:06:26 -06:00
Behdad Esfahbod bde5e3959c Move add_lookups from map to map-builder
In prep for more changes.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 09c7a2d6bf Limit bits-per-feature to eight
Limits number of alternatives per glyph per feature to 255, so be it.
That's better than possibly breaking shaping because of one bad feature
value.
2016-08-08 17:29:30 -07:00
Behdad Esfahbod 333173103b Fix sign of shift operators
This one:

  map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);

before the fix, the shift was done as an int, causing overflow
if it ever got to 1 << 31.  Sprinkle 'u's around.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=634805
2016-08-08 17:28:14 -07:00
Behdad Esfahbod 731a430cd3 Fix requiredFeature stage handling logic
Originally the way Jonathan had written this was correct in
"continue"ing:

35e28c7a73 (diff-ead86a33a5cc9ad7f6e6381031a0baddR199)

When I rewrote his patch, I messed it up:

da13293798 (diff-ead86a33a5cc9ad7f6e6381031a0baddR209)

the intended behavior was NOT to set found=TRUE and NOT to continue.
This was resulting in feature_index[table_index] being left unset.
Oops!
2016-03-02 13:32:42 -08:00
Behdad Esfahbod ea512f7108 Use C-style casts instead of compare to 0, to convert hb_bool_t to bool 2015-11-26 19:22:22 -05:00
ThePhD 5c99cf93d6 Merge branch 'master' into vc++-fixes 2015-08-14 01:02:00 -04:00
Behdad Esfahbod 0f98fe88f4 [ot] Search globally for 'vert' feature if not found in specified script/lang
Fixes https://github.com/behdad/harfbuzz/issues/63
2015-07-23 11:52:11 +01:00
ThePhD 8e545d5961 Fix all VC++ warnings and errors in the current commit's builds. 2015-06-22 22:29:04 -04:00
Jonathan Kew da13293798 Rework handling of requiredFeature to solve problem with rlig in arial.ttf from winxp
https://bugzilla.mozilla.org/show_bug.cgi?id=986802
Fixes https://github.com/behdad/harfbuzz/pull/39

API Change:

-hb_ot_layout_language_get_required_feature_index
+hb_ot_layout_language_get_required_feature

New API takes an extra pointer argument.  Pass NULL in to get
behavior of previous API.

Reworked by behdad
2014-06-19 16:33:48 -04:00
Behdad Esfahbod fb8cc86ff9 Rename sort() to qsort()
In an effort to make the algorithm used clear.
2014-06-19 15:31:09 -04:00
Behdad Esfahbod 176fd17d02 Bug 70971 - Signed/unsigned compiler warnings on windows
Patch from Emil Eklund.
2013-10-30 17:27:24 +00:00
Behdad Esfahbod 27674b4bb3 [OTLayout] Protect against out-of-range lookup indices
Filter them out when compiling map.
2013-10-03 14:54:50 -04:00
Behdad Esfahbod d2c96819de Move code around 2013-05-04 16:04:04 -04:00
Behdad Esfahbod 3276c354da [OTLayout] Minor refactoring 2013-05-02 15:39:15 -04:00
Behdad Esfahbod 2265be0a62 Minor 2013-05-02 15:39:15 -04:00
Behdad Esfahbod 893f57b32f Minor renaming 2013-04-21 15:23:21 -04:00
Behdad Esfahbod 8ac3c9c0b6 Rename "pause" to "stage"
The compile() function is starting to become illegible...
2013-04-21 15:19:38 -04:00
Behdad Esfahbod dd0641a432 Minor 2013-04-21 15:13:57 -04:00
Behdad Esfahbod 06a44e8593 Remove unneeded code
We always push a pause at the end such that each lookup falls in exactly
one pause_map_t.  Now, only if I can find a better name for that...
2013-04-21 15:13:08 -04:00
Behdad Esfahbod a8cf7b43fa [Indic] Futher adjust ZWJ handling in Indic-like shapers
After the Ngapi hackfest work, we were assuming that fonts
won't use presentation features to choose specific forms
(eg. conjuncts).  As such, we were using auto-joiner behavior
for such features.  It proved to be troublesome as many fonts
used presentation forms ('pres') for example to form conjuncts,
which need to be disabled when a ZWJ is inserted.

Two examples:

	U+0D2F,U+200D,U+0D4D,U+0D2F with kartika.ttf
	U+0995,U+09CD,U+200D,U+09B7 with vrinda.ttf

What we do now is to never do magic to ZWJ during GSUB's main input
match for Indic-style shapers.  Note that backtrack/lookahead are still
matched liberally, as is GPOS.  This seems to be an acceptable
compromise.

As to the bug that initially started this work, that one needs to
be fixed differently:

  Bug 58714 - Kannada u+0cb0 u+200d u+0ccd u+0c95 u+0cbe does not
  provide same results as Windows8
  https://bugs.freedesktop.org/show_bug.cgi?id=58714

New numbers:

BENGALI: 353689 out of 354188 tests passed. 499 failed (0.140886%)
DEVANAGARI: 707305 out of 707394 tests passed. 89 failed (0.0125814%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60706 out of 60747 tests passed. 41 failed (0.067493%)
KANNADA: 951030 out of 951913 tests passed. 883 failed (0.0927606%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%)
MALAYALAM: 1048102 out of 1048334 tests passed. 232 failed (0.0221304%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271666 out of 271847 tests passed. 181 failed (0.0665816%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
2013-03-19 06:22:06 -04:00
Behdad Esfahbod 398238a252 Fix partial disabling of default-on features
Surprisingly, if user ever tried to turn a default feature off partially
(say, disable liga for a range), the feature was being turned off
globally!  Fixed now.
2013-02-15 07:40:10 -05:00
Behdad Esfahbod cfc507c543 [Indic-like] Disable automatic joiner handling for basic shaping features
Not for Arabic, but for Indic-like scripts.  ZWJ/ZWNJ have special
meanings in those scripts, so let font lookups take full control.

This undoes the regression caused by automatic-joiners handling
introduced two commits ago.

We only disable automatic joiner handling for the "basic shaping
features" of Indic, Myanmar, and SEAsian shapers.  The "presentation
forms" and other features are still applied with automatic-joiner
handling.

This change also changes the test suite failure statistics, such that
a few scripts show more "failures".  The most affected is Kannada.
However, upon inspection, we believe that in most, if not all, of the
new failures, we are producing results superior to Uniscribe.  Hard to
count those!

Here's an example of what is fixed by the recent joiner-handling
changes:

  https://bugs.freedesktop.org/show_bug.cgi?id=58714

New numbers, for future reference:

BENGALI: 353892 out of 354188 tests passed. 296 failed (0.0835714%)
DEVANAGARI: 707336 out of 707394 tests passed. 58 failed (0.00819911%)
GUJARATI: 366262 out of 366457 tests passed. 195 failed (0.0532122%)
GURMUKHI: 60706 out of 60747 tests passed. 41 failed (0.067493%)
KANNADA: 950680 out of 951913 tests passed. 1233 failed (0.129529%)
KHMER: 299074 out of 299124 tests passed. 50 failed (0.0167155%)
LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%)
MALAYALAM: 1047983 out of 1048334 tests passed. 351 failed (0.0334817%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271539 out of 271847 tests passed. 308 failed (0.113299%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
2013-02-14 13:10:54 -05:00
Behdad Esfahbod ec5448667b Add hb_ot_map_feature_flags_t
Code cleanup.  No (intended) functional change.
2013-02-14 12:53:57 -05:00