diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-2 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 6 | ||||
-rw-r--r-- | pango/pangoft2-fontmap.c | 59 | ||||
-rw-r--r-- | pango/pangoxft-fontmap.c | 59 |
8 files changed, 138 insertions, 16 deletions
@@ -1,3 +1,9 @@ +Tue May 14 12:02:13 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c pango/pangoft2-fontmap.c: + Report standard aliases as uppercase, fix + pango_*_face_describe() for aliases. + Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-fontmap.c: Fake sans,serif,monospace diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index a203c86c..6a0f34dd 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,9 @@ +Tue May 14 12:02:13 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c pango/pangoft2-fontmap.c: + Report standard aliases as uppercase, fix + pango_*_face_describe() for aliases. + Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-fontmap.c: Fake sans,serif,monospace diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index a203c86c..6a0f34dd 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,9 @@ +Tue May 14 12:02:13 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c pango/pangoft2-fontmap.c: + Report standard aliases as uppercase, fix + pango_*_face_describe() for aliases. + Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-fontmap.c: Fake sans,serif,monospace diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index a203c86c..6a0f34dd 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,9 @@ +Tue May 14 12:02:13 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c pango/pangoft2-fontmap.c: + Report standard aliases as uppercase, fix + pango_*_face_describe() for aliases. + Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-fontmap.c: Fake sans,serif,monospace diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index a203c86c..6a0f34dd 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,9 @@ +Tue May 14 12:02:13 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c pango/pangoft2-fontmap.c: + Report standard aliases as uppercase, fix + pango_*_face_describe() for aliases. + Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-fontmap.c: Fake sans,serif,monospace diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index a203c86c..6a0f34dd 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,9 @@ +Tue May 14 12:02:13 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c pango/pangoft2-fontmap.c: + Report standard aliases as uppercase, fix + pango_*_face_describe() for aliases. + Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-fontmap.c: Fake sans,serif,monospace diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index 6d8993da..dc356e5f 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -382,6 +382,23 @@ create_family (PangoFT2FontMap *xfontmap, return family; } +static gboolean +is_alias_family (const char *family_name) +{ + switch (family_name[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); + } + + return FALSE; +} + static void pango_ft2_font_map_list_families (PangoFontMap *fontmap, PangoFontFamily ***families, @@ -412,13 +429,15 @@ pango_ft2_font_map_list_families (PangoFontMap *fontmap, res = MiniXftPatternGetString (fontset->fonts[i], XFT_FAMILY, 0, &s); g_assert (res == MiniXftResultMatch); - - if (strcmp (s, "sans") != 0 && - strcmp (s, "serif") != 0 && - strcmp (s, "monospace") != 0) + if (!is_alias_family (s)) ft2fontmap->families[count++] = create_family (ft2fontmap, s); + } + ft2fontmap->families[count++] = create_family (ft2fontmap, "Sans"); + ft2fontmap->families[count++] = create_family (ft2fontmap, "Serif"); + ft2fontmap->families[count++] = create_family (ft2fontmap, "Monospace"); + MiniXftFontSetDestroy (fontset); } @@ -747,6 +766,22 @@ _pango_ft2_font_desc_from_pattern (MiniXftPattern *pattern, static PangoFontDescription * +make_alias_description (PangoFT2Family *ft2family, + gboolean bold, + gboolean italic) +{ + PangoFontDescription *desc = pango_font_description_new (); + + pango_font_description_set_family (desc, ft2family->family_name); + pango_font_description_set_style (desc, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL); + pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL); + pango_font_description_set_weight (desc, bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL); + pango_font_description_set_stretch (desc, PANGO_STRETCH_NORMAL); + + return desc; +} + +static PangoFontDescription * pango_ft2_face_describe (PangoFontFace *face) { PangoFT2Face *ft2face = (PangoFT2Face *) face; @@ -756,6 +791,18 @@ pango_ft2_face_describe (PangoFontFace *face) MiniXftPattern *match_pattern; MiniXftPattern *result_pattern; + if (is_alias_family (ft2family->family_name)) + { + if (strcmp (ft2face->style, "Regular") == 0) + return make_alias_description (ft2family, FALSE, FALSE); + else if (strcmp (ft2face->style, "Bold") == 0) + return make_alias_description (ft2family, TRUE, FALSE); + else if (strcmp (ft2face->style, "Italic") == 0) + return make_alias_description (ft2family, FALSE, TRUE); + else /* Bold Italic */ + return make_alias_description (ft2family, TRUE, TRUE); + } + match_pattern = MiniXftPatternBuild (NULL, XFT_ENCODING, MiniXftTypeString, "iso10646-1", XFT_FAMILY, MiniXftTypeString, ft2family->family_name, @@ -873,9 +920,7 @@ pango_ft2_family_list_faces (PangoFontFamily *family, MiniXftFontSet *fontset; int i; - if (strcmp (ft2family->family_name, "sans") == 0 || - strcmp (ft2family->family_name, "serif") == 0 || - strcmp (ft2family->family_name, "monospace") == 0) + if (is_alias_family (ft2family->family_name)) { ft2family->n_faces = 4; ft2family->faces = g_new (PangoFT2Face *, ft2family->n_faces); diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c index 026c03a3..52e816b6 100644 --- a/pango/pangoxft-fontmap.c +++ b/pango/pangoxft-fontmap.c @@ -458,6 +458,23 @@ create_family (PangoXftFontMap *xfontmap, return family; } +static gboolean +is_alias_family (const char *family_name) +{ + switch (family_name[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); + } + + return FALSE; +} + static void pango_xft_font_map_list_families (PangoFontMap *fontmap, PangoFontFamily ***families, @@ -488,17 +505,15 @@ pango_xft_font_map_list_families (PangoFontMap *fontmap, res = XftPatternGetString (fontset->fonts[i], XFT_FAMILY, 0, &s); g_assert (res == XftResultMatch); - if (strcmp (s, "sans") != 0 && - strcmp (s, "serif") != 0 && - strcmp (s, "monospace") != 0) + if (!is_alias_family (s)) xfontmap->families[count++] = create_family (xfontmap, s); } XftFontSetDestroy (fontset); - xfontmap->families[count++] = create_family (xfontmap, "sans"); - xfontmap->families[count++] = create_family (xfontmap, "serif"); - xfontmap->families[count++] = create_family (xfontmap, "monospace"); + xfontmap->families[count++] = create_family (xfontmap, "Sans"); + xfontmap->families[count++] = create_family (xfontmap, "Serif"); + xfontmap->families[count++] = create_family (xfontmap, "Monospace"); xfontmap->n_families = count; } @@ -883,6 +898,22 @@ _pango_xft_font_desc_from_pattern (XftPattern *pattern, gboolean include_size) } static PangoFontDescription * +make_alias_description (PangoXftFamily *xfamily, + gboolean bold, + gboolean italic) +{ + PangoFontDescription *desc = pango_font_description_new (); + + pango_font_description_set_family (desc, xfamily->family_name); + pango_font_description_set_style (desc, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL); + pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL); + pango_font_description_set_weight (desc, bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL); + pango_font_description_set_stretch (desc, PANGO_STRETCH_NORMAL); + + return desc; +} + +static PangoFontDescription * pango_xft_face_describe (PangoFontFace *face) { PangoXftFace *xface = PANGO_XFT_FACE (face); @@ -893,6 +924,18 @@ pango_xft_face_describe (PangoFontFace *face) XftPattern *match_pattern; XftPattern *result_pattern; + if (is_alias_family (xfamily->family_name)) + { + if (strcmp (xface->style, "Regular") == 0) + return make_alias_description (xfamily, FALSE, FALSE); + else if (strcmp (xface->style, "Bold") == 0) + return make_alias_description (xfamily, TRUE, FALSE); + else if (strcmp (xface->style, "Italic") == 0) + return make_alias_description (xfamily, FALSE, TRUE); + else /* Bold Italic */ + return make_alias_description (xfamily, TRUE, TRUE); + } + match_pattern = XftPatternBuild (NULL, XFT_ENCODING, XftTypeString, "iso10646-1", XFT_FAMILY, XftTypeString, xfamily->family_name, @@ -983,9 +1026,7 @@ pango_xft_family_list_faces (PangoFontFamily *family, XftFontSet *fontset; int i; - if (strcmp (xfamily->family_name, "sans") == 0 || - strcmp (xfamily->family_name, "serif") == 0 || - strcmp (xfamily->family_name, "monospace") == 0) + if (is_alias_family (xfamily->family_name)) { xfamily->n_faces = 4; xfamily->faces = g_new (PangoXftFace *, xfamily->n_faces); |