[goffice] xl does not show chinese position markers with [$-...]0.00 formats. Behave the same but permit a new
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] xl does not show chinese position markers with [$-...]0.00 formats. Behave the same but permit a new
- Date: Thu, 29 Dec 2011 18:11:51 +0000 (UTC)
commit 07ac6a5583a9bd984eb16f9f05c29da38d0eda98
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Dec 29 11:07:34 2011 -0700
xl does not show chinese position markers with [$-...]0.00 formats. Behave the same but permit a new shape flag (bit 34)
2011-12-29 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/go-format.c (GOFormatShapeFlags): new flag
(handle_chinese): add and use shape_flags argument, change all
callers
ChangeLog | 6 ++++++
goffice/utils/go-format.c | 27 +++++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7e19f12..56523ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2011-12-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * goffice/utils/go-format.c (GOFormatShapeFlags): new flag
+ (handle_chinese): add and use shape_flags argument, change all
+ callers
+
+2011-12-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* goffice/utils/go-format.c (chinese_marker_shapes): add large markers
(handle_chinese): use '?' for larger than expected markers
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 1035f37..6c561b7 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -299,7 +299,10 @@ typedef enum {
} GOFormatConditionOp;
typedef enum {
- GO_FMT_SHAPE_SIGNS = 1
+ GO_FMT_SHAPE_SIGNS = 1,
+ /* GENERAL implies GO_FMT_POSITION_MARKERS whether this is set or not */
+ /* This is only useful for Chinese/Japanese/Korean numerals */
+ GO_FMT_POSITION_MARKERS = 2
} GOFormatShapeFlags;
typedef struct {
@@ -3340,22 +3343,26 @@ convert_sign (GString *str, size_t i, guint shape, guint shape_flags)
}
static void
-handle_chinese (GString *numtxt, const char **dot, guint numeral_shape)
+handle_chinese (GString *numtxt, const char **dot, guint numeral_shape,
+ guint shape_flags)
{
GString *ntxt;
char const *last;
gint i, wan;
gboolean wan_written = TRUE;
gboolean digit_written = FALSE;
- gboolean suppress_ten;
- if (numeral_shape < 0x1B || numeral_shape > 0x27)
+ gboolean suppress_ten, suppress_ten_always;
+ if ((shape_flags & GO_FMT_POSITION_MARKERS) == 0 ||
+ numeral_shape < 0x1B || numeral_shape > 0x27)
return;
last = ((dot && *dot) ? *dot - 1 : numtxt->str + (numtxt->len - 1));
if (last <= numtxt->str + 1)
return;
ntxt = g_string_sized_new (100);
- suppress_ten = (numeral_shape == 0x1b || numeral_shape == 0x1d || numeral_shape == 0x26);
+ suppress_ten = (numeral_shape == 0x1b || numeral_shape == 0x1d
+ || numeral_shape == 0x26);
+ suppress_ten_always = (numeral_shape == 0x26);
i = 0;
wan = 0;
while (last >= numtxt->str) {
@@ -3370,7 +3377,9 @@ handle_chinese (GString *numtxt, const char **dot, guint numeral_shape)
}
if (i > 0)
g_string_prepend_c (ntxt, 'a' + i - 1);
- if (!suppress_ten || *last != '1')
+ if (!suppress_ten_always ||
+ !(suppress_ten && wan == 0) ||
+ *last != '1')
g_string_prepend_c (ntxt, *last);
digit_written = TRUE;
}
@@ -3876,7 +3885,8 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
numtxt = g_string_sized_new (100);
g_string_printf (numtxt, "%.*" FORMAT_f, n, val);
dot = strstr (numtxt->str, decimal->str);
- handle_chinese (numtxt, &dot, numeral_shape);
+ handle_chinese (numtxt, &dot,
+ numeral_shape, shape_flags);
if (dot) {
size_t i = numtxt->len;
dotpos = dot - numtxt->str;
@@ -4452,7 +4462,8 @@ go_format_measure_strlen (const GString *str,
do { \
if (num_shape > 1) { \
/* 0: not set; 1: Western */ \
- handle_chinese (str, NULL, num_shape); \
+ handle_chinese (str, NULL, num_shape, \
+ shape_flags | GO_FMT_POSITION_MARKERS); \
convert_numerals (str, 0, str->len - 1, num_shape); \
} \
} while (0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]