[gnumeric] GUI: Ignore non-scalable fonts.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Ignore non-scalable fonts.
- Date: Fri, 15 Mar 2013 01:54:49 +0000 (UTC)
commit 625e6fefa02e318ee7e03e8a8988b3dcb4e52807
Author: Morten Welinder <terra gnome org>
Date: Thu Mar 14 21:53:58 2013 -0400
GUI: Ignore non-scalable fonts.
ChangeLog | 5 +++++
src/wbc-gtk.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3bd65e8..d5a8913 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-14 Morten Welinder <terra gnome org>
+
+ * src/wbc-gtk.c (gnm_font_action_create_tool_item): Add filter to
+ ignore non-scalable fonts.
+
2013-03-11 Morten Welinder <terra gnome org>
* src/wbc-gtk.c (wbc_gtk_init_font_name): New implementation.
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 5c4244c..d9c45f3 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -3409,6 +3409,32 @@ cb_font_button_screen_changed (GtkWidget *widget)
#endif
}
+/* Filter to ignore non-scalable fonts. */
+static gboolean
+cb_font_filter (G_GNUC_UNUSED const PangoFontFamily *family,
+ const PangoFontFace *face_,
+ gpointer user)
+{
+ PangoFontFace *face = (PangoFontFace*)face_;
+ int n_sizes;
+ int *sizes = NULL;
+ static int debug = -1;
+
+ pango_font_face_list_sizes (face, &sizes, &n_sizes);
+ g_free (sizes);
+
+ if (debug == -1)
+ debug = gnm_debug_flag ("fonts");
+
+ if (n_sizes > 0 && debug) {
+ g_printerr ("Ignoring face %s\n",
+ pango_font_description_to_string
+ (pango_font_face_describe (face)));
+ }
+
+ return n_sizes == 0;
+}
+
static GtkWidget *
gnm_font_action_create_tool_item (GtkAction *action)
{
@@ -3418,6 +3444,10 @@ gnm_font_action_create_tool_item (GtkAction *action)
"dialog-type", GO_TYPE_FONT_SEL_DIALOG,
// "dialog-type", GTK_TYPE_FONT_CHOOSER_DIALOG,
NULL);
+ gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (but),
+ cb_font_filter,
+ NULL,
+ NULL);
gtk_widget_show_all (but);
gtk_button_set_relief
(GTK_BUTTON (but),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]