Add namedinstance property
This change allows applications to detect if a font is a variable font and a named-instance. If they are, namedinstance property is set to true, otherwise false. Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/362
This commit is contained in:
parent
1751596768
commit
f0612537cb
|
@ -215,6 +215,7 @@ convenience for the application's rendering mechanism.
|
||||||
fonthashint FC_FONT_HAS_HINT Bool Whether font has hinting
|
fonthashint FC_FONT_HAS_HINT Bool Whether font has hinting
|
||||||
order FC_ORDER Int Order number of the font
|
order FC_ORDER Int Order number of the font
|
||||||
desktop FC_DESKTOP_NAME String Current desktop name
|
desktop FC_DESKTOP_NAME String Current desktop name
|
||||||
|
namedinstance FC_NAMED_INSTANCE Bool Whether font is a named-instance
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
|
@ -147,6 +147,7 @@ variable Bool Wheter font is Variable Font
|
||||||
fonthashint Bool Whether the font has hinting
|
fonthashint Bool Whether the font has hinting
|
||||||
order Int Order number of the font
|
order Int Order number of the font
|
||||||
desktop String Current desktop name
|
desktop String Current desktop name
|
||||||
|
namedinstance Bool Whether font is a named-instance
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</refsect2>
|
</refsect2>
|
||||||
<refsect2>
|
<refsect2>
|
||||||
|
|
|
@ -129,6 +129,7 @@ typedef int FcBool;
|
||||||
#define FC_FONT_HAS_HINT "fonthashint" /* Bool - true if font has hinting */
|
#define FC_FONT_HAS_HINT "fonthashint" /* Bool - true if font has hinting */
|
||||||
#define FC_ORDER "order" /* Integer */
|
#define FC_ORDER "order" /* Integer */
|
||||||
#define FC_DESKTOP_NAME "desktop" /* String */
|
#define FC_DESKTOP_NAME "desktop" /* String */
|
||||||
|
#define FC_NAMED_INSTANCE "namedinstance" /* Bool - true if font is namedinstance */
|
||||||
|
|
||||||
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
|
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
|
||||||
#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
|
#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
|
||||||
|
|
|
@ -2175,6 +2175,8 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
|
||||||
goto bail2;
|
goto bail2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!FcPatternObjectAddBool (pat, FC_NAMED_INSTANCE_OBJECT, !!(id > 0xffff)))
|
||||||
|
goto bail2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drop our reference to the charset
|
* Drop our reference to the charset
|
||||||
|
|
|
@ -324,6 +324,7 @@ typedef enum _FcMatcherPriority {
|
||||||
PRI1(FILE),
|
PRI1(FILE),
|
||||||
PRI1(FONTFORMAT),
|
PRI1(FONTFORMAT),
|
||||||
PRI1(VARIABLE),
|
PRI1(VARIABLE),
|
||||||
|
PRI1(NAMED_INSTANCE),
|
||||||
PRI1(SCALABLE),
|
PRI1(SCALABLE),
|
||||||
PRI1(COLOR),
|
PRI1(COLOR),
|
||||||
PRI1(FOUNDRY),
|
PRI1(FOUNDRY),
|
||||||
|
|
|
@ -75,4 +75,5 @@ FC_OBJECT (VARIABLE, FcTypeBool, FcCompareBool)
|
||||||
FC_OBJECT (FONT_HAS_HINT, FcTypeBool, FcCompareBool)
|
FC_OBJECT (FONT_HAS_HINT, FcTypeBool, FcCompareBool)
|
||||||
FC_OBJECT (ORDER, FcTypeInteger, FcCompareNumber)
|
FC_OBJECT (ORDER, FcTypeInteger, FcCompareNumber)
|
||||||
FC_OBJECT (DESKTOP_NAME, FcTypeString, NULL)
|
FC_OBJECT (DESKTOP_NAME, FcTypeString, NULL)
|
||||||
|
FC_OBJECT (NAMED_INSTANCE, FcTypeBool, FcCompareBool)
|
||||||
/* ^-------------- Add new objects here. */
|
/* ^-------------- Add new objects here. */
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
"fonts": [
|
||||||
|
{
|
||||||
|
"family": [
|
||||||
|
"Foo"
|
||||||
|
],
|
||||||
|
"style": [
|
||||||
|
"Regular"
|
||||||
|
],
|
||||||
|
"file": "/path/to/Foo-VF.otf",
|
||||||
|
"index": 1,
|
||||||
|
"namedinstance": false,
|
||||||
|
"fontversion": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"family": [
|
||||||
|
"Foo",
|
||||||
|
"Foo Bold"
|
||||||
|
],
|
||||||
|
"style": [
|
||||||
|
"Bold",
|
||||||
|
"Regular"
|
||||||
|
],
|
||||||
|
"file": "/path/to/Foo-VF.otf",
|
||||||
|
"index": 65537,
|
||||||
|
"namedinstance": true,
|
||||||
|
"fontversion": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"method": "match",
|
||||||
|
"query": {
|
||||||
|
"family": "Foo",
|
||||||
|
"style": "Bold",
|
||||||
|
"namedinstance": false
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"family": "Foo",
|
||||||
|
"style": "Regular",
|
||||||
|
"file": "/path/to/Foo-VF.otf",
|
||||||
|
"index": 1,
|
||||||
|
"namedinstance": false,
|
||||||
|
"fontversion": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "match",
|
||||||
|
"query": {
|
||||||
|
"family": "Foo",
|
||||||
|
"style": "Bold",
|
||||||
|
"namedinstance": true
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"family": "Foo",
|
||||||
|
"style": "Bold",
|
||||||
|
"file": "/path/to/Foo-VF.otf",
|
||||||
|
"index": 65537,
|
||||||
|
"namedinstance": true,
|
||||||
|
"fontversion": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue