3 * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * gLabels is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
28 #include "label-object.h"
31 /****************************************************************************/
32 /* Utilities to deal with PangoAlignment types. */
33 /****************************************************************************/
35 gl_str_util_align_to_string (PangoAlignment align)
38 case PANGO_ALIGN_LEFT:
40 case PANGO_ALIGN_CENTER:
42 case PANGO_ALIGN_RIGHT:
51 gl_str_util_string_to_align (const gchar *string)
54 if (g_ascii_strcasecmp (string, "Left") == 0) {
55 return PANGO_ALIGN_LEFT;
56 } else if (g_ascii_strcasecmp (string, "Center") == 0) {
57 return PANGO_ALIGN_CENTER;
58 } else if (g_ascii_strcasecmp (string, "Right") == 0) {
59 return PANGO_ALIGN_RIGHT;
61 return PANGO_ALIGN_LEFT;
67 /****************************************************************************/
68 /* Utilities to deal with vertical alignment types. */
69 /****************************************************************************/
71 gl_str_util_valign_to_string (glValignment valign)
76 case GL_VALIGN_VCENTER:
78 case GL_VALIGN_BOTTOM:
87 gl_str_util_string_to_valign (const gchar *string)
90 if (g_ascii_strcasecmp (string, "Top") == 0) {
92 } else if (g_ascii_strcasecmp (string, "Center") == 0) {
93 return GL_VALIGN_VCENTER;
94 } else if (g_ascii_strcasecmp (string, "Bottom") == 0) {
95 return GL_VALIGN_BOTTOM;
103 /****************************************************************************/
104 /* Utilities to deal with PangoWeight types */
105 /****************************************************************************/
107 gl_str_util_weight_to_string (PangoWeight weight)
110 case PANGO_WEIGHT_NORMAL:
112 case PANGO_WEIGHT_BOLD:
121 gl_str_util_string_to_weight (const gchar *string)
124 if (g_ascii_strcasecmp (string, "Regular") == 0) {
125 return PANGO_WEIGHT_NORMAL;
126 } else if (g_ascii_strcasecmp (string, "Bold") == 0) {
127 return PANGO_WEIGHT_BOLD;
129 return PANGO_WEIGHT_NORMAL;
137 * Local Variables: -- emacs
139 * c-basic-offset: 8 -- emacs
140 * tab-width: 8 -- emacs
141 * indent-tabs-mode: nil -- emacs