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_AVAILABLE_IN_ALL |
103 | void pango_find_paragraph_boundary (const char *text, |
104 | int length, |
105 | int *paragraph_delimiter_index, |
106 | int *next_paragraph_start); |
107 | |
108 | /* Pango version checking */ |
109 | |
110 | /* Encode a Pango version as an integer */ |
111 | /** |
112 | * PANGO_VERSION_ENCODE: |
113 | * @major: the major component of the version number |
114 | * @minor: the minor component of the version number |
115 | * @micro: the micro component of the version number |
116 | * |
117 | * This macro encodes the given Pango version into an integer. The numbers |
118 | * returned by %PANGO_VERSION and pango_version() are encoded using this macro. |
119 | * Two encoded version numbers can be compared as integers. |
120 | */ |
121 | #define PANGO_VERSION_ENCODE(major, minor, micro) ( \ |
122 | ((major) * 10000) \ |
123 | + ((minor) * 100) \ |
124 | + ((micro) * 1)) |
125 | |
126 | /* Encoded version of Pango at compile-time */ |
127 | /** |
128 | * PANGO_VERSION: |
129 | * |
130 | * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE(). |
131 | */ |
132 | /** |
133 | * PANGO_VERSION_STRING: |
134 | * |
135 | * A string literal containing the version of Pango available at compile-time. |
136 | */ |
137 | /** |
138 | * PANGO_VERSION_MAJOR: |
139 | * |
140 | * The major component of the version of Pango available at compile-time. |
141 | */ |
142 | /** |
143 | * PANGO_VERSION_MINOR: |
144 | * |
145 | * The minor component of the version of Pango available at compile-time. |
146 | */ |
147 | /** |
148 | * PANGO_VERSION_MICRO: |
149 | * |
150 | * The micro component of the version of Pango available at compile-time. |
151 | */ |
152 | #define PANGO_VERSION PANGO_VERSION_ENCODE( \ |
153 | PANGO_VERSION_MAJOR, \ |
154 | PANGO_VERSION_MINOR, \ |
155 | PANGO_VERSION_MICRO) |
156 | |
157 | /* Check that compile-time Pango is as new as required */ |
158 | /** |
159 | * PANGO_VERSION_CHECK: |
160 | * @major: the major component of the version number |
161 | * @minor: the minor component of the version number |
162 | * @micro: the micro component of the version number |
163 | * |
164 | * Checks that the version of Pango available at compile-time is not older than |
165 | * the provided version number. |
166 | */ |
167 | #define PANGO_VERSION_CHECK(major,minor,micro) \ |
168 | (PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro)) |
169 | |
170 | |
171 | /* Return encoded version of Pango at run-time */ |
172 | PANGO_AVAILABLE_IN_1_16 |
173 | int pango_version (void) G_GNUC_CONST; |
174 | |
175 | /* Return run-time Pango version as an string */ |
176 | PANGO_AVAILABLE_IN_1_16 |
177 | const char * pango_version_string (void) G_GNUC_CONST; |
178 | |
179 | /* Check that run-time Pango is as new as required */ |
180 | PANGO_AVAILABLE_IN_1_16 |
181 | const char * pango_version_check (int required_major, |
182 | int required_minor, |
183 | int required_micro) G_GNUC_CONST; |
184 | |
185 | G_END_DECLS |
186 | |
187 | #endif /* __PANGO_UTILS_H__ */ |
188 | |