[gnumeric] ItemBar: add fallback for font handling.



commit 071c225090ff6f71a63b8d01f3f00de34722e549
Author: Morten Welinder <terra gnome org>
Date:   Sun Dec 21 10:51:13 2014 -0500

    ItemBar: add fallback for font handling.

 ChangeLog      |    5 +++++
 src/item-bar.c |   11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 026fa0f..1f6a3f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-21  Morten Welinder  <terra gnome org>
+
+       * src/item-bar.c (ib_reload_sizing_style): Add fallback for font
+       handling.
+
 2014-12-20  Morten Welinder  <terra gnome org>
 
        * src/sheet.c (sheet_insdel_colrow): Fix handling of too-big
diff --git a/src/item-bar.c b/src/item-bar.c
index 1354235..7bbc60a 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -152,6 +152,15 @@ ib_reload_sizing_style (GnmItemBar *ib)
                gtk_style_context_get (context, state, "font", &desc, NULL);
                pango_font_description_set_size (desc,
                                                 zoom_factor * pango_font_description_get_size (desc));
+               ib->selection_fonts[ui] =
+                       pango_context_load_font (pcontext, desc);
+               if (!ib->selection_fonts[ui]) {
+                       /* Fallback. */
+                       pango_font_description_set_family (desc, "Sans");
+                       ib->selection_fonts[ui] =
+                               pango_context_load_font (pcontext, desc);
+               }
+
                /*
                 * Figure out how tall the label can be.
                 * (Note that we avoid J/Q/Y which may go below the line.)
@@ -159,8 +168,6 @@ ib_reload_sizing_style (GnmItemBar *ib)
                pango_layout_set_text (layout,
                                       char_label ? "AHW" : "0123456789",
                                       -1);
-               ib->selection_fonts[ui] =
-                       pango_context_load_font (pcontext, desc);
                pango_layout_set_font_description (layout, desc);
                pango_font_description_free (desc);
                pango_layout_get_extents (layout, &ink_rect, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]