1 /* Pango
2  * pango-utils.c: Utilities for internal functions and modules
3  *
4  * Copyright (C) 2000 Red Hat Software
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef __PANGO_UTILS_H__
23 #define __PANGO_UTILS_H__
24 
25 #include <stdio.h>
26 #include <glib.h>
27 #include <pango/pango-font.h>
28 
29 G_BEGIN_DECLS
30 
31 PANGO_DEPRECATED
32 char **  pango_split_file_list (const char *str);
33 
34 PANGO_DEPRECATED
35 char    *pango_trim_string     (const char *str);
36 PANGO_DEPRECATED
37 gint     pango_read_line      (FILE        *stream,
38 			       GString     *str);
39 PANGO_DEPRECATED
40 gboolean pango_skip_space     (const char **pos);
41 PANGO_DEPRECATED
42 gboolean pango_scan_word      (const char **pos,
43 			       GString     *out);
44 PANGO_DEPRECATED
45 gboolean pango_scan_string    (const char **pos,
46 			       GString     *out);
47 PANGO_DEPRECATED
48 gboolean pango_scan_int       (const char **pos,
49 			       int         *out);
50 
51 PANGO_DEPRECATED
52 gboolean pango_parse_enum     (GType       type,
53 			       const char *str,
54 			       int        *value,
55 			       gboolean    warn,
56 			       char      **possible_values);
57 
58 /* Functions for parsing textual representations
59  * of PangoFontDescription fields. They return TRUE if the input string
60  * contains a valid value, which then has been assigned to the corresponding
61  * field in the PangoFontDescription. If the warn parameter is TRUE,
62  * a warning is printed (with g_warning) if the string does not
63  * contain a valid value.
64  */
65 PANGO_AVAILABLE_IN_ALL
66 gboolean pango_parse_style   (const char   *str,
67 			      PangoStyle   *style,
68 			      gboolean      warn);
69 PANGO_AVAILABLE_IN_ALL
70 gboolean pango_parse_variant (const char   *str,
71 			      PangoVariant *variant,
72 			      gboolean      warn);
73 PANGO_AVAILABLE_IN_ALL
74 gboolean pango_parse_weight  (const char   *str,
75 			      PangoWeight  *weight,
76 			      gboolean      warn);
77 PANGO_AVAILABLE_IN_ALL
78 gboolean pango_parse_stretch (const char   *str,
79 			      PangoStretch *stretch,
80 			      gboolean      warn);
81 
82 
83 /* Hint line position and thickness.
84  */
85 PANGO_AVAILABLE_IN_1_12
86 void pango_quantize_line_geometry (int *thickness,
87 				   int *position);
88 
89 /* A routine from fribidi that we either wrap or provide ourselves.
90  */
91 PANGO_AVAILABLE_IN_1_4
92 guint8 * pango_log2vis_get_embedding_levels (const gchar    *text,
93 					     int             length,
94 					     PangoDirection *pbase_dir);
95 
96 /* Unicode characters that are zero-width and should not be rendered
97  * normally.
98  */
99 PANGO_AVAILABLE_IN_1_10
100 gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
101 
102 /* Pango version checking */
103 
104 /* Encode a Pango version as an integer */
105 /**
106  * PANGO_VERSION_ENCODE:
107  * @major: the major component of the version number
108  * @minor: the minor component of the version number
109  * @micro: the micro component of the version number
110  *
111  * This macro encodes the given Pango version into an integer.  The numbers
112  * returned by %PANGO_VERSION and pango_version() are encoded using this macro.
113  * Two encoded version numbers can be compared as integers.
114  */
115 #define PANGO_VERSION_ENCODE(major, minor, micro) (     \
116 	  ((major) * 10000)                             \
117 	+ ((minor) *   100)                             \
118 	+ ((micro) *     1))
119 
120 /* Encoded version of Pango at compile-time */
121 /**
122  * PANGO_VERSION:
123  *
124  * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE().
125  */
126 /**
127  * PANGO_VERSION_STRING:
128  *
129  * A string literal containing the version of Pango available at compile-time.
130  */
131 /**
132  * PANGO_VERSION_MAJOR:
133  *
134  * The major component of the version of Pango available at compile-time.
135  */
136 /**
137  * PANGO_VERSION_MINOR:
138  *
139  * The minor component of the version of Pango available at compile-time.
140  */
141 /**
142  * PANGO_VERSION_MICRO:
143  *
144  * The micro component of the version of Pango available at compile-time.
145  */
146 #define PANGO_VERSION PANGO_VERSION_ENCODE(     \
147 	PANGO_VERSION_MAJOR,                    \
148 	PANGO_VERSION_MINOR,                    \
149 	PANGO_VERSION_MICRO)
150 
151 /* Check that compile-time Pango is as new as required */
152 /**
153  * PANGO_VERSION_CHECK:
154  * @major: the major component of the version number
155  * @minor: the minor component of the version number
156  * @micro: the micro component of the version number
157  *
158  * Checks that the version of Pango available at compile-time is not older than
159  * the provided version number.
160  */
161 #define PANGO_VERSION_CHECK(major,minor,micro)    \
162 	(PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro))
163 
164 
165 /* Return encoded version of Pango at run-time */
166 PANGO_AVAILABLE_IN_1_16
167 int pango_version (void) G_GNUC_CONST;
168 
169 /* Return run-time Pango version as an string */
170 PANGO_AVAILABLE_IN_1_16
171 const char * pango_version_string (void) G_GNUC_CONST;
172 
173 /* Check that run-time Pango is as new as required */
174 PANGO_AVAILABLE_IN_1_16
175 const char * pango_version_check (int required_major,
176                                   int required_minor,
177                                   int required_micro) G_GNUC_CONST;
178 
179 G_END_DECLS
180 
181 #endif /* __PANGO_UTILS_H__ */
182