Pango Feature Apply Order



Dear All,

As OpenType specification says any script has a specific order of
features to apply (e.g. in Arabic, lookups of "ccmp" feature has to be
applied first and lookups of "dlig" feature has to be applied if user
asked for). But, current version of Pango applies lookups by order they
came in the font, instead of applying lookups by the order of the
features.

In order to fix this problem, I've modified TT_(GSUB|GPOS)_Apply_String
functions of pango/opentype/ftxg(sub|pos).c.

The patches are attached.
--
Best Regard,
	Soheil Hassas Yeganeh

--- cvs-gnome/pango/pango/opentype/ftxgsub.c	2003-11-01 18:32:17.000000000 +0330
+++ cvs/pango/pango/opentype/ftxgsub.c	2003-12-28 16:29:13.000000000 +0330
@@ -4453,8 +4453,11 @@
   {
     FT_Error          error, retError = TTO_Err_Not_Covered;
     FT_Memory         memory = in->memory;
-    FT_UShort         j;
+    FT_UShort         i,
+		      j, 
+		      index;
 
+    TTO_Feature feature;
     TTO_GSUB_String   tmp1;
     TTO_GSUB_String*  ptmp1;
     TTO_GSUB_String   tmp2;
@@ -4514,10 +4517,18 @@
     MEM_Copy( tmp1.logClusters, in->logClusters,
 	      in->length * sizeof( FT_Int ) );
 
-    for ( j = 0; j < gsub->LookupList.LookupCount; j++ )
+
+    for ( i = 0; i < gsub->FeatureList.FeatureCount; i++)
+    {
+      feature = gsub->FeatureList.FeatureRecord[i].Feature;
+
+      if(feature.LookupListIndex == NULL)
+	continue;
+
+      for ( j = 0; j < feature.LookupListCount; j++ )
       if ( properties[j] )
       {
-        error = Do_String_Lookup( gsub, j, ptmp1, ptmp2 );
+          error = Do_String_Lookup( gsub, feature.LookupListIndex[j], ptmp1, ptmp2 );
         if ( error )
 	{
 	  if ( error != TTO_Err_Not_Covered )
@@ -4538,6 +4548,7 @@
         ptmp2 = ptmp1;
         ptmp1 = t;
       }
+    }
 
   End:
     FREE( ptmp2->string );
--- cvs-gnome/pango/pango/opentype/ftxgsub.c	2003-11-01 18:32:17.000000000 +0330
+++ cvs/pango/pango/opentype/ftxgsub.c	2003-12-28 16:29:13.000000000 +0330
@@ -4453,8 +4453,11 @@
   {
     FT_Error          error, retError = TTO_Err_Not_Covered;
     FT_Memory         memory = in->memory;
-    FT_UShort         j;
+    FT_UShort         i,
+		      j, 
+		      index;
 
+    TTO_Feature feature;
     TTO_GSUB_String   tmp1;
     TTO_GSUB_String*  ptmp1;
     TTO_GSUB_String   tmp2;
@@ -4514,10 +4517,18 @@
     MEM_Copy( tmp1.logClusters, in->logClusters,
 	      in->length * sizeof( FT_Int ) );
 
-    for ( j = 0; j < gsub->LookupList.LookupCount; j++ )
+
+    for ( i = 0; i < gsub->FeatureList.FeatureCount; i++)
+    {
+      feature = gsub->FeatureList.FeatureRecord[i].Feature;
+
+      if(feature.LookupListIndex == NULL)
+	continue;
+
+      for ( j = 0; j < feature.LookupListCount; j++ )
       if ( properties[j] )
       {
-        error = Do_String_Lookup( gsub, j, ptmp1, ptmp2 );
+          error = Do_String_Lookup( gsub, feature.LookupListIndex[j], ptmp1, ptmp2 );
         if ( error )
 	{
 	  if ( error != TTO_Err_Not_Covered )
@@ -4538,6 +4548,7 @@
         ptmp2 = ptmp1;
         ptmp1 = t;
       }
+    }
 
   End:
     FREE( ptmp2->string );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]