diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-1-2 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 9 | ||||
-rw-r--r-- | pango/pangoft2-fontmap.c | 94 | ||||
-rw-r--r-- | pango/pangoxft-fontmap.c | 102 |
8 files changed, 193 insertions, 57 deletions
@@ -1,3 +1,12 @@ +Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c: Fake sans,serif,monospace + in the list of fonts. + + * pango/pangoft2-fontmap.c: Fake aliases here as well. + + (#78714, Xavier Cho.) + Mon May 13 14:58:12 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox.c configure.in: Add a implementation diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 60f4c5b4..a203c86c 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,12 @@ +Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c: Fake sans,serif,monospace + in the list of fonts. + + * pango/pangoft2-fontmap.c: Fake aliases here as well. + + (#78714, Xavier Cho.) + Mon May 13 14:58:12 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox.c configure.in: Add a implementation diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index 60f4c5b4..a203c86c 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,12 @@ +Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c: Fake sans,serif,monospace + in the list of fonts. + + * pango/pangoft2-fontmap.c: Fake aliases here as well. + + (#78714, Xavier Cho.) + Mon May 13 14:58:12 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox.c configure.in: Add a implementation diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 60f4c5b4..a203c86c 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,12 @@ +Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c: Fake sans,serif,monospace + in the list of fonts. + + * pango/pangoft2-fontmap.c: Fake aliases here as well. + + (#78714, Xavier Cho.) + Mon May 13 14:58:12 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox.c configure.in: Add a implementation diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 60f4c5b4..a203c86c 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,12 @@ +Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c: Fake sans,serif,monospace + in the list of fonts. + + * pango/pangoft2-fontmap.c: Fake aliases here as well. + + (#78714, Xavier Cho.) + Mon May 13 14:58:12 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox.c configure.in: Add a implementation diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 60f4c5b4..a203c86c 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,12 @@ +Mon May 13 15:56:29 2002 Owen Taylor <otaylor@redhat.com> + + * pango/pangoxft-fontmap.c: Fake sans,serif,monospace + in the list of fonts. + + * pango/pangoft2-fontmap.c: Fake aliases here as well. + + (#78714, Xavier Cho.) + Mon May 13 14:58:12 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox.c configure.in: Add a implementation diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index da1a7b0d..6d8993da 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -370,6 +370,18 @@ _pango_ft2_font_map_remove (PangoFontMap *fontmap, ft2font->font_pattern); } +static PangoFT2Family * +create_family (PangoFT2FontMap *xfontmap, + const char *family_name) +{ + PangoFT2Family *family = g_object_new (PANGO_FT2_TYPE_FAMILY, NULL); + family->fontmap = xfontmap; + family->family_name = g_strdup (family_name); + family->n_faces = -1; + + return family; +} + static void pango_ft2_font_map_list_families (PangoFontMap *fontmap, PangoFontFamily ***families, @@ -378,6 +390,7 @@ pango_ft2_font_map_list_families (PangoFontMap *fontmap, PangoFT2FontMap *ft2fontmap = (PangoFT2FontMap *)fontmap; MiniXftFontSet *fontset; int i; + int count; if (ft2fontmap->n_families < 0) { @@ -388,9 +401,9 @@ pango_ft2_font_map_list_families (PangoFontMap *fontmap, XFT_FAMILY, NULL); - ft2fontmap->n_families = fontset->nfont; - ft2fontmap->families = g_new (PangoFT2Family *, ft2fontmap->n_families); + ft2fontmap->families = g_new (PangoFT2Family *, fontset->nfont + 3); /* 3 standard aliases */ + count = 0; for (i = 0; i < fontset->nfont; i++) { char *s; @@ -399,10 +412,11 @@ pango_ft2_font_map_list_families (PangoFontMap *fontmap, res = MiniXftPatternGetString (fontset->fonts[i], XFT_FAMILY, 0, &s); g_assert (res == MiniXftResultMatch); - ft2fontmap->families[i] = g_object_new (PANGO_FT2_TYPE_FAMILY, NULL); - ft2fontmap->families[i]->family_name = g_strdup (s); - ft2fontmap->families[i]->fontmap = ft2fontmap; - ft2fontmap->families[i]->n_faces = -1; + + if (strcmp (s, "sans") != 0 && + strcmp (s, "serif") != 0 && + strcmp (s, "monospace") != 0) + ft2fontmap->families[count++] = create_family (ft2fontmap, s); } MiniXftFontSetDestroy (fontset); @@ -834,9 +848,19 @@ _pango_ft2_font_map_get_library (PangoFontMap *fontmap) } /* - * PangoXFontFamily + * PangoFT2FontFamily */ +static PangoFT2Face * +create_face (PangoFT2Family *ft2family, + const char *style) +{ + PangoFT2Face *face = g_object_new (PANGO_FT2_TYPE_FACE, NULL); + face->style = g_strdup (style); + face->family = ft2family; + return face; +} + static void pango_ft2_family_list_faces (PangoFontFamily *family, PangoFontFace ***faces, @@ -848,32 +872,46 @@ pango_ft2_family_list_faces (PangoFontFamily *family, { MiniXftFontSet *fontset; int i; - - fontset = MiniXftListFonts ((Display *)1, 0, - XFT_ENCODING, MiniXftTypeString, "iso10646-1", - XFT_FAMILY, MiniXftTypeString, ft2family->family_name, - XFT_CORE, MiniXftTypeBool, False, - NULL, - XFT_STYLE, - NULL); - - ft2family->n_faces = fontset->nfont; - ft2family->faces = g_new (PangoFT2Face *, ft2family->n_faces); - for (i = 0; i < fontset->nfont; i++) + if (strcmp (ft2family->family_name, "sans") == 0 || + strcmp (ft2family->family_name, "serif") == 0 || + strcmp (ft2family->family_name, "monospace") == 0) + { + ft2family->n_faces = 4; + ft2family->faces = g_new (PangoFT2Face *, ft2family->n_faces); + + i = 0; + ft2family->faces[i++] = create_face (ft2family, "Regular"); + ft2family->faces[i++] = create_face (ft2family, "Bold"); + ft2family->faces[i++] = create_face (ft2family, "Italic"); + ft2family->faces[i++] = create_face (ft2family, "Bold Italic"); + } + else { - char *s; - MiniXftResult res; + fontset = MiniXftListFonts ((Display *)1, 0, + XFT_ENCODING, MiniXftTypeString, "iso10646-1", + XFT_FAMILY, MiniXftTypeString, ft2family->family_name, + XFT_CORE, MiniXftTypeBool, False, + NULL, + XFT_STYLE, + NULL); - res = MiniXftPatternGetString (fontset->fonts[i], XFT_STYLE, 0, &s); - g_assert (res == MiniXftResultMatch); + ft2family->n_faces = fontset->nfont; + ft2family->faces = g_new (PangoFT2Face *, ft2family->n_faces); + + for (i = 0; i < fontset->nfont; i++) + { + char *s; + MiniXftResult res; + + res = MiniXftPatternGetString (fontset->fonts[i], XFT_STYLE, 0, &s); + g_assert (res == MiniXftResultMatch); + + ft2family->faces[i] = create_face (ft2family, s); + } - ft2family->faces[i] = g_object_new (PANGO_FT2_TYPE_FACE, NULL); - ft2family->faces[i]->style = g_strdup (s); - ft2family->faces[i]->family = ft2family; + MiniXftFontSetDestroy (fontset); } - - MiniXftFontSetDestroy (fontset); } if (n_faces) diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c index 96c7fb7d..026c03a3 100644 --- a/pango/pangoxft-fontmap.c +++ b/pango/pangoxft-fontmap.c @@ -447,6 +447,17 @@ _pango_xft_font_map_remove (PangoFontMap *fontmap, xfont->font_pattern); } +static PangoXftFamily * +create_family (PangoXftFontMap *xfontmap, + const char *family_name) +{ + PangoXftFamily *family = g_object_new (PANGO_XFT_TYPE_FAMILY, NULL); + family->fontmap = xfontmap; + family->family_name = g_strdup (family_name); + + return family; +} + static void pango_xft_font_map_list_families (PangoFontMap *fontmap, PangoFontFamily ***families, @@ -455,6 +466,7 @@ pango_xft_font_map_list_families (PangoFontMap *fontmap, PangoXftFontMap *xfontmap = PANGO_XFT_FONT_MAP (fontmap); XftFontSet *fontset; int i; + int count; if (xfontmap->n_families < 0) { @@ -465,9 +477,9 @@ pango_xft_font_map_list_families (PangoFontMap *fontmap, XFT_FAMILY, NULL); - xfontmap->n_families = fontset->nfont; - xfontmap->families = g_new (PangoXftFamily *, xfontmap->n_families); + xfontmap->families = g_new (PangoXftFamily *, fontset->nfont + 3); /* 3 standard aliases */ + count = 0; for (i = 0; i < fontset->nfont; i++) { char *s; @@ -475,15 +487,22 @@ pango_xft_font_map_list_families (PangoFontMap *fontmap, res = XftPatternGetString (fontset->fonts[i], XFT_FAMILY, 0, &s); g_assert (res == XftResultMatch); - - xfontmap->families[i] = g_object_new (PANGO_XFT_TYPE_FAMILY, NULL); - xfontmap->families[i]->family_name = g_strdup (s); - xfontmap->families[i]->fontmap = xfontmap; + + if (strcmp (s, "sans") != 0 && + strcmp (s, "serif") != 0 && + strcmp (s, "monospace") != 0) + 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->n_families = count; } - + if (n_families) *n_families = xfontmap->n_families; @@ -940,6 +959,17 @@ pango_xft_face_get_type (void) /* * PangoXFontFamily */ +static PangoXftFace * +create_face (PangoXftFamily *xfamily, + const char *style) +{ + PangoXftFace *face = g_object_new (PANGO_XFT_TYPE_FACE, NULL); + face->style = g_strdup (style); + face->family = xfamily; + + return face; +} + static void pango_xft_family_list_faces (PangoFontFamily *family, PangoFontFace ***faces, @@ -952,33 +982,47 @@ pango_xft_family_list_faces (PangoFontFamily *family, { XftFontSet *fontset; int i; - - fontset = XftListFonts (xfontmap->display, xfontmap->screen, - XFT_ENCODING, XftTypeString, "iso10646-1", - XFT_FAMILY, XftTypeString, xfamily->family_name, - XFT_CORE, XftTypeBool, False, - NULL, - XFT_STYLE, - NULL); - - xfamily->n_faces = fontset->nfont; - xfamily->faces = g_new (PangoXftFace *, xfamily->n_faces); - for (i = 0; i < fontset->nfont; i++) + if (strcmp (xfamily->family_name, "sans") == 0 || + strcmp (xfamily->family_name, "serif") == 0 || + strcmp (xfamily->family_name, "monospace") == 0) { - char *s; - XftResult res; + xfamily->n_faces = 4; + xfamily->faces = g_new (PangoXftFace *, xfamily->n_faces); + + i = 0; + xfamily->faces[i++] = create_face (xfamily, "Regular"); + xfamily->faces[i++] = create_face (xfamily, "Bold"); + xfamily->faces[i++] = create_face (xfamily, "Italic"); + xfamily->faces[i++] = create_face (xfamily, "Bold Italic"); + } + else + { + fontset = XftListFonts (xfontmap->display, xfontmap->screen, + XFT_ENCODING, XftTypeString, "iso10646-1", + XFT_FAMILY, XftTypeString, xfamily->family_name, + XFT_CORE, XftTypeBool, False, + NULL, + XFT_STYLE, + NULL); - res = XftPatternGetString (fontset->fonts[i], XFT_STYLE, 0, &s); - if (res != XftResultMatch) - s = "Regular"; + xfamily->n_faces = fontset->nfont; + xfamily->faces = g_new (PangoXftFace *, xfamily->n_faces); - xfamily->faces[i] = g_object_new (PANGO_XFT_TYPE_FACE, NULL); - xfamily->faces[i]->style = g_strdup (s); - xfamily->faces[i]->family = xfamily; + for (i = 0; i < fontset->nfont; i++) + { + char *s; + XftResult res; + + res = XftPatternGetString (fontset->fonts[i], XFT_STYLE, 0, &s); + if (res != XftResultMatch) + s = "Regular"; + + xfamily->faces[i] = create_face (xfamily, s); + } + + XftFontSetDestroy (fontset); } - - XftFontSetDestroy (fontset); } if (n_faces) |