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
29G_BEGIN_DECLS
30
31PANGO_DEPRECATED
32char ** pango_split_file_list (const char *str);
33
34PANGO_DEPRECATED
35char *pango_trim_string (const char *str);
36PANGO_DEPRECATED
37gint pango_read_line (FILE *stream,
38 GString *str);
39PANGO_DEPRECATED
40gboolean pango_skip_space (const char **pos);
41PANGO_DEPRECATED
42gboolean pango_scan_word (const char **pos,
43 GString *out);
44PANGO_DEPRECATED
45gboolean pango_scan_string (const char **pos,
46 GString *out);
47PANGO_DEPRECATED
48gboolean pango_scan_int (const char **pos,
49 int *out);
50
51#ifdef PANGO_ENABLE_BACKEND
52PANGO_DEPRECATED_IN_1_38
53char * pango_config_key_get_system (const char *key);
54PANGO_DEPRECATED_IN_1_38
55char * pango_config_key_get (const char *key);
56PANGO_DEPRECATED_IN_1_32
57void pango_lookup_aliases (const char *fontname,
58 char ***families,
59 int *n_families);
60#endif /* PANGO_ENABLE_BACKEND */
61
62PANGO_DEPRECATED
63gboolean pango_parse_enum (GType type,
64 const char *str,
65 int *value,
66 gboolean warn,
67 char **possible_values);
68
69/* Functions for parsing textual representations
70 * of PangoFontDescription fields. They return TRUE if the input string
71 * contains a valid value, which then has been assigned to the corresponding
72 * field in the PangoFontDescription. If the warn parameter is TRUE,
73 * a warning is printed (with g_warning) if the string does not
74 * contain a valid value.
75 */
76PANGO_AVAILABLE_IN_ALL
77gboolean pango_parse_style (const char *str,
78 PangoStyle *style,
79 gboolean warn);
80PANGO_AVAILABLE_IN_ALL
81gboolean pango_parse_variant (const char *str,
82 PangoVariant *variant,
83 gboolean warn);
84PANGO_AVAILABLE_IN_ALL
85gboolean pango_parse_weight (const char *str,
86 PangoWeight *weight,
87 gboolean warn);
88PANGO_AVAILABLE_IN_ALL
89gboolean pango_parse_stretch (const char *str,
90 PangoStretch *stretch,
91 gboolean warn);
92
93#ifdef PANGO_ENABLE_BACKEND
94
95/* On Unix, return the name of the "pango" subdirectory of SYSCONFDIR
96 * (which is set at compile time). On Win32, return the Pango
97 * installation directory (which is set at installation time, and
98 * stored in the registry). The returned string should not be
99 * g_free'd.
100 */
101PANGO_DEPRECATED
102const char * pango_get_sysconf_subdirectory (void) G_GNUC_PURE;
103
104/* Ditto for LIBDIR/pango. On Win32, use the same Pango
105 * installation directory. This returned string should not be
106 * g_free'd either.
107 */
108PANGO_DEPRECATED
109const char * pango_get_lib_subdirectory (void) G_GNUC_PURE;
110
111#endif /* PANGO_ENABLE_BACKEND */
112
113/* Hint line position and thickness.
114 */
115PANGO_AVAILABLE_IN_1_12
116void pango_quantize_line_geometry (int *thickness,
117 int *position);
118
119/* A routine from fribidi that we either wrap or provide ourselves.
120 */
121PANGO_AVAILABLE_IN_1_4
122guint8 * pango_log2vis_get_embedding_levels (const gchar *text,
123 int length,
124 PangoDirection *pbase_dir);
125
126/* Unicode characters that are zero-width and should not be rendered
127 * normally.
128 */
129PANGO_AVAILABLE_IN_1_10
130gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
131
132/* Pango version checking */
133
134/* Encode a Pango version as an integer */
135/**
136 * PANGO_VERSION_ENCODE:
137 * @major: the major component of the version number
138 * @minor: the minor component of the version number
139 * @micro: the micro component of the version number
140 *
141 * This macro encodes the given Pango version into an integer. The numbers
142 * returned by %PANGO_VERSION and pango_version() are encoded using this macro.
143 * Two encoded version numbers can be compared as integers.
144 */
145#define PANGO_VERSION_ENCODE(major, minor, micro) ( \
146 ((major) * 10000) \
147 + ((minor) * 100) \
148 + ((micro) * 1))
149
150/* Encoded version of Pango at compile-time */
151/**
152 * PANGO_VERSION:
153 *
154 * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE().
155 */
156/**
157 * PANGO_VERSION_STRING:
158 *
159 * A string literal containing the version of Pango available at compile-time.
160 */
161/**
162 * PANGO_VERSION_MAJOR:
163 *
164 * The major component of the version of Pango available at compile-time.
165 */
166/**
167 * PANGO_VERSION_MINOR:
168 *
169 * The minor component of the version of Pango available at compile-time.
170 */
171/**
172 * PANGO_VERSION_MICRO:
173 *
174 * The micro component of the version of Pango available at compile-time.
175 */
176#define PANGO_VERSION PANGO_VERSION_ENCODE( \
177 PANGO_VERSION_MAJOR, \
178 PANGO_VERSION_MINOR, \
179 PANGO_VERSION_MICRO)
180
181/* Check that compile-time Pango is as new as required */
182/**
183 * PANGO_VERSION_CHECK:
184 * @major: the major component of the version number
185 * @minor: the minor component of the version number
186 * @micro: the micro component of the version number
187 *
188 * Checks that the version of Pango available at compile-time is not older than
189 * the provided version number.
190 */
191#define PANGO_VERSION_CHECK(major,minor,micro) \
192 (PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro))
193
194
195/* Return encoded version of Pango at run-time */
196PANGO_AVAILABLE_IN_1_16
197int pango_version (void) G_GNUC_CONST;
198
199/* Return run-time Pango version as an string */
200PANGO_AVAILABLE_IN_1_16
201const char * pango_version_string (void) G_GNUC_CONST;
202
203/* Check that run-time Pango is as new as required */
204PANGO_AVAILABLE_IN_1_16
205const char * pango_version_check (int required_major,
206 int required_minor,
207 int required_micro) G_GNUC_CONST;
208
209G_END_DECLS
210
211#endif /* __PANGO_UTILS_H__ */
212