summaryrefslogtreecommitdiff
path: root/pango/pangowin32-fontmap.c
diff options
context:
space:
mode:
authorEvgenii Gurianov <whats.eternal@gmail.com>2020-08-04 21:58:52 +0300
committerEvgenii Gurianov <whats.eternal@gmail.com>2020-08-04 21:58:52 +0300
commit81904ad171bc58feefa1718f7f8895cc24021b1e (patch)
treece011ab6e99ea9be4eb78dd30b2fdae94b818f71 /pango/pangowin32-fontmap.c
parentdaa9d0ab21a9c6e9cbadc8e6776a3b3461246763 (diff)
downloadpango-81904ad171bc58feefa1718f7f8895cc24021b1e.tar.gz
Fixes pango_win32_font_map_load_font when font contains fallback families
Diffstat (limited to 'pango/pangowin32-fontmap.c')
-rw-r--r--pango/pangowin32-fontmap.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index b43685c7..8d7e0c06 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -1016,44 +1016,49 @@ pango_win32_font_map_load_font (PangoFontMap *fontmap,
const PangoFontDescription *description)
{
PangoWin32FontMap *win32fontmap = (PangoWin32FontMap *)fontmap;
- PangoWin32Family *win32family;
+ PangoWin32Face *best_match = NULL;
PangoFont *result = NULL;
GSList *tmp_list;
const char *family;
+ char **families;
+ int i;
g_return_val_if_fail (description != NULL, NULL);
family = pango_font_description_get_family (description);
- family = family ? family : "";
- PING (("name=%s", family));
+ families = g_strsplit (family ? family : "", ",", -1);
- win32family = g_hash_table_lookup (win32fontmap->families, family);
- if (win32family)
+ for (i = 0; families[i] && !best_match; ++i)
{
- PangoWin32Face *best_match = NULL;
-
- PING (("got win32family"));
- tmp_list = win32family->faces;
- while (tmp_list)
+ PING (("name=%s", families[i]));
+ PangoWin32Family *win32family = g_hash_table_lookup (win32fontmap->families, families[i]);
+ if (win32family)
{
- PangoWin32Face *face = tmp_list->data;
+ PING (("got win32family"));
+ tmp_list = win32family->faces;
+ while (tmp_list)
+ {
+ PangoWin32Face *face = tmp_list->data;
- if (pango_font_description_better_match (description,
- best_match ? best_match->description : NULL,
- face->description))
- best_match = face;
+ if (pango_font_description_better_match (description,
+ best_match ? best_match->description : NULL,
+ face->description))
+ best_match = face;
- tmp_list = tmp_list->next;
+ tmp_list = tmp_list->next;
+ }
}
+ }
+
+ g_strfreev (families);
- if (best_match)
- result = PANGO_WIN32_FONT_MAP_GET_CLASS (win32fontmap)->find_font (win32fontmap, context,
- best_match,
- description);
+ if (best_match)
+ result = PANGO_WIN32_FONT_MAP_GET_CLASS (win32fontmap)->find_font (win32fontmap, context,
+ best_match,
+ description);
/* TODO: Handle the case that result == NULL. */
- else
- PING (("no best match!"));
- }
+ else
+ PING (("no best match!"));
return result;
}