Add fontversion field

This commit is contained in:
Keith Packard 2002-09-26 00:17:28 +00:00
parent e712133ca7
commit a342e87dc3
5 changed files with 38 additions and 7 deletions

View 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

View 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);
}
}

View 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
*/

View 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':
switch (FcToLower (object[2])) {
case 'u':
i = MATCH_FOUNDRY; break;
case 'n':
i = MATCH_FONTVERSION; break;
}
break;
case 'a':
i = MATCH_FAMILY; break;
}

View 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])