[gnumeric] import/export sub-/superscript attributes to xls (and fix PANGO_ATTR_RISE handling)
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] import/export sub-/superscript attributes to xls (and fix PANGO_ATTR_RISE handling)
- Date: Fri, 28 Oct 2011 02:44:24 +0000 (UTC)
commit 00cb93b709fabcec75f80565d6bb0057f9d771e2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Oct 27 20:43:37 2011 -0600
import/export sub-/superscript attributes to xls (and fix PANGO_ATTR_RISE handling)
2011-10-27 Andreas J. Guelzow <aguelzow pyrshep ca>
* ms-excel-read.c (ms_wb_get_font_markup): use subscript/superscript attributes
* ms-excel-write.c (excel_font_overlay_pango): export subscript/superscript
attributes (and fix PANGO_ATTR_RISE handling)
plugins/excel/ChangeLog | 6 ++++++
plugins/excel/ms-excel-read.c | 17 ++++++++++++++---
plugins/excel/ms-excel-write.c | 12 +++++++++++-
3 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index e61cff5..d9295aa 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-27 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * ms-excel-read.c (ms_wb_get_font_markup): use subscript/superscript attributes
+ * ms-excel-write.c (excel_font_overlay_pango): export subscript/superscript
+ attributes (and fix PANGO_ATTR_RISE handling)
+
2011-10-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* xlsx-write.c (xlsx_write_sheet): don't miss cell content that
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 02cbc7d..74244ec 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -3236,9 +3236,20 @@ ms_wb_get_font_markup (MSContainer const *c, unsigned indx)
add_attr (attrs, pango_attr_style_new (fd->italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL));
add_attr (attrs, pango_attr_strikethrough_new (fd->struck_out));
add_attr (attrs, pango_attr_underline_new (underline));
- add_attr (attrs, pango_attr_rise_new (5000 * fd->script));
- if (fd->script != GO_FONT_SCRIPT_STANDARD)
- add_attr (attrs, pango_attr_scale_new (.5));
+
+ switch (fd->script) {
+ case GO_FONT_SCRIPT_SUB:
+ add_attr (attrs, go_pango_attr_subscript_new (TRUE));
+ break;
+ default:
+ case GO_FONT_SCRIPT_STANDARD:
+ add_attr (attrs, go_pango_attr_subscript_new (FALSE));
+ add_attr (attrs, go_pango_attr_superscript_new (FALSE));
+ break;
+ case GO_FONT_SCRIPT_SUPER:
+ add_attr (attrs, go_pango_attr_superscript_new (TRUE));
+ break;
+ }
color = (fd->color_idx == 127) ? style_color_black ()
: excel_palette_get (importer, fd->color_idx);
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 4f2d392..df4e7f8 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -2008,10 +2008,12 @@ excel_font_overlay_pango (ExcelWriteFont *efont, GSList *pango)
case PANGO_ATTR_STRIKETHROUGH : efont->strikethrough =
((PangoAttrInt *)attr)->value != 0;
break;
+ case PANGO_ATTR_SCALE :
+ break; /* ignored */
case PANGO_ATTR_RISE :
if (((PangoAttrInt *)attr)->value < 0)
efont->script = 2;
- else if (((PangoAttrInt *)attr)->value < 0)
+ else if (((PangoAttrInt *)attr)->value > 0)
efont->script = 1;
else
efont->script = 0;
@@ -2028,6 +2030,14 @@ excel_font_overlay_pango (ExcelWriteFont *efont, GSList *pango)
efont->color = ((c->blue & 0xff00) << 8) + (c->green & 0xff00) + (c->red >> 8);
break;
default :
+ if (attr->klass->type ==
+ go_pango_attr_subscript_get_type ())
+ efont->script = ((GOPangoAttrSubscript *)attr)->val
+ ? 2 : 0;
+ else if (attr->klass->type ==
+ go_pango_attr_superscript_get_type ())
+ efont->script = ((GOPangoAttrSuperscript *)attr)->val
+ ? 1 : 0;
break; /* ignored */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]