[gnumeric] SheetObjects: get font from GSetting under ssconvert.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] SheetObjects: get font from GSetting under ssconvert.
- Date: Sat, 30 Jan 2016 17:56:25 +0000 (UTC)
commit d9ced8fc9fa74df1e65f6d980683cf8a15e3f13a
Author: Morten Welinder <terra gnome org>
Date: Sat Jan 30 12:55:51 2016 -0500
SheetObjects: get font from GSetting under ssconvert.
*Another* GTK+ ABI change.
ChangeLog | 3 +++
NEWS | 1 +
src/sheet-object-widget.c | 30 +++++++++++++++++-------------
3 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f6b2ccc..77b8f19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-01-30 Morten Welinder <terra gnome org>
+ * src/sheet-object-widget.c (get_font): Under ssconvert, don't try
+ GtkStyleContext. Another ABI changes causes that to crash.
+
* src/value.c (find_column_of_field): Insist that the database be
a cell range, not an array.
diff --git a/NEWS b/NEWS
index b484c3e..cc13cde 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ Morten:
* Improve BESSELJ and BESSELY.
* Improve BETA accuracy.
* Fix problem with database functions. [#761305]
+ * Fix font problem for ssconvert to pdf. [#761296]
--------------------------------------------------------------------------
Gnumeric 1.12.26
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 8cf12a9..5f09ca6 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -589,24 +589,28 @@ sheet_widget_frame_user_config (SheetObject *so, SheetControl *sc)
static PangoFontDescription *
get_font (void)
{
- /* Note: Under gnumeric, we appear to get a proper font using */
- /* GtkStyleContext. Under ssconvert, some seem to get a */
- /* proper font using GtkStyleContext, some don't. Those */
- /* get one using the Gsettings. The 'sans 10' is just */
- /* insurance */
- PangoFontDescription *desc;
+ // Note: Under gnumeric, we get a proper font using GtkStyleContext.
+ // Under ssconvert, we try GSettings.
+ // The 'sans 10' is just insurance
- GtkStyleContext *style = gtk_style_context_new ();
- GtkWidgetPath *path = gtk_widget_path_new ();
+ PangoFontDescription *desc;
PangoFontMask mask;
int size = 0;
- gtk_style_context_set_path (style, path);
- gtk_widget_path_unref (path);
+ if (gdk_screen_get_default ()) {
+ // Without a default screen, the following will crash
+ // with newer gtk+.
+ GtkStyleContext *style = gtk_style_context_new ();
+ GtkWidgetPath *path = gtk_widget_path_new ();
- gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
- GTK_STYLE_PROPERTY_FONT, &desc, NULL);
- g_object_unref (style);
+ gtk_style_context_set_path (style, path);
+ gtk_widget_path_unref (path);
+
+ gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_FONT, &desc, NULL);
+ g_object_unref (style);
+ } else
+ desc = pango_font_description_new ();
mask = pango_font_description_get_set_fields (desc);
if ((mask & PANGO_FONT_MASK_SIZE) != 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]