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
51PANGO_DEPRECATED
52gboolean 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 */
65PANGO_AVAILABLE_IN_ALL
66gboolean pango_parse_style (const char *str,
67 PangoStyle *style,
68 gboolean warn);
69PANGO_AVAILABLE_IN_ALL
70gboolean pango_parse_variant (const char *str,
71 PangoVariant *variant,
72 gboolean warn);
73PANGO_AVAILABLE_IN_ALL
74gboolean pango_parse_weight (const char *str,
75 PangoWeight *weight,
76 gboolean warn);
77PANGO_AVAILABLE_IN_ALL
78gboolean pango_parse_stretch (const char *str,
79 PangoStretch *stretch,
80 gboolean warn);
81
82
83/* Hint line position and thickness.
84 */
85PANGO_AVAILABLE_IN_1_12
86void pango_quantize_line_geometry (int *thickness,
87 int *position);
88
89/* A routine from fribidi that we either wrap or provide ourselves.
90 */
91PANGO_AVAILABLE_IN_1_4
92guint8 * 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 */
99PANGO_AVAILABLE_IN_1_10
100gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
101
102PANGO_AVAILABLE_IN_ALL
103void 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 */
172PANGO_AVAILABLE_IN_1_16
173int pango_version (void) G_GNUC_CONST;
174
175/* Return run-time Pango version as an string */
176PANGO_AVAILABLE_IN_1_16
177const char * pango_version_string (void) G_GNUC_CONST;
178
179/* Check that run-time Pango is as new as required */
180PANGO_AVAILABLE_IN_1_16
181const char * pango_version_check (int required_major,
182 int required_minor,
183 int required_micro) G_GNUC_CONST;
184
185G_END_DECLS
186
187#endif /* __PANGO_UTILS_H__ */
188

source code of gtk/subprojects/pango/pango/pango-utils.h