summaryrefslogtreecommitdiff
path: root/pango/pangofc-fontmap.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-10-15 15:59:01 -0400
committerMatthias Clasen <mclasen@redhat.com>2018-11-19 16:20:01 -0500
commitc4be13756a5cb4a0c5d4898f32a023b571bb61fe (patch)
treeedcbd8856fd06db8bb66d85d9c813e6c55245e6f /pango/pangofc-fontmap.c
parentdfd0b55960b518b533b7a10c3ac14b1847e9dcfb (diff)
downloadpango-c4be13756a5cb4a0c5d4898f32a023b571bb61fe.tar.gz
Implement variable family api for fontconfig
This is very straightforward, since fontconfig has a field for this.
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r--pango/pangofc-fontmap.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 8b41018b..9075535c 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -189,6 +189,7 @@ struct _PangoFcFamily
int n_faces; /* -1 == uninitialized */
int spacing; /* FC_SPACING */
+ gboolean variable;
};
struct _PangoFcFindFuncInfo
@@ -1274,6 +1275,7 @@ create_family (PangoFcFontMap *fcfontmap,
family->fontmap = fcfontmap;
family->family_name = g_strdup (family_name);
family->spacing = spacing;
+ family->variable = FALSE;
family->patterns = FcFontSetCreate ();
return family;
@@ -1319,7 +1321,11 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap,
if (priv->n_families < 0)
{
- FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, FC_STYLE, FC_WEIGHT, FC_WIDTH, FC_SLANT, NULL);
+ FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, FC_STYLE, FC_WEIGHT, FC_WIDTH, FC_SLANT,
+#ifdef FC_VARIABLE
+ FC_VARIABLE,
+#endif
+ NULL);
FcPattern *pat = FcPatternCreate ();
GHashTable *temp_family_hash;
@@ -1337,6 +1343,7 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap,
char *s;
FcResult res;
int spacing;
+ int variable;
PangoFcFamily *temp_family;
res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **)(void*)&s);
@@ -1357,6 +1364,13 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap,
if (temp_family)
{
+ variable = FALSE;
+#ifdef FC_VARIABLE
+ res = FcPatternGetBool (fontset->fonts[i], FC_VARIABLE, 0, &variable);
+#endif
+ if (variable)
+ temp_family->variable = TRUE;
+
FcPatternReference (fontset->fonts[i]);
FcFontSetAdd (temp_family->patterns, fontset->fonts[i]);
}
@@ -2620,6 +2634,14 @@ pango_fc_family_is_monospace (PangoFontFamily *family)
fcfamily->spacing == FC_CHARCELL;
}
+static gboolean
+pango_fc_family_is_variable (PangoFontFamily *family)
+{
+ PangoFcFamily *fcfamily = PANGO_FC_FAMILY (family);
+
+ return fcfamily->variable;
+}
+
static void
pango_fc_family_finalize (GObject *object)
{
@@ -2649,6 +2671,7 @@ pango_fc_family_class_init (PangoFcFamilyClass *class)
class->list_faces = pango_fc_family_list_faces;
class->get_name = pango_fc_family_get_name;
class->is_monospace = pango_fc_family_is_monospace;
+ class->is_variable = pango_fc_family_is_variable;
}
static void