changeset 110385:a5d5b9bb4ccf

ftfont.c (ftfont_check_otf): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Fri, 17 Sep 2010 14:08:43 +0900
parents 987c8fd5107f (current diff) 8d0ea2f29215 (diff)
children 93e14258e6bc
files
diffstat 2 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Sep 16 20:08:06 2010 -0400
+++ b/src/ChangeLog	Fri Sep 17 14:08:43 2010 +0900
@@ -1,3 +1,7 @@
+2010-09-17  Kenichi Handa  <handa@m17n.org>
+
+	* ftfont.c (ftfont_check_otf): Fix previous change.
+
 2010-09-14  Kenichi Handa  <handa@m17n.org>
 
 	* ftfont.c (ftfont_check_otf): Fix the case of checking just
--- a/src/ftfont.c	Thu Sep 16 20:08:06 2010 -0400
+++ b/src/ftfont.c	Fri Sep 17 14:08:43 2010 +0900
@@ -1632,13 +1632,18 @@
 static int
 ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec)
 {
+#define FEATURE_NONE(IDX) (! spec->features[IDX])
+
+#define FEATURE_ANY(IDX)	\
+  (spec->features[IDX]		\
+   && spec->features[IDX][0] == 0xFFFFFFFF && spec->features[IDX][1] == 0)
+
   struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
   OTF *otf = flt_font_ft->otf;
   OTF_Tag *tags;
   int i, n, negative;
 
-  if (spec->features[0] && spec->features[0][0] ==0
-      && spec->features[1] && spec->features[1][0] ==0)
+  if (FEATURE_ANY (0) && FEATURE_ANY (1))
     /* Return 1 iff any of GSUB or GPOS support the script (and language).  */
     return (otf
 	    && (OTF_check_features (otf, 0, spec->script, spec->langsys,
@@ -1647,23 +1652,25 @@
 				       NULL, 0) > 0));
 
   for (i = 0; i < 2; i++)
-    if (! spec->features[i] || spec->features[i][0] != 0)
+    if (! FEATURE_ANY (i))
       {
-	int no_feature = ! otf || OTF_get_features (otf, i == 0) < 0;
-	if (! spec->features[i])
+	if (FEATURE_NONE (i))
 	  {
-	    if (no_feature)
-	      continue;
-	    return 0;
+	    if (otf
+		&& OTF_check_features (otf, i == 0, spec->script, spec->langsys,
+				       NULL, 0) > 0)
+	      return 0;
+	    continue;
 	  }
 	if (spec->features[i][0] == 0xFFFFFFFF)
 	  {
-	    if (no_feature)
+	    if (! otf
+		|| OTF_check_features (otf, i == 0, spec->script, spec->langsys,
+				       NULL, 0) <= 0)
 	      continue;
 	  }
-	else if (no_feature)
+	else if (! otf)
 	  return 0;
-	/* Now (! no_feature) */
 	for (n = 1; spec->features[i][n]; n++);
 	tags = alloca (sizeof (OTF_Tag) * n);
 	for (n = 0, negative = 0; spec->features[i][n]; n++)
@@ -1687,6 +1694,8 @@
 #endif	/* not M17N_FLT_USE_NEW_FEATURE */
       }
   return 1;
+#undef FEATURE_NONE
+#undef FEATURE_ANY
 }
 
 #define DEVICE_DELTA(table, size)				\