1 /*
2  * Distributed under the Boost Software License, Version 1.0.
3  *    (See accompanying file LICENSE_1_0.txt or copy at
4  *          http://www.boost.org/LICENSE_1_0.txt)
5  */
6 module pango.c.utils;
7 
8 import pango.c.font;
9 import pango.c.types;
10 
11 import glib;
12 import gobject;
13 
14 import core.stdc.stdio;
15 
16 
17 extern(C):
18 
19 
20 enum PANGO_VERSION_MAJOR = 1;
21 enum PANGO_VERSION_MINOR = 36;
22 enum PANGO_VERSION_MICRO = 8;
23 
24 enum PANGO_VERSION_STRING = "1.36.8";
25 
26 
27 char **  pango_split_file_list (const(char) *str);
28 
29 char    *pango_trim_string     (const(char) *str);
30 gint     pango_read_line      (FILE        *stream,
31 			       GString     *str);
32 gboolean pango_skip_space     (const(char) **pos);
33 gboolean pango_scan_word      (const(char) **pos,
34 			       GString     *out_);
35 gboolean pango_scan_string    (const(char) **pos,
36 			       GString     *out_);
37 gboolean pango_scan_int       (const(char) **pos,
38 			       int         *out_);
39 
40 char *   pango_config_key_get_system (const(char) *key);
41 char *   pango_config_key_get (const(char)  *key);
42 deprecated
43 void     pango_lookup_aliases (const(char)   *fontname,
44 			       char       ***families,
45 			       int          *n_families);
46 
47 gboolean pango_parse_enum     (GType       type,
48 			       const(char) *str,
49 			       int        *value,
50 			       gboolean    warn,
51 			       char      **possible_values);
52 
53 /* Functions for parsing textual representations
54  * of PangoFontDescription fields. They return TRUE if the input string
55  * contains a valid value, which then has been assigned to the corresponding
56  * field in the PangoFontDescription. If the warn parameter is TRUE,
57  * a warning is printed (with g_warning) if the string does not
58  * contain a valid value.
59  */
60 gboolean pango_parse_style   (const(char)   *str,
61 			      PangoStyle   *style,
62 			      gboolean      warn);
63 gboolean pango_parse_variant (const(char)   *str,
64 			      PangoVariant *variant,
65 			      gboolean      warn);
66 gboolean pango_parse_weight  (const(char)   *str,
67 			      PangoWeight  *weight,
68 			      gboolean      warn);
69 gboolean pango_parse_stretch (const(char)   *str,
70 			      PangoStretch *stretch,
71 			      gboolean      warn);
72 
73 /* On Unix, return the name of the "pango" subdirectory of SYSCONFDIR
74  * (which is set at compile time). On Win32, return the Pango
75  * installation directory (which is set at installation time, and
76  * stored in the registry). The returned string should not be
77  * g_free'd.
78  */
79 pure const(char) *   pango_get_sysconf_subdirectory ();
80 
81 /* Ditto for LIBDIR/pango. On Win32, use the same Pango
82  * installation directory. This returned string should not be
83  * g_free'd either.
84  */
85 pure const(char) *   pango_get_lib_subdirectory ();
86 
87 
88 /* Hint line position and thickness.
89  */
90 void pango_quantize_line_geometry (int *thickness,
91 				   int *position);
92 
93 /* A routine from fribidi that we either wrap or provide ourselves.
94  */
95 guint8 * pango_log2vis_get_embedding_levels (const(gchar)    *text,
96 					     int             length,
97 					     PangoDirection *pbase_dir);
98 
99 /* Unicode characters that are zero-width and should not be rendered
100  * normally.
101  */
102 pure gboolean pango_is_zero_width (gunichar ch);
103 
104 /* Pango version checking */
105 
106 /* Encode a Pango version as an integer */
107 /**
108  * PANGO_VERSION_ENCODE:
109  * @major: the major component of the version number
110  * @minor: the minor component of the version number
111  * @micro: the micro component of the version number
112  *
113  * This macro encodes the given Pango version into an integer.  The numbers
114  * returned by %PANGO_VERSION and pango_version() are encoded using this macro.
115  * Two encoded version numbers can be compared as integers.
116  */
117 auto PANGO_VERSION_ENCODE(N)(N major, N minor, N micro)
118 {
119     return major * 10000 + minor * 100 + micro;
120 }
121 
122 /* Encoded version of Pango at compile-time */
123 /**
124  * PANGO_VERSION:
125  *
126  * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE().
127  */
128 /**
129  * PANGO_VERSION_STRING:
130  *
131  * A string literal containing the version of Pango available at compile-time.
132  */
133 /**
134  * PANGO_VERSION_MAJOR:
135  *
136  * The major component of the version of Pango available at compile-time.
137  */
138 /**
139  * PANGO_VERSION_MINOR:
140  *
141  * The minor component of the version of Pango available at compile-time.
142  */
143 /**
144  * PANGO_VERSION_MICRO:
145  *
146  * The micro component of the version of Pango available at compile-time.
147  */
148 enum PANGO_VERSION = PANGO_VERSION_ENCODE(PANGO_VERSION_MAJOR,
149         PANGO_VERSION_MINOR, 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 bool PANGO_VERSION_CHECK(N)(N major, N minor, N micro)
162 {
163     return PANGO_VERSION >= PANGO_VERSION_ENCODE(major, minor, micro);
164 }
165 
166 
167 /* Return encoded version of Pango at run-time */
168 pure int pango_version ();
169 
170 /* Return run-time Pango version as an string */
171 pure const(char) * pango_version_string ();
172 
173 /* Check that run-time Pango is as new as required */
174 pure const(char) * pango_version_check (int required_major,
175                                   int required_minor,
176                                   int required_micro);
177