summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2019-07-24 15:19:33 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-07-24 15:19:33 +0000
commit91054248b82bb756569dbfd05112ec54c2c1d8ba (patch)
tree2e5ce0fe6e875f9b6015cab6c8770929a9a55941
parent9d284b4ae077552e80acd529559c0108e8d87a71 (diff)
downloadpango-91054248b82bb756569dbfd05112ec54c2c1d8ba.tar.gz
Add system-ui generic family support
-rw-r--r--pango/pangocoretext-fontmap.c12
-rw-r--r--pango/pangofc-fontmap.c12
-rw-r--r--pango/pangowin32-fontmap.c8
3 files changed, 29 insertions, 3 deletions
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index dae0c136..240cb47a 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -136,6 +136,16 @@ get_real_family (const char *family_name)
{
switch (family_name[0])
{
+ case 'c':
+ case 'C':
+ if (g_ascii_strcasecmp (family_name, "cursive") == 0)
+ return "Apple Chancery";
+ break;
+ case 'f':
+ case 'F':
+ if (g_ascii_strcasecmp (family_name, "fantasy") == 0)
+ return "Papyrus";
+ break;
case 'm':
case 'M':
if (g_ascii_strcasecmp (family_name, "monospace") == 0)
@@ -147,6 +157,8 @@ get_real_family (const char *family_name)
return "Helvetica";
else if (g_ascii_strcasecmp (family_name, "serif") == 0)
return "Times";
+ else if (g_ascii_strcasecmp (family_name, "system-ui") == 0)
+ return "San Francisco";
break;
}
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 0659b078..6ac75ef8 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1291,13 +1291,20 @@ is_alias_family (const char *family_name)
{
switch (family_name[0])
{
+ case 'c':
+ case 'C':
+ return (g_ascii_strcasecmp (family_name, "cursive") == 0);
+ case 'f':
+ case 'F':
+ return (g_ascii_strcasecmp (family_name, "fantasy") == 0);
case 'm':
case 'M':
return (g_ascii_strcasecmp (family_name, "monospace") == 0);
case 's':
case 'S':
return (g_ascii_strcasecmp (family_name, "sans") == 0 ||
- g_ascii_strcasecmp (family_name, "serif") == 0);
+ g_ascii_strcasecmp (family_name, "serif") == 0 ||
+ g_ascii_strcasecmp (family_name, "system-ui") == 0);
}
return FALSE;
@@ -1339,7 +1346,7 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap,
FcPatternDestroy (pat);
FcObjectSetDestroy (os);
- priv->families = g_new (PangoFcFamily *, fontset->nfont + 3); /* 3 standard aliases */
+ priv->families = g_new (PangoFcFamily *, fontset->nfont + 4); /* 4 standard aliases */
temp_family_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
count = 0;
@@ -1387,6 +1394,7 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap,
priv->families[count++] = create_family (fcfontmap, "Sans", FC_PROPORTIONAL);
priv->families[count++] = create_family (fcfontmap, "Serif", FC_PROPORTIONAL);
priv->families[count++] = create_family (fcfontmap, "Monospace", FC_MONO);
+ priv->families[count++] = create_family (fcfontmap, "System-ui", FC_PROPORTIONAL);
priv->n_families = count;
}
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 976a36cb..63d70c36 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -462,6 +462,9 @@ static const char * const builtin_aliases[] = {
"mono = \"dejavu sans mono,courier new,lucida console,courier monothai,mingliu,simsun,gulimche,ms gothic,sylfaen,kartika,latha,mangal,raavi\"",
"monospace = \"dejavu sans mono,courier new,lucida console,courier monothai,mingliu,simsun,gulimche,ms gothic,sylfaen,kartika,latha,mangal,raavi\"",
"emoji = \"segoe ui emoji,segoe ui symbol,segoe ui\"",
+ "cursive = \"commic sans ms\"",
+ "fantasy = \"gabriola,impact\"",
+ "system-ui = \"yu gothic ui,segoe ui,meiryo\"",
};
static void
@@ -734,10 +737,13 @@ _pango_win32_font_map_init (PangoWin32FontMap *win32fontmap)
g_hash_table_foreach (win32fontmap->families, synthesize_foreach, win32fontmap);
- /* Create synthetic "Sans", "Serif" and "Monospace" families */
+ /* Create synthetic "Sans", "Serif", "Monospace", "Cursive", "Fantasy" and "System-ui" families */
create_standard_family (win32fontmap, "Sans");
create_standard_family (win32fontmap, "Serif");
create_standard_family (win32fontmap, "Monospace");
+ create_standard_family (win32fontmap, "Cursive");
+ create_standard_family (win32fontmap, "Fantasy");
+ create_standard_family (win32fontmap, "System-ui");
win32fontmap->resolution = (PANGO_SCALE / (double) GetDeviceCaps (_pango_win32_hdc, LOGPIXELSY)) * 72.0;
}