summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-11-05 21:08:33 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-11-05 21:08:33 +0000
commitad92e98e74e073679faf8a0e1072937945248c84 (patch)
tree06067dc9bb3e92c09f3ef5dc8e4c89e86c341607
parentc26d87f5143087dfea77f1d0522df249286be150 (diff)
parent4db6068b827e100664c931b4d4aff3a5a2d7f996 (diff)
downloadpango-ad92e98e74e073679faf8a0e1072937945248c84.tar.gz
Merge branch 'regular-face' into 'master'
fontconfig: Try harder to return a default face See merge request GNOME/pango!256
-rw-r--r--pango/pangofc-fontmap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 0f211c46..3b7f1915 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -2979,20 +2979,24 @@ pango_fc_family_get_face (PangoFontFamily *family,
{
PangoFcFamily *fcfamily = PANGO_FC_FAMILY (family);
int i;
+ const char *style = name;
ensure_faces (fcfamily);
- if (name == NULL)
- name = "Regular"; /* This name always exists in fontconfig */
+ if (style == NULL)
+ style = "Regular";
for (i = 0; i < fcfamily->n_faces; i++)
{
PangoFontFace *face = PANGO_FONT_FACE (fcfamily->faces[i]);
- if (strcmp (name, pango_font_face_get_face_name (face)) == 0)
+ if (strcmp (style, pango_font_face_get_face_name (face)) == 0)
return face;
}
+ if (name == NULL && fcfamily->n_faces > 0)
+ return PANGO_FONT_FACE (fcfamily->faces[0]);
+
return NULL;
}