Git init
[external/pango1.0.git] / pango / pango-utils.h
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 char **  pango_split_file_list (const char *str);
32
33 char    *pango_trim_string     (const char *str);
34 gint     pango_read_line      (FILE        *stream,
35                                GString     *str);
36 gboolean pango_skip_space     (const char **pos);
37 gboolean pango_scan_word      (const char **pos,
38                                GString     *out);
39 gboolean pango_scan_string    (const char **pos,
40                                GString     *out);
41 gboolean pango_scan_int       (const char **pos,
42                                int         *out);
43
44 #ifdef PANGO_ENABLE_BACKEND
45 char *   pango_config_key_get (const char  *key);
46 void     pango_lookup_aliases (const char   *fontname,
47                                char       ***families,
48                                int          *n_families);
49 #endif /* PANGO_ENABLE_BACKEND */
50
51 gboolean pango_parse_enum     (GType       type,
52                                const char *str,
53                                int        *value,
54                                gboolean    warn,
55                                char      **possible_values);
56
57 /* Functions for parsing textual representations
58  * of PangoFontDescription fields. They return TRUE if the input string
59  * contains a valid value, which then has been assigned to the corresponding
60  * field in the PangoFontDescription. If the warn parameter is TRUE,
61  * a warning is printed (with g_warning) if the string does not
62  * contain a valid value.
63  */
64 gboolean pango_parse_style   (const char   *str,
65                               PangoStyle   *style,
66                               gboolean      warn);
67 gboolean pango_parse_variant (const char   *str,
68                               PangoVariant *variant,
69                               gboolean      warn);
70 gboolean pango_parse_weight  (const char   *str,
71                               PangoWeight  *weight,
72                               gboolean      warn);
73 gboolean pango_parse_stretch (const char   *str,
74                               PangoStretch *stretch,
75                               gboolean      warn);
76
77 #ifdef PANGO_ENABLE_BACKEND
78
79 /* On Unix, return the name of the "pango" subdirectory of SYSCONFDIR
80  * (which is set at compile time). On Win32, return the Pango
81  * installation directory (which is set at installation time, and
82  * stored in the registry). The returned string should not be
83  * g_free'd.
84  */
85 G_CONST_RETURN char *   pango_get_sysconf_subdirectory (void) G_GNUC_PURE;
86
87 /* Ditto for LIBDIR/pango. On Win32, use the same Pango
88  * installation directory. This returned string should not be
89  * g_free'd either.
90  */
91 G_CONST_RETURN char *   pango_get_lib_subdirectory (void) G_GNUC_PURE;
92
93 #endif /* PANGO_ENABLE_BACKEND */
94
95 /* Hint line position and thickness.
96  */
97 void pango_quantize_line_geometry (int *thickness,
98                                    int *position);
99
100 /* A routine from fribidi that we either wrap or provide ourselves.
101  */
102 guint8 * pango_log2vis_get_embedding_levels (const gchar    *text,
103                                              int             length,
104                                              PangoDirection *pbase_dir);
105
106 /* Unicode characters that are zero-width and should not be rendered
107  * normally.
108  */
109 gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
110
111 /* Pango version checking */
112
113 /* Encode a Pango version as an integer */
114 #define PANGO_VERSION_ENCODE(major, minor, micro) (     \
115           ((major) * 10000)                             \
116         + ((minor) *   100)                             \
117         + ((micro) *     1))
118
119 /* Encoded version of Pango at compile-time */
120 #define PANGO_VERSION PANGO_VERSION_ENCODE(     \
121         PANGO_VERSION_MAJOR,                    \
122         PANGO_VERSION_MINOR,                    \
123         PANGO_VERSION_MICRO)
124
125 /* Check that compile-time Pango is as new as required */
126 #define PANGO_VERSION_CHECK(major,minor,micro)    \
127         (PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro))
128
129
130 /* Return encoded version of Pango at run-time */
131 int pango_version (void) G_GNUC_CONST;
132
133 /* Return run-time Pango version as an string */
134 G_CONST_RETURN char * pango_version_string (void) G_GNUC_CONST;
135
136 /* Check that run-time Pango is as new as required */
137 G_CONST_RETURN char * pango_version_check (int required_major,
138                                            int required_minor,
139                                            int required_micro) G_GNUC_CONST;
140
141 G_END_DECLS
142
143 #endif /* __PANGO_UTILS_H__ */