[gtk+] GtkFontChooserWidget: Use a better display name for the font
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkFontChooserWidget: Use a better display name for the font
- Date: Fri, 15 Aug 2014 18:17:18 +0000 (UTC)
commit dd6c2391d2a1c63a7e0f91a7034043ea248ac991
Author: Behdad Esfahbod <behdad gnome org>
Date: Fri Aug 15 17:27:00 2014 +0000
GtkFontChooserWidget: Use a better display name for the font
Instead of reconstructing a display name from the
PangoFontDescription, use the font family and face
objects, which have the original font. This lets us
get the names of fonts like Noto Sans CJK DemiLight
right, which would be shown as Noto Sans CJK SemiLight
when mangled via PangoFontDescription, since Pango
treats 'DemiLight' as an alias for the SemiLight weight.
https://bugzilla.gnome.org/show_bug.cgi?id=733832
gtk/gtkfontchooserwidget.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index c3fdf3d..1edd2cd 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -770,16 +770,18 @@ gtk_font_chooser_widget_cell_data_func (GtkTreeViewColumn *column,
GtkFontChooserWidget *fontchooser = user_data;
PangoFontDescription *font_desc;
PangoAttrList *attrs;
- char *to_string, *text;
+ char *preview_title, *text;
gsize first_line_len;
font_desc = tree_model_get_font_description (tree_model, iter);
- to_string = pango_font_description_to_string (font_desc);
+ gtk_tree_model_get (tree_model, iter,
+ PREVIEW_TITLE_COLUMN, &preview_title,
+ -1);
+
+ text = g_strconcat (preview_title, "\n", fontchooser->priv->preview_text, NULL);
+ first_line_len = strlen (preview_title) + 1;
- text = g_strconcat (to_string, "\n", fontchooser->priv->preview_text, NULL);
- first_line_len = strlen (to_string) + 1;
-
attrs = gtk_font_chooser_widget_get_preview_attributes (fontchooser,
font_desc,
first_line_len);
@@ -791,7 +793,6 @@ gtk_font_chooser_widget_cell_data_func (GtkTreeViewColumn *column,
pango_font_description_free (font_desc);
pango_attr_list_unref (attrs);
- g_free (to_string);
g_free (text);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]