]> git.wh0rd.org - fontconfig.git/commitdiff
Add fontversion field
authorKeith Packard <keithp@keithp.com>
Thu, 26 Sep 2002 00:17:28 +0000 (00:17 +0000)
committerKeith Packard <keithp@keithp.com>
Thu, 26 Sep 2002 00:17:28 +0000 (00:17 +0000)
fontconfig/fontconfig.h
src/fcdefault.c
src/fcfreetype.c
src/fcmatch.c
src/fcname.c

index 281356281b80ca5ba750494064626ea51a4a483c..069150ea335fe6312c39d3c43557320e30222e0b 100644 (file)
@@ -82,7 +82,8 @@ typedef int           FcBool;
 #define FC_MINSPACE        "minspace"          /* Bool use minimum line spacing */
 #define FC_SOURCE          "source"            /* String (X11, freetype) */
 #define FC_CHARSET         "charset"           /* CharSet */
-#define FC_LANG                    "lang"              /* String OS/2 CodePageRange */
+#define FC_LANG                    "lang"              /* String RFC 3066 langs */
+#define FC_FONTVERSION     "fontversion"       /* Int from 'head' table */
 
 #define FC_DIR_CACHE_FILE          "fonts.cache-"FC_CACHE_VERSION
 #define FC_USER_CACHE_FILE         ".fonts.cache-"FC_CACHE_VERSION
index 5208746d9bd3234ef9a64dd7e9289fb224055b0f..8445cf031ce6d459ec1b51cbd0fc8c03dcb84968 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/src/fcdefault.c,v 1.2 2002/07/09 22:08:14 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -137,4 +137,8 @@ FcDefaultSubstitute (FcPattern *pattern)
                FcPatternAddString (pattern, FC_LANG, (FcChar8 *) lang);
        }
     }
+    if (FcPatternGet (pattern, FC_FONTVERSION, 0, &v) == FcResultNoMatch)
+    {
+       FcPatternAddInteger (pattern, FC_FONTVERSION, 0x7fffffff);
+    }
 }
index b605918271a115e1331ac1ccc4dcfad7ffee6bb2..5f8dbd2d56a88de48c8cf4693219077fc55e03e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.10 2002/08/22 07:36:44 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.11 2002/08/31 22:17:32 keithp Exp $
  *
  * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -128,6 +128,7 @@ FcFreeTypeQuery (const FcChar8      *file,
     FcChar8        *family;
     FcChar8        *style;
     TT_OS2         *os2;
+    TT_Header      *head;
     const FcChar8   *exclusiveLang = 0;
     FT_SfntName            sname;
     FT_UInt                snamei, snamec;
@@ -472,6 +473,21 @@ FcFreeTypeQuery (const FcChar8     *file,
            goto bail1;
 #endif
 
+    /*
+     * Find the font revision (if available)
+     */
+    head = (TT_Header *) FT_Get_Sfnt_Table (face, ft_sfnt_head);
+    if (head)
+    {
+       if (!FcPatternAddInteger (pat, FC_FONTVERSION, head->Font_Revision))
+           goto bail1;
+    }
+    else
+    {
+       if (!FcPatternAddInteger (pat, FC_FONTVERSION, 0))
+           goto bail1;
+    }
+
     /*
      * Get the OS/2 table and poke about
      */
index 8c76995cc3c8180c81991b41b16d514beadc025c..970d0d873d590a0a5dd4a97095546784bb3fc883 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.19 2002/08/22 07:36:44 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.20 2002/08/31 22:17:32 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -196,9 +196,12 @@ static FcMatcher _FcMatchers [] = {
     
     { FC_OUTLINE,      FcCompareBool,          12, 12 },
 #define MATCH_OUTLINE      11
+
+    { FC_FONTVERSION,  FcCompareInteger,       13, 13 },
+#define MATCH_FONTVERSION   12
 };
 
-#define NUM_MATCH_VALUES    13
+#define NUM_MATCH_VALUES    14
 
 static FcBool
 FcCompareValueList (const char  *object,
@@ -222,7 +225,13 @@ FcCompareValueList (const char  *object,
     case 'f':
        switch (FcToLower (object[1])) {
        case 'o':
-           i = MATCH_FOUNDRY; break;
+           switch (FcToLower (object[2])) {
+           case 'u':
+               i = MATCH_FOUNDRY; break;
+           case 'n':
+               i = MATCH_FONTVERSION; break;
+           }
+           break;
        case 'a':
            i = MATCH_FAMILY; break;
        }
index 4c0eb96d4b6cf12761c84ee727e2122f7c4a426a..0c853da60e59ecb090601f13e11e118e0b3b9990 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.13 2002/08/22 07:36:45 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.14 2002/08/31 22:17:32 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -60,6 +60,7 @@ static const FcObjectType _FcBaseObjectTypes[] = {
     { FC_MATRIX,       FcTypeMatrix },
     { FC_CHARSET,      FcTypeCharSet },
     { FC_LANG,         FcTypeLangSet },
+    { FC_FONTVERSION,  FcTypeInteger },
 };
 
 #define NUM_OBJECT_TYPES    (sizeof _FcBaseObjectTypes / sizeof _FcBaseObjectTypes[0])