Commit Graph

183 Commits

Author SHA1 Message Date
Behdad Esfahbod 68db8c49d8 [OTLayout] Add start/end to apply_string()
No functional change.
2013-05-02 15:39:16 -04:00
Behdad Esfahbod 1b972d893a [OTLayout] Add is_inplace() method to GSUB 2013-05-02 15:39:16 -04:00
Behdad Esfahbod 07034f447b [API] Add hb_ot_layout_lookup_get_coverage() 2013-05-02 15:39:16 -04:00
Behdad Esfahbod 893991fc9d Initialize set digests
We were not initializing the digests properly and as a result they were
being initialized to zero, making digest1 to never do any useful work.

Speeds up Amiri shaping significantly.
2013-04-16 21:57:35 -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 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 6880f7e19d [OTLayout] Make table type known to apply context 2013-02-13 12:17:25 -05:00
Behdad Esfahbod 568000274c Adjust mark advance-width zeroing logic for Myanmar
Before, we were zeroing advance width of attached marks for
non-Indic scripts, and not doing it for Indic.

We have now three different behaviors, which seem to better
reflect what Uniscribe is doing:

  - For Indic, no explicit zeroing happens whatsoever, which
    is the same as before,

  - For Myanmar, zero advance width of glyphs marked as marks
    *in GDEF*, and do that *before* applying GPOS.  This seems
    to be what the new Win8 Myanmar shaper does,

  - For everything else, zero advance width of glyphs that are
    from General_Category=Mn Unicode characters, and do so
    before applying GPOS.  This seems to be what Uniscribe does
    for Latin at least.

With these changes, positioning of all tests matches for Myanmar,
except for the glitch in Uniscribe not applying 'mark'.  See preivous
commit.
2013-02-12 09:44:57 -05:00
Behdad Esfahbod eb45c0a2fb Minor 2013-01-16 22:07:50 -06:00
Behdad Esfahbod f0c82410db [OTLayout] Always collect default language system in collect_lookups
Not sure if this is the most desired behavior.  It's the most easily
defined though.
2013-01-03 00:07:16 -06:00
Behdad Esfahbod 15e9e4e1dd [OTLayout] Fix feature iteration in collect_lookups
Previous logic was just wrong.
2013-01-03 00:04:40 -06:00
Behdad Esfahbod 733e8c0d7b [OTLayout] Whitespace 2013-01-03 00:00:23 -06:00
Behdad Esfahbod d37ae38047 [OTLayout] Handle required_feature_index in collect_lookups 2013-01-02 23:57:36 -06:00
Behdad Esfahbod efe252e600 [OTLayout] Fix 'size' featureParams implementation
Looks at alternate location now.
2012-12-17 23:25:57 -05:00
Behdad Esfahbod 85bc44b90a [OTLayout] More 'size' feature sanity checking
We still don't look for the old incorrect place of the featureParams.
I'll wait till someone actually complains about it...
2012-12-12 11:38:49 -05:00
Behdad Esfahbod 372fe2b67b [OTLayout] Make hb_ot_layout_get_size_params() do some checks 2012-12-11 14:30:57 -05:00
Behdad Esfahbod 875a5cbc9c [OTLayout] Change hb_ot_layout_get_params() API
And add implementation for StylisticSet UINameID.  No API yet.
2012-12-11 14:17:01 -05:00
Behdad Esfahbod 6748b96d27 Minor 2012-11-30 12:02:21 +02:00
Behdad Esfahbod 3038ae6adb [OTLayout] Minor 2012-11-30 08:24:13 +02:00
Behdad Esfahbod 0dff11f6bf [OTLayout] Look for any 'size' feature, not only in DFLT script
The old code doesn't work with all fonts, as Khaled has reported.
2012-11-30 08:14:20 +02:00
Behdad Esfahbod e9ad71dee8 [OTLayout] Rename hb_ot_layout_position_get_size() to hb_ot_layout_get_size_params() 2012-11-30 08:10:26 +02:00
Behdad Esfahbod f54cce3c6a [OTLayout] Implement 'size' feature 2012-11-26 14:02:31 +02:00
Behdad Esfahbod a88e716021 [OTLayout] Implement hb_ot_layout_collect_lookups()
Untested.
2012-11-24 02:31:02 -05:00
Behdad Esfahbod cdd756b9f4 [OTLayout] Implement GPOS collect_glyphs() 2012-11-24 01:38:41 -05:00
Behdad Esfahbod 9b34677f36 [OTLayout] Clean up closure() a bit 2012-11-23 17:55:40 -05:00
Behdad Esfahbod ec35a72a44 [OTLayout] Port apply() operator to process() template 2012-11-22 16:33:46 -05:00
Behdad Esfahbod 44fc237b53 [OTLayout] Port closure() to process() template 2012-11-22 16:33:46 -05:00
Behdad Esfahbod e8cfdd7fa8 Start implementing collect_glyphs() operation
Not functional yet.
2012-11-16 19:07:06 -08:00
Behdad Esfahbod 89ca8eeb83 Implement hb_ot_layout_get_glyphs_in_class() 2012-11-16 13:53:40 -08:00
Behdad Esfahbod 5a08ecf920 Implement hb_ot_layout_get_glyph_class() 2012-11-16 13:34:29 -08:00
Behdad Esfahbod f30641038b Bunch of independent changes (ouch)
API additions:

	hb_segment_properties_t
	HB_SEGMENT_PROPERTIES_DEFAULT
	hb_segment_properties_equal()
	hb_segment_properties_hash()

	hb_buffer_set_segment_properties()
	hb_buffer_get_segment_properties()

	hb_ot_layout_glyph_class_t

	hb_shape_plan_t
	hb_shape_plan_create()
	hb_shape_plan_create_cached()
	hb_shape_plan_get_empty()
	hb_shape_plan_reference()
	hb_shape_plan_destroy()
	hb_shape_plan_set_user_data()
	hb_shape_plan_get_user_data()
	hb_shape_plan_execute()

	hb_ot_shape_plan_collect_lookups()

API changes:

	Rename hb_ot_layout_feature_get_lookup_indexes() to
	hb_ot_layout_feature_get_lookups().

New header file:

	hb-shape-plan.h

And a bunch of prototyped but not implemented stuff.  Coming soon.
(Tests fail because of the prototypes right now.)
2012-11-15 18:48:10 -08:00
Behdad Esfahbod 362a990b22 Rename hb_ot_layout_would_substitute_lookup() and hb_ot_layout_substitute_closure_lookup()
To match upcoming API.
2012-11-15 14:57:31 -08:00
Behdad Esfahbod 2bd9fe3598 Refactor 2012-09-04 15:15:19 -04:00
Behdad Esfahbod a5ddd9e31c [OT] Really fix possible NULL dereference this time 2012-09-04 14:55:00 -04:00
Behdad Esfahbod 7c8e844d92 Use namespace for OpenType tables
Avoids USHORT, SHORT, ULONG, LONG clashes with Windows API.
2012-08-28 17:57:49 -04:00
Behdad Esfahbod d9b204d3d2 [GSUB] Allow non-zero-context matching in would_apply()
To be used in the next patch.
2012-08-23 16:22:28 -04:00
Behdad Esfahbod 4c8ac4f47e Misc minor fixes 2012-08-08 17:44:19 -04:00
Behdad Esfahbod 472f229a63 [GSUB] Generalize would_apply()
Fixes logic also, where before we were always matching if glyphs_len==1
and a ligature started with the glyph.
2012-08-07 22:25:24 -04:00
Behdad Esfahbod afbcc24be0 [GSUB] Wire the font, not just the face, down to substitute()
We need the font for glyph lookup during GSUB pauses in Indic shaper.
Could perhaps be avoided, but at this point, we don't mean to support
separate substitute()/position() entry points (anymore), so there is
no point in not providing the font to GSUB.
2012-08-02 08:36:40 -04:00
Behdad Esfahbod b0e6a26a10 [OT] Hide some API
It was impossible to meaningfully use them from the outside these days.
2012-08-02 08:11:14 -04:00
Behdad Esfahbod 6f76113755 [GSUB/GPOS] Check array size before accessing digests 2012-08-02 04:00:31 -04:00
Behdad Esfahbod 22148b8c4a Use Coverage digests in would_apply 2012-08-02 03:51:51 -04:00
Behdad Esfahbod 1336ecdf8e [GSUB/GPOS] Use Coverage digests as gatekeeper
Gives me a good 10% speedup for the Devanagari test case.  Less so
for less lookup-intensive tests.

For the Devanagari test case, the false positive rate of the GSUB digest
is 4%.
2012-08-01 21:46:36 -04:00
Behdad Esfahbod 1e7d860613 [GPOS] Adjust mark advance-width zeroing logic
If there is no GPOS, zero mark advances.

If there *is* GPOS and the shaper requests so, zero mark advances for
attached marks.

Fixes regression with Tibetan, where the font has GPOS, and marks a
glyph as mark where it shouldn't get zero advance.
2012-07-31 23:41:06 -04:00
Behdad Esfahbod 3dcbdc2125 Minor 2012-07-30 19:32:42 -04:00
Behdad Esfahbod 05bd1b6342 [GSUB/GPOS] Move glyph props matching around 2012-07-30 19:30:01 -04:00
Behdad Esfahbod fd42257f8c Minor 2012-07-30 18:44:10 -04:00
Behdad Esfahbod f860366456 [OT] Gain back some lost speed 2012-07-30 03:16:38 -04:00
Behdad Esfahbod 11f4c87d01 [OT] Remove hb_ot_layout_ensure()
I didn't like it from the beginning.
2012-07-30 02:36:46 -04:00
Behdad Esfahbod 578e42182b Minor 2012-07-30 02:35:07 -04:00