]> git.sur5r.net Git - glabels/blobdiff - src/str-util.c
Imported Upstream version 3.2.0
[glabels] / src / str-util.c
index f8c6d70a1355c2e42b23a254d0c874299a303439..deb939fe071fbd0ebf391cbe0c99676ec76dea35 100644 (file)
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <math.h>
 
+#include "label-object.h"
+
 
 /****************************************************************************/
 /* Utilities to deal with PangoAlignment types.                             */
@@ -62,6 +64,42 @@ gl_str_util_string_to_align (const gchar *string)
 }
 
 
+/****************************************************************************/
+/* Utilities to deal with vertical alignment types.                         */
+/****************************************************************************/
+const gchar *
+gl_str_util_valign_to_string (glValignment valign)
+{
+       switch (valign) {
+       case GL_VALIGN_TOP:
+               return "Top";
+       case GL_VALIGN_VCENTER:
+               return "Center";
+       case GL_VALIGN_BOTTOM:
+               return "Bottom";
+       default:
+               return "?";
+       }
+}
+
+
+glValignment
+gl_str_util_string_to_valign (const gchar *string)
+{
+
+       if (g_ascii_strcasecmp (string, "Top") == 0) {
+               return GL_VALIGN_TOP;
+       } else if (g_ascii_strcasecmp (string, "Center") == 0) {
+               return GL_VALIGN_VCENTER;
+       } else if (g_ascii_strcasecmp (string, "Bottom") == 0) {
+               return GL_VALIGN_BOTTOM;
+       } else {
+               return GL_VALIGN_TOP;
+       }
+
+}
+
+
 /****************************************************************************/
 /* Utilities to deal with PangoWeight types                                 */
 /****************************************************************************/