Add FC_ORDER property into cache

"fontversion" used to be modified to sort out fonts as a technique.
But that lost the original purpose to do the version control between
releases.

This change adds the dedicated property into the cache.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/226
This commit is contained in:
Akira TAGOH 2020-05-25 18:22:18 +09:00
parent 528b17b283
commit 68d021b634
7 changed files with 10 additions and 0 deletions

View File

@ -212,6 +212,7 @@ convenience for the application's rendering mechanism.
fontvariations FC_FONT_VARIATIONS String comma-separated string of axes in variable font
variable FC_VARIABLE Bool Whether font is Variable Font
fonthashint FC_FONT_HAS_HINT Bool Whether font has hinting
order FC_ORDER Int Order number of the font
</programlisting>
</sect2>
</sect1>

View File

@ -141,6 +141,7 @@ convenience for the applications' rendering mechanism.
prgname String String Name of the running program
postscriptname String Font family name in PostScript
fonthashint Bool Whether the font has hinting
order Int Order number of the font
</programlisting>
</refsect2>
<refsect2>

View File

@ -127,6 +127,7 @@ typedef int FcBool;
#define FC_HASH "hash" /* String (deprecated) */
#define FC_POSTSCRIPT_NAME "postscriptname" /* String */
#define FC_FONT_HAS_HINT "fonthashint" /* Bool - true if font has hinting */
#define FC_ORDER "order" /* Integer */
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION

View File

@ -335,6 +335,9 @@ FcDefaultSubstitute (FcPattern *pattern)
if (prgname)
FcPatternObjectAddString (pattern, FC_PRGNAME_OBJECT, prgname);
}
if (!FcPatternFindObjectIter (pattern, &iter, FC_ORDER_OBJECT))
FcPatternObjectAddInteger (pattern, FC_ORDER_OBJECT, 0);
}
#define __fcdefault__
#include "fcaliastail.h"

View File

@ -1824,6 +1824,8 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
if (!FcPatternObjectAddInteger (pat, FC_FONTVERSION_OBJECT, 0))
goto bail1;
}
if (!FcPatternObjectAddInteger (pat, FC_ORDER_OBJECT, 0))
goto bail1;
if (os2 && os2->version >= 0x0001 && os2->version != 0xffff)
{

View File

@ -347,6 +347,7 @@ typedef enum _FcMatcherPriority {
PRI1(ANTIALIAS),
PRI1(RASTERIZER),
PRI1(OUTLINE),
PRI1(ORDER),
PRI1(FONTVERSION),
PRI_END
} FcMatcherPriority;

View File

@ -73,4 +73,5 @@ FC_OBJECT (SYMBOL, FcTypeBool, FcCompareBool)
FC_OBJECT (FONT_VARIATIONS, FcTypeString, NULL)
FC_OBJECT (VARIABLE, FcTypeBool, FcCompareBool)
FC_OBJECT (FONT_HAS_HINT, FcTypeBool, FcCompareBool)
FC_OBJECT (ORDER, FcTypeInteger, FcCompareNumber)
/* ^-------------- Add new objects here. */