[pango/pango2: 2/3] coretext: Improve aliases
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 2/3] coretext: Improve aliases
- Date: Sun, 19 Jun 2022 19:55:28 +0000 (UTC)
commit 83b29308ed087999d962b6478471e8795ed0097f
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 19 10:22:37 2022 -0700
coretext: Improve aliases
Add more families to the generic ones, and
add Sans to the list.
pango/pangocoretext-fontmap.c | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index c1251d01..b5bf83db 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -384,28 +384,37 @@ pango_core_text_font_map_populate (PangoFontMap *map)
/* Add generic aliases */
struct {
const char *alias_name;
- const char *family_name;
+ const char *family_name[4];
} aliases[] = {
- { "Monospace", "Courier" },
- { "Sans-serif", "Helvetica" },
- { "Serif", "Times" },
- { "Cursive", "Apple Chancery" },
- { "Fantasy", "Papyrus", },
- { "System-ui", ".AppleSystemUIFont" },
- { "Emoji", "Apple Color Emoji" }
+ { "Monospace", { "Courier", "PT Mono", NULL } },
+ { "Sans-serif", { "Helvetica", "PT Sans", NULL } },
+ { "Sans", { "Helvetica", "PT Sans", NULL } },
+ { "Serif", { "Times", "PT Serif", NULL } },
+ { "Cursive", { "Apple Chancery", NULL } },
+ { "Fantasy", { "Papyrus", NULL } },
+ { "System-ui", { ".AppleSystemUIFont", NULL } },
+ { "Emoji", { "Apple Color Emoji", NULL } }
};
for (int i = 0; i < G_N_ELEMENTS (aliases); i++)
{
- PangoFontFamily *family = pango_font_map_get_family (map, aliases[i].family_name);
+ PangoFontFamily *generic;
- if (family)
+ generic = pango_font_map_get_family (map, aliases[i].alias_name);
+
+ if (!generic)
{
- PangoGenericFamily *alias_family;
+ gneric = pango_generic_family_new (aliases[i].alias_name);
+
+ for (int j = 0; aliases[i].family_name[j]; j++)
+ {
+ PangoFontFamily *family;
- alias_family = pango_generic_family_new (aliases[i].alias_name);
- pango_generic_family_add_family (alias_family, family);
- pango_font_map_add_family (map, PANGO_FONT_FAMILY (alias_family));
+ family = pango_font_map_get_family (map, aliases[i].family_name[j]);
+ if (family)
+ pango_generic_family_add_family (generic, family);
+ }
+ pango_font_map_add_family (map, PANGO_FONT_FAMILY (generic));
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]