[gnumeric] Use current GTK style when printing sheet object widgets from Gnumeric. [#705684]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Use current GTK style when printing sheet object widgets from Gnumeric. [#705684]
- Date: Thu, 8 Aug 2013 19:15:38 +0000 (UTC)
commit fc42b83ffbbfdd96e83ab20c74335da75ccb8e93
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Aug 8 13:14:27 2013 -0600
Use current GTK style when printing sheet object widgets from Gnumeric. [#705684]
2013-08-08 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c (draw_cairo_text): use GtkStyleContext
if possible
ChangeLog | 5 +++++
NEWS | 1 +
src/sheet-object-widget.c | 19 ++++++++++++++-----
3 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 55a60db..7994786 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-08-08 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/sheet-object-widget.c (draw_cairo_text): use GtkStyleContext
+ if possible
+
+2013-08-08 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/sheet-object-widget.c (draw_cairo_text): add arguments to
allow multi-paragraph with a highlighted line. Change all callers
(sheet_widget_list_draw_cairo): use draw_cairo_text
diff --git a/NEWS b/NEWS
index 0b3a422..efe65bb 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ Andreas:
* Fix documentation. [#705541]
* Avoid crashing when printing sheet object widgets from ssconvert. [#705638]
* Fix printing of sheet object widgets. [#705650] [#705653]
+ * Use current GTK style when printing sheet object widgets from Gnumeric. [#705684]
Jean:
* Fix text wrap inside sheet objects. [#704417]
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 784c975..4595d57 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -583,14 +583,24 @@ draw_cairo_text (cairo_t *cr, char const *text, int *pwidth, int *pheight,
{
PangoLayout *layout = pango_cairo_create_layout (cr);
PangoFontDescription *desc;
- /* Using GtkStyle does not seem to work in ssconvert */
- /* GtkStyle *style = gtk_style_new (); */
double const scale_h = 72. / gnm_app_display_dpi_get (TRUE);
double const scale_v = 72. / gnm_app_display_dpi_get (FALSE);
int width, height;
- /* pango_layout_set_font_description (layout, style->font_desc); */
- desc = pango_font_description_from_string ("sans 10");
+ if (NULL != gdk_screen_get_default ()) {
+ GtkStyleContext *style = gtk_style_context_new ();
+ GtkWidgetPath *path = gtk_widget_path_new ();
+
+ 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 {
+ /* The desription obtained by GtkStyleContext is not valid in ssconvert!! */
+ desc = pango_font_description_from_string ("sans 10");
+ }
pango_context_set_font_description
(pango_layout_get_context (layout), desc);
pango_layout_set_spacing (layout, 3 * PANGO_SCALE);
@@ -631,7 +641,6 @@ draw_cairo_text (cairo_t *cr, char const *text, int *pwidth, int *pheight,
pango_cairo_show_layout (cr, layout);
pango_font_description_free (desc);
g_object_unref (layout);
- /* g_object_unref (style); */
if (pwidth)
*pwidth = width * scale_h;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]