[gnumeric] Fix autofitting of row height in presence of superscripted scientific notation. [#662472]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix autofitting of row height in presence of superscripted scientific notation. [#662472]
- Date: Fri, 28 Oct 2011 18:25:08 +0000 (UTC)
commit 076ea39e5133546e6d0c0e2093162768f21698e0
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Fri Oct 28 12:24:33 2011 -0600
Fix autofitting of row height in presence of superscripted scientific notation. [#662472]
2011-10-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/mstyle.c (gnm_style_get_pango_height): check for
possible superscripts in the value formatting
ChangeLog | 5 +++++
NEWS | 2 ++
src/mstyle.c | 23 ++++++++++++++++++++++-
3 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 616d48e..e28d624 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/mstyle.c (gnm_style_get_pango_height): check for
+ possible superscripts in the value formatting
+
2011-10-28 Morten Welinder <terra gnome org>
* src/gnumeric-conf.c: Rename from src/gnumeric-gconf.c
diff --git a/NEWS b/NEWS
index 28fb236..235b8c6 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,8 @@ Andreas:
* Add optional markers to indicate that cell content has been
truncated. [#662149]
* Fix zoom of text superscripts and subscripts. [#425685]
+ * Fix autofitting of row height in presence of superscripted
+ scientific notation. [#662472]
Jean:
* Make things build against gtk+-3.0.
diff --git a/src/mstyle.c b/src/mstyle.c
index 1ca32a1..d4d3507 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -1733,8 +1733,29 @@ gnm_style_get_pango_height (GnmStyle const *style,
if (style->pango_attrs_height == -1) {
int h;
PangoLayout *layout = pango_layout_new (context);
+ GOFormat const *fmt;
+ gboolean requires_translation = FALSE;
+
+ fmt = gnm_style_get_format (style);
+ if (!go_format_is_general (fmt)) {
+ GOFormatDetails details;
+ go_format_get_details (fmt, &details, NULL);
+ if (details.family == GO_FORMAT_SCIENTIFIC &&
+ details.use_markup) {
+ PangoAttribute *a
+ = go_pango_attr_superscript_new (TRUE);
+ /* We want to superscript the "-01" in the */
+ /* string "+1.23456789E-01" */
+ a->start_index = 12;
+ a->end_index = 15;
+ pango_attr_list_insert (attrs, a);
+ requires_translation = TRUE;
+ }
+ }
pango_layout_set_attributes (layout, attrs);
pango_layout_set_text (layout, "+1.23456789E-01", -1);
+ if (requires_translation)
+ go_pango_translate_layout (layout);
pango_layout_get_pixel_size (layout, NULL, &h);
g_object_unref (layout);
((GnmStyle *)style)->pango_attrs_height = h;
@@ -1902,7 +1923,7 @@ gnm_style_init (void)
#if USE_MSTYLE_POOL
static void
-cb_gnm_style_pool_leak (gpointer data, gpointer user)
+cb_gnm_style_pool_leak (gpointer data, G_GNUC_UNUSED gpointer user)
{
GnmStyle *style = data;
g_printerr ("Leaking style at %p.\n", (void *)style);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]