summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2010-09-16 10:51:56 +0900
committerKenichi Handa <handa@m17n.org>2010-09-16 10:51:56 +0900
commitfa3f60399014127e711f3f438004950cba0bddb9 (patch)
treeb9e8b8d96f44552f47b0ff6c5217d94cec072dc9
parent308e764f26f61572067a959f6cbf94d7bd3f2e4e (diff)
downloademacs-fa3f60399014127e711f3f438004950cba0bddb9.tar.gz
ftfont.c (ftfont_check_otf): Fix the case of checking just existence of GSUB or GPOS.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/ftfont.c67
2 files changed, 50 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4b4f82aa4c8..5a248bacc03 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-14 Kenichi Handa <handa@m17n.org>
+
+ * ftfont.c (ftfont_check_otf): Fix the case of checking just
+ existence of GSUB or GPOS.
+
2010-09-05 Juanma Barranquero <lekktu@gmail.com>
* biditype.h: Regenerate.
diff --git a/src/ftfont.c b/src/ftfont.c
index b99e50ca3ff..9eb7af27657 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1637,32 +1637,55 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec)
OTF_Tag *tags;
int i, n, negative;
+ if (spec->features[0] && spec->features[0][0] ==0
+ && spec->features[1] && spec->features[1][0] ==0)
+ /* Return 1 iff any of GSUB or GPOS support the script (and language). */
+ return (otf
+ && (OTF_check_features (otf, 0, spec->script, spec->langsys,
+ NULL, 0) > 0
+ || OTF_check_features (otf, 1, spec->script, spec->langsys,
+ NULL, 0) > 0));
+
for (i = 0; i < 2; i++)
- {
- if (! spec->features[i])
- continue;
- for (n = 0; spec->features[i][n]; n++);
- tags = alloca (sizeof (OTF_Tag) * n);
- for (n = 0, negative = 0; spec->features[i][n]; n++)
- {
- if (spec->features[i][n] == 0xFFFFFFFF)
- negative = 1;
- else if (negative)
- tags[n - 1] = spec->features[i][n] | 0x80000000;
- else
- tags[n] = spec->features[i][n];
- }
+ if (! spec->features[i] || spec->features[i][0] != 0)
+ {
+ int no_feature = ! otf || OTF_get_features (otf, i == 0) < 0;
+ if (! spec->features[i])
+ {
+ if (no_feature)
+ continue;
+ return 0;
+ }
+ if (spec->features[i][0] == 0xFFFFFFFF)
+ {
+ if (no_feature)
+ continue;
+ }
+ else if (no_feature)
+ 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++)
+ {
+ if (spec->features[i][n] == 0xFFFFFFFF)
+ negative = 1;
+ else if (negative)
+ tags[n - 1] = spec->features[i][n] | 0x80000000;
+ else
+ tags[n] = spec->features[i][n];
+ }
#ifdef M17N_FLT_USE_NEW_FEATURE
- if (OTF_check_features (otf, i == 0, spec->script, spec->langsys,
- tags, n - negative) != 1)
- return 0;
+ if (OTF_check_features (otf, i == 0, spec->script, spec->langsys,
+ tags, n - negative) != 1)
+ return 0;
#else /* not M17N_FLT_USE_NEW_FEATURE */
- if (n - negative > 0
- && OTF_check_features (otf, i == 0, spec->script, spec->langsys,
- tags, n - negative) != 1)
- return 0;
+ if (n - negative > 0
+ && OTF_check_features (otf, i == 0, spec->script, spec->langsys,
+ tags, n - negative) != 1)
+ return 0;
#endif /* not M17N_FLT_USE_NEW_FEATURE */
- }
+ }
return 1;
}