After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 122330 - Apply opentype lookups in the right order
Apply opentype lookups in the right order
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.2.x
Other Linux
: High normal
: 1.4.1
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2003-09-15 11:27 UTC by Owen Taylor
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix lookup ordering for GSUB (4.23 KB, patch)
2003-09-15 11:30 UTC, Owen Taylor
none Details | Review
Features Order Apply (11.01 KB, patch)
2003-12-30 15:26 UTC, Soheil Hassas Yeganeh
none Details | Review
comparing patched pango with normal one (290.74 KB, image/png)
2004-01-28 14:35 UTC, Soheil Hassas Yeganeh
  Details
The updated patch ( Feature Order Apply ) (5.99 KB, patch)
2004-07-27 09:49 UTC, Soheil Hassas Yeganeh
none Details | Review
The Nafees Nasta'liq font that is fixed for linux by me ;) (393.38 KB, application/octet-stream)
2004-07-27 10:01 UTC, Soheil Hassas Yeganeh
  Details
You can test with this file and the nafees font (195 bytes, text/plain)
2004-07-27 10:02 UTC, Soheil Hassas Yeganeh
  Details
patch against CVS HEAD (940 bytes, patch)
2004-07-27 11:18 UTC, Behdad Esfahbod
none Details | Review
Patch as applied (7.39 KB, patch)
2004-07-27 17:29 UTC, Owen Taylor
none Details | Review

Description Owen Taylor 2003-09-15 11:27:34 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
Comment 1 Owen Taylor 2003-09-15 11:30:00 UTC
Created attachment 19941 [details] [review]
Fix lookup ordering for GSUB
Comment 2 Soheil Hassas Yeganeh 2003-12-30 15:24:31 UTC
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.
Comment 3 Soheil Hassas Yeganeh 2003-12-30 15:26:08 UTC
Created attachment 22766 [details] [review]
Features Order Apply
Comment 4 Soheil Hassas Yeganeh 2004-01-28 14:33:00 UTC
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
Comment 5 Soheil Hassas Yeganeh 2004-01-28 14:35:05 UTC
Created attachment 23841 [details]
comparing patched pango with normal one
Comment 6 Behdad Esfahbod 2004-01-29 08:20:21 UTC
Nice shot Soheil.
Comment 7 Owen Taylor 2004-07-26 23:41:03 UTC
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.
Comment 8 Behdad Esfahbod 2004-07-27 03:44:19 UTC
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.
Comment 9 Soheil Hassas Yeganeh 2004-07-27 09:47:35 UTC
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.
Comment 10 Soheil Hassas Yeganeh 2004-07-27 09:49:19 UTC
Created attachment 29930 [details] [review]
The updated patch ( Feature Order Apply )
Comment 11 Soheil Hassas Yeganeh 2004-07-27 10:01:19 UTC
Created attachment 29933 [details]
The Nafees Nasta'liq font that is fixed for linux by me ;)
Comment 12 Soheil Hassas Yeganeh 2004-07-27 10:02:40 UTC
Created attachment 29934 [details]
You can test with this file and the nafees font
Comment 13 Behdad Esfahbod 2004-07-27 11:03:10 UTC
tested new patch with CVS HEAD and applies cleanly.
Comment 14 Behdad Esfahbod 2004-07-27 11:18:56 UTC
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.
Comment 15 Owen Taylor 2004-07-27 17:29:21 UTC
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
Comment 16 Owen Taylor 2004-07-27 18:07:46 UTC
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)

Comment 17 Owen Taylor 2004-07-27 20:25:15 UTC
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.