2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = pango-Scripts.html
27 * outFile = PgScriptIter
28 * strct = PangoScriptIter
39 * - pango_script_iter_
47 * - pango.PgFontDescription
48 * - pango.PgFontMetrics
49 * - pango.PgFontFamily
52 * - pango.PgFontsetSimple
54 * - pango.PgAttributeList
58 * - pango.PgLayoutIter
61 * - PangoAttribute* -> PgAttribute
62 * - PangoAttributeList* -> PgAttributeList
63 * - PangoContext* -> PgContext
64 * - PangoFontDescription* -> PgFontDescription
65 * - PangoFontFace* -> PgFontFace
66 * - PangoFontFamily* -> PgFontFamily
67 * - PangoFontMap* -> PgFontMap
68 * - PangoFontMetrics* -> PgFontMetrics
69 * - PangoFontsetSimple* -> PgFontsetSimple
70 * - PangoItem* -> PgItem
71 * - PangoLanguage* -> PgLanguage
72 * - PangoLayout* -> PgLayout
73 * - PangoLayoutIter* -> PgLayoutIter
74 * - PangoTabArray* -> PgTabArray
79 module pango
.PgScriptIter
;
85 import tango
.io
.Stdout
; // use the tango loging?
89 private import gtkc
.pangotypes
;
91 private import gtkc
.pango
;
94 private import pango
.PgContext
;
95 private import pango
.PgItem
;
96 private import pango
.PgLayout
;
97 private import pango
.PgFontDescription
;
98 private import pango
.PgFontMetrics
;
99 private import pango
.PgFontFamily
;
100 private import pango
.PgFontFace
;
101 private import pango
.PgFontMap
;
102 private import pango
.PgFontsetSimple
;
103 private import pango
.PgAttribute
;
104 private import pango
.PgAttributeList
;
105 private import pango
.PgLanguage
;
106 private import pango
.PgTabArray
;
107 private import pango
.PgLayout
;
108 private import pango
.PgLayoutIter
;
109 private import glib
.Str
;
116 * The functions in this section are used to identify the writing
117 * system, or script of individual characters
118 * and of ranges within a larger text string.
120 public class PgScriptIter
123 /** the main Gtk struct */
124 protected PangoScriptIter
* pangoScriptIter
;
127 public PangoScriptIter
* getPgScriptIterStruct()
129 return pangoScriptIter
;
133 /** the main Gtk struct as a void* */
134 protected void* getStruct()
136 return cast(void*)pangoScriptIter
;
140 * Sets our main struct and passes it to the parent class
142 public this (PangoScriptIter
* pangoScriptIter
)
146 if ( pangoScriptIter
is null )
151 Stdout("struct pangoScriptIter is null on constructor").newline
;
155 printf("struct pangoScriptIter is null on constructor");
162 assert(pangoScriptIter
!is null, "struct pangoScriptIter is null on constructor");
164 this.pangoScriptIter
= pangoScriptIter
;
174 * Looks up the PangoScript for a particular character (as defined by
175 * Unicode Standard Annex 24). No check is made for ch being a
176 * valid Unicode character; if you pass in invalid character, the
177 * result is undefined.
179 * a Unicode character
181 * the PangoScript for the character.
184 public static PangoScript
pangoScriptForUnichar(gunichar ch
)
186 // PangoScript pango_script_for_unichar (gunichar ch);
187 return pango_script_for_unichar(ch
);
191 * Given a script, finds a language tag that is reasonably
192 * representative of that script. This will usually be the
193 * most widely spoken or used language written in that script:
194 * for instance, the sample language for PANGO_SCRIPT_CYRILLIC
195 * is ru (Russian), the sample language
196 * for PANGO_SCRIPT_ARABIC is ar.
198 * scripts, no sample language will be returned because there
199 * is no language that is sufficiently representative. The best
200 * example of this is PANGO_SCRIPT_HAN, where various different
201 * variants of written Chinese, Japanese, and Korean all use
202 * significantly different sets of Han characters and forms
203 * of shared characters. No sample language can be provided
204 * for many historical scripts as well.
208 * a PangoLanguage that is representative
209 * of the script, or NULL if no such language exists.
212 public static PgLanguage
pangoScriptGetSampleLanguage(PangoScript script
)
214 // PangoLanguage* pango_script_get_sample_language (PangoScript script);
215 return new PgLanguage( pango_script_get_sample_language(script
) );
219 * Determines if script is one of the scripts used to
220 * write language. The returned value is conservative;
221 * if nothing is known about the language tag language,
222 * TRUE will be returned, since, as far as Pango knows,
223 * script might be used to write language.
224 * This routine is used in Pango's itemization process when
225 * determining if a supplied language tag is relevant to
226 * a particular section of text. It probably is not useful for
227 * applications in most circumstances.
233 * TRUE if script is one of the scripts used
234 * to write language, or if nothing is known about language.
237 public static int pangoLanguageIncludesScript(PgLanguage language
, PangoScript script
)
239 // gboolean pango_language_includes_script (PangoLanguage *language, PangoScript script);
240 return pango_language_includes_script((language
is null) ?
null : language
.getPgLanguageStruct(), script
);
244 * Create a new PangoScriptIter, used to break a string of
245 * Unicode into runs by text. No copy is made of text, so
246 * the caller needs to make sure it remains valid until
247 * the iterator is freed with pango_script_iter_free().x
251 * length of text, or -1 if text is nul-terminated.
253 * the new script iterator, initialized
254 * to point at the first range in the text, which should be
255 * freed with pango_script_iter_free(). If the string is
256 * empty, it will point at an empty range.
259 public this (char[] text
, int length
)
261 // PangoScriptIter* pango_script_iter_new (const char *text, int length);
262 this(cast(PangoScriptIter
*)pango_script_iter_new(Str
.toStringz(text
), length
) );
266 * Gets information about the range to which iter currently points.
267 * The range is the set of locations p where *start <= p < *end.
268 * (That is, it doesn't include the character stored at *end)
272 * location to store start position of the range, or NULL
274 * location to store end position of the range, or NULL
276 * location to store script for range, or NULL
279 public void getRange(char** start
, char** end
, PangoScript
* script
)
281 // void pango_script_iter_get_range (PangoScriptIter *iter, G_CONST_RETURN char **start, G_CONST_RETURN char **end, PangoScript *script);
282 pango_script_iter_get_range(pangoScriptIter
, start
, end
, script
);
286 * Advances a PangoScriptIter to the next range. If iter
287 * is already at the end, it is left unchanged and FALSE
292 * TRUE if iter was successfully advanced.
297 // gboolean pango_script_iter_next (PangoScriptIter *iter);
298 return pango_script_iter_next(pangoScriptIter
);
302 * Frees a PangoScriptIter created with pango_script_iter_new().
309 // void pango_script_iter_free (PangoScriptIter *iter);
310 pango_script_iter_free(pangoScriptIter
);