[goffice] go_unichar_issign: new function



commit 4a16f4577c79dbfe32c224f8459b9f3311d2a47e
Author: Morten Welinder <terra gnome org>
Date:   Sun Dec 25 14:39:32 2011 -0500

    go_unichar_issign: new function

 ChangeLog                      |    5 +++++
 goffice/utils/go-glib-extras.c |   22 ++++++++++++++++++++++
 goffice/utils/go-glib-extras.h |    1 +
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5677361..4ac9668 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-25  Morten Welinder  <terra gnome org>
+
+	* goffice/utils/go-glib-extras.c (go_unichar_issign): New
+	function.
+
 2011-12-23  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* goffice/utils/go-format.c (go_format_parse_locale): allow for 33 bit
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index cb3aed0..c1c8c75 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -305,6 +305,28 @@ go_string_replace (GString *target,
 		g_string_insert_len (target, pos, txt, newlen);
 }
 
+int
+go_unichar_issign (gunichar uc)
+{
+	switch (uc) {
+	case '+':
+	case 0x207a: /* Superscript plus */
+	case 0x208a: /* Subscript plus */
+	case 0x2795: /* Unicode heavy plus */
+	case 0xff0b: /* Variant of '+' for CJK */
+		return +1;
+	case '-':
+	case 0x207b: /* Superscript minus */
+	case 0x208b: /* Subscript minus */
+	case 0x2212: /* Unicode minus */
+	case 0x2796: /* Unicode heavy minus */
+	case 0xff0d: /* Variant of '-' for CJK */
+		return -1;
+	default:
+		return 0;
+	}
+}
+
 /* ------------------------------------------------------------------------- */
 
 /**
diff --git a/goffice/utils/go-glib-extras.h b/goffice/utils/go-glib-extras.h
index 46738b9..710c100 100644
--- a/goffice/utils/go-glib-extras.h
+++ b/goffice/utils/go-glib-extras.h
@@ -74,6 +74,7 @@ void        go_string_append_c_n        (GString *target, char c, gsize n);
 void        go_string_replace           (GString *target,
 					 gsize pos, gssize oldlen,
 					 const char *txt, gssize newlen);
+int         go_unichar_issign           (gunichar uc);
 
 char const *go_guess_encoding		(char const *raw, gsize len,
 					 char const *user_guess,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]