From a342e87dc3d4211a29525654ff6b41d088bdce71 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 26 Sep 2002 00:17:28 +0000 Subject: [PATCH] Add fontversion field --- fontconfig/fontconfig.h | 3 ++- src/fcdefault.c | 6 +++++- src/fcfreetype.c | 18 +++++++++++++++++- src/fcmatch.c | 15 ++++++++++++--- src/fcname.c | 3 ++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 2813562..069150e 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -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 diff --git a/src/fcdefault.c b/src/fcdefault.c index 5208746..8445cf0 100644 --- a/src/fcdefault.c +++ b/src/fcdefault.c @@ -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); + } } diff --git a/src/fcfreetype.c b/src/fcfreetype.c index b605918..5f8dbd2 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -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 */ diff --git a/src/fcmatch.c b/src/fcmatch.c index 8c76995..970d0d8 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -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; } diff --git a/src/fcname.c b/src/fcname.c index 4c0eb96..0c853da 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -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]) -- 2.39.2