Commit Graph

48 Commits

Author SHA1 Message Date
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 41732f1fe3 [Indic] Help compiler put indic_features table in .rodata
The overridden "or" operator was preventing the flag expression from
being const, and putting the table in .data instead or .rodata.
2013-02-27 20:40:54 -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
Behdad Esfahbod e7ffcfafb1 Clean-up add_bool_feature 2013-02-14 11:58:13 -05: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 851784f837 Improve shaper selection 2012-11-14 17:53:09 -08:00
Behdad Esfahbod 5ab3855f81 Choose shaper based on chosen OT script tag
For Arabic and Indic shapers, if the font doesn't have a script system
for the script, use default shaper.

Make an exception for Arabic script since we have fallback logic for
that one.
2012-11-12 18:27:42 -08:00
Behdad Esfahbod 6fddf2d739 Refactoring ot-map building to make chosen script available earlier 2012-11-12 18:03:07 -08:00
Behdad Esfahbod fabd3113a9 [OT] Port Arabic fallback shaping to synthetic GSUB
All of init/medi/fina/isol and rlig implemented.

Let there be dragons... ⻯
2012-09-06 00:51:44 -04:00
Behdad Esfahbod 87b75d0a4a [OT] Allow adding features with fallback implementation 2012-09-04 23:06:38 -04:00
Behdad Esfahbod 8bb5deba96 [OT] Pipe shape_plan down to pause_callbacks 2012-08-02 10:07:58 -04:00
Behdad Esfahbod 3e38c0f288 More massaging 2012-08-02 09:44:18 -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 610e5e8f71 [Indic] Streamline feature would_apply()
Comes with some 10% speedup for Devanagari even!
2012-08-02 05:41:18 -04:00
Behdad Esfahbod f860366456 [OT] Gain back some lost speed 2012-07-30 03:16:38 -04:00
Behdad Esfahbod f055442716 [Indic] Lookup consonant position in the font
Fixes most failures of Oriya, and improves others a bit.
2012-07-19 16:20:21 -04:00
Behdad Esfahbod 1827dc208c Add hb_ot_shape_glyphs_closure()
Experimental API for now.
2012-04-24 16:56:37 -04:00
Behdad Esfahbod 6a9be5bd35 Rename hb_glyph_map_t to hb_set_t 2012-04-23 22:23:17 -04:00
Behdad Esfahbod d2984a241e Add map->substitute_closure() 2012-04-23 17:21:14 -04:00
Behdad Esfahbod c605bbbb6d Remove C++ guards from source files
Where causing issues for people with MSVC.
2011-08-04 20:00:53 -04:00
Behdad Esfahbod 8336186a52 Zero map objects 2011-08-04 19:49:05 -04:00
Behdad Esfahbod f5bc2725cb [Indic] For old-style Indic tables, move Halant around
In old-style Indic OT standards, the post-base Halants are moved after
their base.  Emulate that by moving first post-base Halant to
post-last-consonant.

Brings test-shape-complex failures down from 88 to 54.  Getting there!
2011-07-30 21:08:10 -04:00
Behdad Esfahbod c47a31fb47 [OT] Save chosen script tag 2011-07-30 20:57:01 -04:00
Behdad Esfahbod 359dcaa0d3 Update copyright headers 2011-07-07 21:55:05 -04:00
Behdad Esfahbod d8d0c480c8 Refactor some code common to GSUB and GPOS 2011-07-07 21:22:08 -04:00
Behdad Esfahbod b70c96dbe4 Enable applying GSUB/GPOS features in multiple segments
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=644184
among others.

Shapers now can request segmented feature application by calling
add_gsub_pause() or add_gpos_pause().  They can also provide a
callback to be called at the pause.  Currently the Arabic shaper
uses pauses to enforce certain feature application.  The Indic
shaper can use the same facility to pause and do reordering in the
callback.
2011-07-07 21:12:15 -04:00
Behdad Esfahbod f6d7a9bb4c Shuffle code around 2011-07-07 16:20:35 -04:00
Behdad Esfahbod b9452bfc16 Fix compiler warnings with -pedantic 2011-06-14 14:47:07 -04:00
Behdad Esfahbod 51881a61ca Shrink code size 2011-05-27 18:15:56 -04:00
Behdad Esfahbod 90645fb24b [OT] Separate map_builder from the actual map
Respectively, separate planner from the actual plan.
2011-05-27 18:13:31 -04:00
Behdad Esfahbod 6a7ac79e26 Plug leaks 2011-05-11 14:19:18 -04:00
Behdad Esfahbod 265ac614ea Replace fixed-size lookup_maps array with hb_array_t 2011-05-05 14:38:16 -04:00
Behdad Esfahbod 6843569d2c Replace fixed-size feature_maps array with hb_array_t 2011-05-05 14:30:51 -04:00
Behdad Esfahbod 44b0a4d2fc Replace fixed-size feature_infos array with hb_array_t 2011-05-05 13:42:19 -04:00
Behdad Esfahbod 72657e4ce7 [API] Make hb_font_create() take a face and reference it 2011-05-02 20:47:23 -04:00
Behdad Esfahbod 2409d5f8d7 Update Copyright headers 2011-04-21 17:14:28 -04:00
Behdad Esfahbod 39dede9fff Make sure boolean features always use value=1
Previously boolean features turned on the entire feature mask.  This is
wrong if feature is Alternate and user has provided values bigger than one.
Though, I don't think other engines support such corner cases.
2010-10-13 15:54:06 -04:00
Behdad Esfahbod 852912fc2d Fix applying default-value for features
Previously if a default global feature was overrided by a non-global
user feature, we were not setting any default mask for the feature,
essentially disabling the feature by default.  Fix that.
2010-10-13 15:34:50 -04:00
Behdad Esfahbod 49baa1f69e Add hb_ot_complex_shaper_t stuff and start hooking Arabic shaper up 2010-10-12 16:50:36 -04:00
Behdad Esfahbod 895fb5d364 Refactor, in a different direction 2010-10-12 16:00:21 -04:00
Behdad Esfahbod d2ba016ca1 More refactoring 2010-10-12 15:35:45 -04:00
Behdad Esfahbod aa9c450bb2 Enable 'rtlm' mirroring 2010-10-08 20:27:38 -04:00
Behdad Esfahbod 36925f695d Rename hb_mask_allocator_t to hb_ot_map_t
hb_ot_plan_t may be a better name, donno.
2010-10-08 20:21:09 -04:00
Behdad Esfahbod 5a2b0b3878 Add hb-ot-map.cc 2010-10-08 20:14:57 -04:00
Behdad Esfahbod ecc4550ed7 Fix feature overriding 2010-10-08 20:05:29 -04:00
Behdad Esfahbod 8f08c32750 Minor cleanup 2010-10-08 19:51:03 -04:00
Behdad Esfahbod 4924affe0f Add hb-ot-map-private.hh 2010-10-08 19:18:16 -04:00