[gnumeric] xls: fix chart font reading.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: fix chart font reading.
- Date: Tue, 17 Feb 2015 01:05:34 +0000 (UTC)
commit 9a7b576c263b0cc5385f234e581316c38420f6aa
Author: Morten Welinder <terra gnome org>
Date: Mon Feb 16 20:04:15 2015 -0500
xls: fix chart font reading.
We need to set auto_font when we see a non-automatic font.
Note, that previously saved xls files will be read back with most
fonts explicitly set. That's just too bad.
plugins/excel/ChangeLog | 4 ++++
plugins/excel/ms-chart.c | 10 ++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index d342bfb..7a4bf60 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,9 @@
2015-02-16 Morten Welinder <terra gnome org>
+ * ms-chart.c (chart_write_axis): Only output font record when it's
+ not automatic.
+ (BC_R(fontx)): When we see a font record, it's not auto_font.
+
* xlsx-read-drawing.c (xlsx_draw_text_run_props): Fix reading of
fonts, notably of the auto-font flag. Part of #744632.
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index e7a15fa..4012248 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -1037,6 +1037,7 @@ BC_R(fontx)(XLChartHandler const *handle,
go_font_ref (gfont);
BC_R(get_style) (s);
go_style_set_font (s->style, gfont);
+ s->style->font.auto_font = FALSE;
d (2, g_printerr ("apply font %u %s;", fno, go_font_as_str (gfont)););
return FALSE;
}
@@ -4355,9 +4356,10 @@ chart_write_text (XLChartWriteState *s, GOData const *src, GOStyledObject const
chart_write_BEGIN (s);
/* BIFF_CHART_pos, optional we use auto positioning */
- ms_biff_put_2byte (s->bp, BIFF_CHART_fontx, ((style)?
- excel_font_from_go_font (&s->ewb->base, style->font.font):
- 5));
+ ms_biff_put_2byte (s->bp, BIFF_CHART_fontx,
+ (style && !style->font.auto_font)
+ ? excel_font_from_go_font (&s->ewb->base, style->font.font)
+ : 5);
chart_write_AI (s, src, 0, 1);
if (obj && purpose) {
data = ms_biff_put_len_next (s->bp, BIFF_CHART_objectlink, 6);
@@ -5005,7 +5007,7 @@ chart_write_axis (XLChartWriteState *s, GogAxis const *axis,
}
ms_biff_put_commit (s->bp);
font = excel_font_from_go_font (&s->ewb->base, style->font.font);
- if (font > 0)
+ if (font > 0 && !style->font.auto_font)
ms_biff_put_2byte (s->bp, BIFF_CHART_fontx, font);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]