GNOME Bugzilla – Bug 122330
Apply opentype lookups in the right order
Last modified: 2004-12-22 21:47:04 UTC
OpenType lookups need to be ordered: A) First by the order the features are specified in the spec for OpenType fonts for the particular language B) Second by the order that the lookups are listed in the feature. Right now, Pango orders by LookupList order, which works for some fonts, but not all fonts. Attaching a patch that corrects this for GSUB (with the assumption that each lookup gets applied only once.) Needs to obvious extension to GPOS
Created attachment 19941 [details] [review] Fix lookup ordering for GSUB
I think we have to store the feature orders to apply not lookups as done in your patch. I attached a patch to store feature orders.
Created attachment 22766 [details] [review] Features Order Apply
Dear Owen, Pango without correct feature applying order, can not render Arabic textwith the "Nafees Nasta'liq" font, properly. I've attached screen-shot to compare normal Pango with the patched one (The patch I've sent ). The "gedit" on the upper side is using thepatched Pango. Best Regards
Created attachment 23841 [details] comparing patched pango with normal one
Nice shot Soheil.
It would be helpful to have a version of the patch that applies cleanly against the Pango sources (HEAD or Pango-1.4 preferred) and doesn't have extraneous whitespace changes.
I tried to merge them all, but failed. Soheil, it's something only you can do, because your patch is apparently against an internal tree. Should you send a complete patch against some real pango tree, I will update it to HEAD.
Thanx Behdad, I've merged my patch but not with the HEAD. I've merged the patch with the a cvs barnch of yesterday, that Behdad had sent me.
Created attachment 29930 [details] [review] The updated patch ( Feature Order Apply )
Created attachment 29933 [details] The Nafees Nasta'liq font that is fixed for linux by me ;)
Created attachment 29934 [details] You can test with this file and the nafees font
tested new patch with CVS HEAD and applies cleanly.
Created attachment 29935 [details] [review] patch against CVS HEAD By the way, when testing with Nafees font, you may notice that FARSI YEH is being rendered as a missing glyph for ARABIC YEH in medial and initial form. The problem is that Arabic module substitues FARSI YEH with ARABIC YEH in certain conditions, to work around the old bug in Microsoft fonts. Now Nafees does not have ARABIC YEH at all. Attached patch just substitutes with ARABIC YEH only if the font has such a a glyph for that.
Created attachment 29951 [details] [review] Patch as applied Other than some indention, comment, etc, cleanups, the main change in what applied as compared to the last version is that in the sequence: + index = gsub->FeatureList.ApplyOrder[i]; + if( index >= gsub->FeatureList.FeatureCount ) + continue; + feature = gsub->FeatureList.FeatureRecord[index].Feature; + + for ( j = 0; j < feature.LookupListCount; j++ ) + if ( properties[feature.LookupListIndex[j]] ) I removed the tests for index >= gsub->FeatureList.FeatureCount and for properties[feature.LookupIndex[j]]. The first is already checked in TT_GSUB_Add_Feature[], for the second, if someone actually added a feature without setting a property bit it should be harmless to call Do_String_Lookup() for the lookups in the feature. for
Tue Jul 27 12:38:05 2004 Owen Taylor <otaylor@redhat.com> * pango/opentype/ftxopen.[ch] pango/opentype/ftxgsub.c pango/opentype/ftxpos.c: Save the order in which features were added and use that when applying features. (Patch from Soheil Hassas Yeganeh, #122330)
Tue Jul 27 14:07:44 2004 Behdad Esfahbod <pango@behdad.org> * modules/arabic/arabic-fc.c: Don't substitute FARSI YEH with ARABIC YEH if the font does not have any ARABIC YEH.