]> git.wh0rd.org - fontconfig.git/commitdiff
Include space and remove numbers from valid script tags. This ensures that
authorKeith Packard <keithp@keithp.com>
Sat, 5 Mar 2005 23:50:55 +0000 (23:50 +0000)
committerKeith Packard <keithp@keithp.com>
Sat, 5 Mar 2005 23:50:55 +0000 (23:50 +0000)
    tags like 'lao ' work while rejecting those which have any digits.
    Eliminate a spurious debugging variable (len)

ChangeLog
src/fcfreetype.c

index 12182a32a162a7179de33bf949946840e60a1903..7faa1e0a256b14174d7782f2bbee8eee0cb2afad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-03-05  Keith Packard  <keithp@keithp.com>
+
+       * src/fcfreetype.c: (addtag), (FcFontCapabilities):
+       Include space and remove numbers from valid script tags.
+       This ensures that tags like 'lao ' work while rejecting
+       those which have any digits.
+       Eliminate a spurious debugging variable (len)
+
 2005-03-05  Keith Packard  <keithp@keithp.com>
 
        * src/fcfreetype.c: (addtag), (GetScriptTags),
index 7f6ca3769bf0ab2d29595171465717a6bbf1db36..4ca1ba01b365ad0bc10aa85a2ef2ec1c46a13447 100644 (file)
@@ -2649,8 +2649,13 @@ FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks)
 /* space + head + id */
 #define OTLAYOUT_LEN       (1 + OTLAYOUT_HEAD_LEN + OTLAYOUT_ID_LEN)
 
-#define FcIsNumber(x)      (060 <= (x) && (x) <= 071)
-#define FcIsAlNum(x)       (FcIsLower(x) || FcIsUpper (x) || FcIsNumber (x))
+/*
+ * This is a bit generous; the registry has only lower case and space
+ * except for 'DFLT'.
+ */
+#define FcIsSpace(x)       (040 == (x))
+#define FcIsValidScript(x)  (FcIsLower(x) || FcIsUpper (x) || FcIsSpace(x))
+                            
 static void
 addtag(FcChar8 *complex, FT_ULong tag)
 {
@@ -2662,13 +2667,13 @@ addtag(FcChar8 *complex, FT_ULong tag)
     tagstring[3] = (FcChar8)(tag);
     tagstring[4] = '\0';
     
-    /* skip tags which aren't alphanumeric, under the assumption that
+    /* skip tags which aren't alphabetic, under the assumption that
      * they're probably broken
      */
-    if (!FcIsAlNum(tagstring[0]) ||
-       !FcIsAlNum(tagstring[1]) ||
-       !FcIsAlNum(tagstring[2]) ||
-       !FcIsAlNum(tagstring[3]))
+    if (!FcIsValidScript(tagstring[0]) ||
+       !FcIsValidScript(tagstring[1]) ||
+       !FcIsValidScript(tagstring[2]) ||
+       !FcIsValidScript(tagstring[3]))
        return;
 
     if (*complex != '\0')
@@ -2806,7 +2811,6 @@ FcFontCapabilities(FT_Face face)
         strcpy(complex, "ttable:Silf ");
 
     while ((indx1 < gsub_count) || (indx2 < gpos_count)) {
-       int len = strlen (complex);
        if (indx1 == gsub_count) {
            addtag(complex, gpostags[indx2]);
            indx2++;