1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = pango-Text-Processing.html
27  * outPack = pango
28  * outFile = PgContext
29  * strct   = PangoContext
30  * realStrct=
31  * ctorStrct=
32  * clss    = PgContext
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- pango_context_
41  * 	- pango_
42  * omit structs:
43  * omit prefixes:
44  * 	- pango_item_
45  * omit code:
46  * 	- pango_break
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- glib.ListG
51  * 	- pango.PgFont
52  * 	- pango.PgFontMap
53  * 	- pango.PgFontset
54  * 	- pango.PgFontFamily
55  * 	- pango.PgFontMetrics
56  * 	- pango.PgFontDescription
57  * 	- pango.PgLanguage
58  * 	- pango.PgMatrix
59  * 	- pango.PgAttributeList
60  * 	- pango.PgAttributeIterator
61  * 	- pango.PgGlyphString
62  * structWrap:
63  * 	- GList* -> ListG
64  * 	- PangoAttrIterator* -> PgAttributeIterator
65  * 	- PangoAttrList* -> PgAttributeList
66  * 	- PangoContext* -> PgContext
67  * 	- PangoFont* -> PgFont
68  * 	- PangoFontDescription* -> PgFontDescription
69  * 	- PangoFontFamily* -> PgFontFamily
70  * 	- PangoFontMap* -> PgFontMap
71  * 	- PangoFontMetrics* -> PgFontMetrics
72  * 	- PangoFontset* -> PgFontset
73  * 	- PangoGlyphString* -> PgGlyphString
74  * 	- PangoLanguage* -> PgLanguage
75  * 	- PangoMatrix* -> PgMatrix
76  * module aliases:
77  * local aliases:
78  * overrides:
79  */
80 
81 module pango.PgContext;
82 
83 public  import gtkc.pangotypes;
84 
85 private import gtkc.pango;
86 private import glib.ConstructionException;
87 private import gobject.ObjectG;
88 
89 
90 private import glib.Str;
91 private import glib.ListG;
92 private import pango.PgFont;
93 private import pango.PgFontMap;
94 private import pango.PgFontset;
95 private import pango.PgFontFamily;
96 private import pango.PgFontMetrics;
97 private import pango.PgFontDescription;
98 private import pango.PgLanguage;
99 private import pango.PgMatrix;
100 private import pango.PgAttributeList;
101 private import pango.PgAttributeIterator;
102 private import pango.PgGlyphString;
103 
104 
105 
106 private import gobject.ObjectG;
107 
108 /**
109  * Description
110  * The Pango rendering pipeline takes a string of
111  * Unicode characters and converts it into glyphs.
112  * The functions described in this section accomplish
113  * various steps of this process.
114  */
115 public class PgContext : ObjectG
116 {
117 	
118 	/** the main Gtk struct */
119 	protected PangoContext* pangoContext;
120 	
121 	
122 	public PangoContext* getPgContextStruct()
123 	{
124 		return pangoContext;
125 	}
126 	
127 	
128 	/** the main Gtk struct as a void* */
129 	protected override void* getStruct()
130 	{
131 		return cast(void*)pangoContext;
132 	}
133 	
134 	/**
135 	 * Sets our main struct and passes it to the parent class
136 	 */
137 	public this (PangoContext* pangoContext)
138 	{
139 		super(cast(GObject*)pangoContext);
140 		this.pangoContext = pangoContext;
141 	}
142 	
143 	protected override void setStruct(GObject* obj)
144 	{
145 		super.setStruct(obj);
146 		pangoContext = cast(PangoContext*)obj;
147 	}
148 	
149 	/**
150 	 * Determines possible line, word, and character breaks
151 	 * for a string of Unicode text with a single analysis. For most
152 	 * purposes you may want to use pango_get_log_attrs().
153 	 * Params:
154 	 * text =  the text to process
155 	 * length =  length of text in bytes (may be -1 if text is nul-terminated)
156 	 * analysis =  PangoAnalysis structure from pango_itemize()
157 	 * attrs =  an array to store character information in
158 	 * attrsLen =  size of the array passed as attrs
159 	 */
160 	public static void pangoBreak(string text, int length, PangoAnalysis* analysis, PangoLogAttr* attrs, int attrsLen)
161 	{
162 		// void pango_break (const gchar *text,  int length,  PangoAnalysis *analysis,  PangoLogAttr *attrs,  int attrs_len);
163 		pango_break(Str.toStringz(text), length, analysis, attrs, attrsLen);
164 	}
165 	
166 	/**
167 	 * Description
168 	 * Pango supports bidirectional text (like Arabic and Hebrew) automatically.
169 	 * Some applications however, need some help to correctly handle bidirectional
170 	 * text.
171 	 * The PangoDirection type can be used with pango_context_set_base_dir() to
172 	 * instruct Pango about direction of text, though in most cases Pango detects
173 	 * that correctly and automatically. The rest of the facilities in this section
174 	 * are used internally by Pango already, and are provided to help applications
175 	 * that need more direct control over bidirectional setting of text.
176 	 */
177 	
178 	/**
179 	 * Breaks a piece of text into segments with consistent
180 	 * directional level and shaping engine. Each byte of text will
181 	 * be contained in exactly one of the items in the returned list;
182 	 * the generated list of items will be in logical order (the start
183 	 * offsets of the items are ascending).
184 	 * cached_iter should be an iterator over attrs currently positioned at a
185 	 * range before or containing start_index; cached_iter will be advanced to
186 	 * the range covering the position just after start_index + length.
187 	 * (i.e. if itemizing in a loop, just keep passing in the same cached_iter).
188 	 * Params:
189 	 * text = the text to itemize.
190 	 * startIndex = first byte in text to process
191 	 * length = the number of bytes (not characters) to process
192 	 *  after start_index.
193 	 *  This must be >= 0.
194 	 * attrs = the set of attributes that apply to text.
195 	 * cachedIter = Cached attribute iterator, or NULL
196 	 * Returns: a GList of PangoItem structures.
197 	 */
198 	public ListG itemize(string text, int startIndex, int length, PgAttributeList attrs, PgAttributeIterator cachedIter)
199 	{
200 		// GList * pango_itemize (PangoContext *context,  const char *text,  int start_index,  int length,  PangoAttrList *attrs,  PangoAttrIterator *cached_iter);
201 		auto p = pango_itemize(pangoContext, Str.toStringz(text), startIndex, length, (attrs is null) ? null : attrs.getPgAttributeListStruct(), (cachedIter is null) ? null : cachedIter.getPgAttributeIteratorStruct());
202 		
203 		if(p is null)
204 		{
205 			return null;
206 		}
207 		
208 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
209 	}
210 	
211 	/**
212 	 * Like pango_itemize(), but the base direction to use when
213 	 * computing bidirectional levels (see pango_context_set_base_dir()),
214 	 * is specified explicitly rather than gotten from the PangoContext.
215 	 * Since 1.4
216 	 * Params:
217 	 * baseDir = base direction to use for bidirectional processing
218 	 * text = the text to itemize.
219 	 * startIndex = first byte in text to process
220 	 * length = the number of bytes (not characters) to process
221 	 *  after start_index.
222 	 *  This must be >= 0.
223 	 * attrs = the set of attributes that apply to text.
224 	 * cachedIter = Cached attribute iterator, or NULL
225 	 * Returns: a GList of PangoItem structures. The items should be freed using pango_item_free() probably in combination with g_list_foreach(), and the list itself using g_list_free().
226 	 */
227 	public ListG itemizeWithBaseDir(PangoDirection baseDir, string text, int startIndex, int length, PgAttributeList attrs, PgAttributeIterator cachedIter)
228 	{
229 		// GList * pango_itemize_with_base_dir (PangoContext *context,  PangoDirection base_dir,  const char *text,  int start_index,  int length,  PangoAttrList *attrs,  PangoAttrIterator *cached_iter);
230 		auto p = pango_itemize_with_base_dir(pangoContext, baseDir, Str.toStringz(text), startIndex, length, (attrs is null) ? null : attrs.getPgAttributeListStruct(), (cachedIter is null) ? null : cachedIter.getPgAttributeIteratorStruct());
231 		
232 		if(p is null)
233 		{
234 			return null;
235 		}
236 		
237 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
238 	}
239 	
240 	/**
241 	 * From a list of items in logical order and the associated
242 	 * directional levels, produce a list in visual order.
243 	 * The original list is unmodified.
244 	 * Params:
245 	 * logicalItems = a GList of PangoItem in logical order.
246 	 * Returns: a GList of PangoItem structures in visual order. (Please open a bug if you use this function. It is not a particularly convenient interface, and the code is duplicated elsewhere in Pango for that reason.)
247 	 */
248 	public static ListG reorderItems(ListG logicalItems)
249 	{
250 		// GList * pango_reorder_items (GList *logical_items);
251 		auto p = pango_reorder_items((logicalItems is null) ? null : logicalItems.getListGStruct());
252 		
253 		if(p is null)
254 		{
255 			return null;
256 		}
257 		
258 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
259 	}
260 	
261 	/**
262 	 * Creates a new PangoContext initialized to default values.
263 	 * This function is not particularly useful as it should always
264 	 * be followed by a pango_context_set_font_map() call, and the
265 	 * function pango_font_map_create_context() does these two steps
266 	 * together and hence users are recommended to use that.
267 	 * If you are using Pango as part of a higher-level system,
268 	 * that system may have it's own way of create a PangoContext.
269 	 * For instance, the GTK+ toolkit has, among others,
270 	 * gdk_pango_context_get_for_screen(), and
271 	 * gtk_widget_get_pango_context(). Use those instead.
272 	 * Throws: ConstructionException GTK+ fails to create the object.
273 	 */
274 	public this ()
275 	{
276 		// PangoContext * pango_context_new (void);
277 		auto p = pango_context_new();
278 		if(p is null)
279 		{
280 			throw new ConstructionException("null returned by pango_context_new()");
281 		}
282 		this(cast(PangoContext*) p);
283 	}
284 	
285 	/**
286 	 * Sets the font map to be searched when fonts are looked-up in this context.
287 	 * This is only for internal use by Pango backends, a PangoContext obtained
288 	 * via one of the recommended methods should already have a suitable font map.
289 	 * Params:
290 	 * fontMap = the PangoFontMap to set.
291 	 */
292 	public void setFontMap(PgFontMap fontMap)
293 	{
294 		// void pango_context_set_font_map (PangoContext *context,  PangoFontMap *font_map);
295 		pango_context_set_font_map(pangoContext, (fontMap is null) ? null : fontMap.getPgFontMapStruct());
296 	}
297 	
298 	/**
299 	 * Gets the PangoFontmap used to look up fonts for this context.
300 	 * Since 1.6
301 	 * Returns: the font map for the PangoContext. This value is owned by Pango and should not be unreferenced.
302 	 */
303 	public PgFontMap getFontMap()
304 	{
305 		// PangoFontMap * pango_context_get_font_map (PangoContext *context);
306 		auto p = pango_context_get_font_map(pangoContext);
307 		
308 		if(p is null)
309 		{
310 			return null;
311 		}
312 		
313 		return ObjectG.getDObject!(PgFontMap)(cast(PangoFontMap*) p);
314 	}
315 	
316 	/**
317 	 * Retrieve the default font description for the context.
318 	 * Returns: a pointer to the context's default font description. This value must not be modified or freed.
319 	 */
320 	public PgFontDescription getFontDescription()
321 	{
322 		// PangoFontDescription * pango_context_get_font_description  (PangoContext *context);
323 		auto p = pango_context_get_font_description(pangoContext);
324 		
325 		if(p is null)
326 		{
327 			return null;
328 		}
329 		
330 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
331 	}
332 	
333 	/**
334 	 * Set the default font description for the context
335 	 * Params:
336 	 * desc = the new pango font description
337 	 */
338 	public void setFontDescription(PgFontDescription desc)
339 	{
340 		// void pango_context_set_font_description (PangoContext *context,  const PangoFontDescription *desc);
341 		pango_context_set_font_description(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct());
342 	}
343 	
344 	/**
345 	 * Retrieves the global language tag for the context.
346 	 * Returns: the global language tag.
347 	 */
348 	public PgLanguage getLanguage()
349 	{
350 		// PangoLanguage * pango_context_get_language (PangoContext *context);
351 		auto p = pango_context_get_language(pangoContext);
352 		
353 		if(p is null)
354 		{
355 			return null;
356 		}
357 		
358 		return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p);
359 	}
360 	
361 	/**
362 	 * Sets the global language tag for the context. The default language
363 	 * for the locale of the running process can be found using
364 	 * pango_language_get_default().
365 	 * Params:
366 	 * language = the new language tag.
367 	 */
368 	public void setLanguage(PgLanguage language)
369 	{
370 		// void pango_context_set_language (PangoContext *context,  PangoLanguage *language);
371 		pango_context_set_language(pangoContext, (language is null) ? null : language.getPgLanguageStruct());
372 	}
373 	
374 	/**
375 	 * Retrieves the base direction for the context. See
376 	 * pango_context_set_base_dir().
377 	 * Returns: the base direction for the context.
378 	 */
379 	public PangoDirection getBaseDir()
380 	{
381 		// PangoDirection pango_context_get_base_dir (PangoContext *context);
382 		return pango_context_get_base_dir(pangoContext);
383 	}
384 	
385 	/**
386 	 * Sets the base direction for the context.
387 	 * The base direction is used in applying the Unicode bidirectional
388 	 * algorithm; if the direction is PANGO_DIRECTION_LTR or
389 	 * PANGO_DIRECTION_RTL, then the value will be used as the paragraph
390 	 * direction in the Unicode bidirectional algorithm. A value of
391 	 * PANGO_DIRECTION_WEAK_LTR or PANGO_DIRECTION_WEAK_RTL is used only
392 	 * for paragraphs that do not contain any strong characters themselves.
393 	 * Params:
394 	 * direction = the new base direction
395 	 */
396 	public void setBaseDir(PangoDirection direction)
397 	{
398 		// void pango_context_set_base_dir (PangoContext *context,  PangoDirection direction);
399 		pango_context_set_base_dir(pangoContext, direction);
400 	}
401 	
402 	/**
403 	 * Retrieves the base gravity for the context. See
404 	 * pango_context_set_base_gravity().
405 	 * Since 1.16
406 	 * Returns: the base gravity for the context.
407 	 */
408 	public PangoGravity getBaseGravity()
409 	{
410 		// PangoGravity pango_context_get_base_gravity (PangoContext *context);
411 		return pango_context_get_base_gravity(pangoContext);
412 	}
413 	
414 	/**
415 	 * Sets the base gravity for the context.
416 	 * The base gravity is used in laying vertical text out.
417 	 * Since 1.16
418 	 * Params:
419 	 * gravity = the new base gravity
420 	 */
421 	public void setBaseGravity(PangoGravity gravity)
422 	{
423 		// void pango_context_set_base_gravity (PangoContext *context,  PangoGravity gravity);
424 		pango_context_set_base_gravity(pangoContext, gravity);
425 	}
426 	
427 	/**
428 	 * Retrieves the gravity for the context. This is similar to
429 	 * pango_context_get_base_gravity(), except for when the base gravity
430 	 * is PANGO_GRAVITY_AUTO for which pango_gravity_get_for_matrix() is used
431 	 * to return the gravity from the current context matrix.
432 	 * Since 1.16
433 	 * Returns: the resolved gravity for the context.
434 	 */
435 	public PangoGravity getGravity()
436 	{
437 		// PangoGravity pango_context_get_gravity (PangoContext *context);
438 		return pango_context_get_gravity(pangoContext);
439 	}
440 	
441 	/**
442 	 * Retrieves the gravity hint for the context. See
443 	 * pango_context_set_gravity_hint() for details.
444 	 * Since 1.16
445 	 * Returns: the gravity hint for the context.
446 	 */
447 	public PangoGravityHint getGravityHint()
448 	{
449 		// PangoGravityHint pango_context_get_gravity_hint (PangoContext *context);
450 		return pango_context_get_gravity_hint(pangoContext);
451 	}
452 	
453 	/**
454 	 * Sets the gravity hint for the context.
455 	 * The gravity hint is used in laying vertical text out, and is only relevant
456 	 * if gravity of the context as returned by pango_context_get_gravity()
457 	 * is set PANGO_GRAVITY_EAST or PANGO_GRAVITY_WEST.
458 	 * Since 1.16
459 	 * Params:
460 	 * hint = the new gravity hint
461 	 */
462 	public void setGravityHint(PangoGravityHint hint)
463 	{
464 		// void pango_context_set_gravity_hint (PangoContext *context,  PangoGravityHint hint);
465 		pango_context_set_gravity_hint(pangoContext, hint);
466 	}
467 	
468 	/**
469 	 * Gets the transformation matrix that will be applied when
470 	 * rendering with this context. See pango_context_set_matrix().
471 	 * Since 1.6
472 	 * Returns: the matrix, or NULL if no matrix has been set (which is the same as the identity matrix). The returned matrix is owned by Pango and must not be modified or freed.
473 	 */
474 	public PgMatrix getMatrix()
475 	{
476 		// const PangoMatrix * pango_context_get_matrix (PangoContext *context);
477 		auto p = pango_context_get_matrix(pangoContext);
478 		
479 		if(p is null)
480 		{
481 			return null;
482 		}
483 		
484 		return ObjectG.getDObject!(PgMatrix)(cast(PangoMatrix*) p);
485 	}
486 	
487 	/**
488 	 * Sets the transformation matrix that will be applied when rendering
489 	 * with this context. Note that reported metrics are in the user space
490 	 * coordinates before the application of the matrix, not device-space
491 	 * coordinates after the application of the matrix. So, they don't scale
492 	 * with the matrix, though they may change slightly for different
493 	 * matrices, depending on how the text is fit to the pixel grid.
494 	 * Since 1.6
495 	 * Params:
496 	 * matrix = a PangoMatrix, or NULL to unset any existing matrix.
497 	 *  (No matrix set is the same as setting the identity matrix.)
498 	 */
499 	public void setMatrix(PgMatrix matrix)
500 	{
501 		// void pango_context_set_matrix (PangoContext *context,  const PangoMatrix *matrix);
502 		pango_context_set_matrix(pangoContext, (matrix is null) ? null : matrix.getPgMatrixStruct());
503 	}
504 	
505 	/**
506 	 * Loads the font in one of the fontmaps in the context
507 	 * that is the closest match for desc.
508 	 * Params:
509 	 * desc = a PangoFontDescription describing the font to load
510 	 * Returns: the font loaded, or NULL if no font matched.
511 	 */
512 	public PgFont loadFont(PgFontDescription desc)
513 	{
514 		// PangoFont * pango_context_load_font (PangoContext *context,  const PangoFontDescription *desc);
515 		auto p = pango_context_load_font(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct());
516 		
517 		if(p is null)
518 		{
519 			return null;
520 		}
521 		
522 		return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p);
523 	}
524 	
525 	/**
526 	 * Load a set of fonts in the context that can be used to render
527 	 * a font matching desc.
528 	 * Params:
529 	 * desc = a PangoFontDescription describing the fonts to load
530 	 * language = a PangoLanguage the fonts will be used for
531 	 * Returns: the fontset, or NULL if no font matched.
532 	 */
533 	public PgFontset loadFontset(PgFontDescription desc, PgLanguage language)
534 	{
535 		// PangoFontset * pango_context_load_fontset (PangoContext *context,  const PangoFontDescription *desc,  PangoLanguage *language);
536 		auto p = pango_context_load_fontset(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct(), (language is null) ? null : language.getPgLanguageStruct());
537 		
538 		if(p is null)
539 		{
540 			return null;
541 		}
542 		
543 		return ObjectG.getDObject!(PgFontset)(cast(PangoFontset*) p);
544 	}
545 	
546 	/**
547 	 * Get overall metric information for a particular font
548 	 * description. Since the metrics may be substantially different for
549 	 * different scripts, a language tag can be provided to indicate that
550 	 * the metrics should be retrieved that correspond to the script(s)
551 	 * used by that language.
552 	 * The PangoFontDescription is interpreted in the same way as
553 	 * by pango_itemize(), and the family name may be a comma separated
554 	 * list of figures. If characters from multiple of these families
555 	 * would be used to render the string, then the returned fonts would
556 	 * be a composite of the metrics for the fonts loaded for the
557 	 * individual families.
558 	 * Params:
559 	 * desc = a PangoFontDescription structure. NULL means that the font
560 	 * 	 description from the context will be used.
561 	 * language = language tag used to determine which script to get the metrics
562 	 *  for. NULL means that the language tag from the context will
563 	 *  be used. If no language tag is set on the context, metrics
564 	 *  for the default language (as determined by
565 	 *  pango_language_get_default()) will be returned.
566 	 * Returns: a PangoFontMetrics object. The caller must call pango_font_metrics_unref() when finished using the object.
567 	 */
568 	public PgFontMetrics getMetrics(PgFontDescription desc, PgLanguage language)
569 	{
570 		// PangoFontMetrics * pango_context_get_metrics (PangoContext *context,  const PangoFontDescription *desc,  PangoLanguage *language);
571 		auto p = pango_context_get_metrics(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct(), (language is null) ? null : language.getPgLanguageStruct());
572 		
573 		if(p is null)
574 		{
575 			return null;
576 		}
577 		
578 		return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p);
579 	}
580 	
581 	/**
582 	 * List all families for a context.
583 	 * Params:
584 	 * families = location to store a pointer to an array of PangoFontFamily *.
585 	 *  This array should be freed with g_free().
586 	 */
587 	public void listFamilies(out PgFontFamily[] families)
588 	{
589 		// void pango_context_list_families (PangoContext *context,  PangoFontFamily ***families,  int *n_families);
590 		PangoFontFamily** outfamilies = null;
591 		int nFamilies;
592 		
593 		pango_context_list_families(pangoContext, &outfamilies, &nFamilies);
594 		
595 		
596 		families = new PgFontFamily[nFamilies];
597 		for(int i = 0; i < nFamilies; i++)
598 		{
599 			families[i] = ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) outfamilies[i]);
600 		}
601 	}
602 	
603 	/**
604 	 * Computes a PangoLogAttr for each character in text. The log_attrs
605 	 * array must have one PangoLogAttr for each position in text; if
606 	 * text contains N characters, it has N+1 positions, including the
607 	 * last position at the end of the text. text should be an entire
608 	 * paragraph; logical attributes can't be computed without context
609 	 * (for example you need to see spaces on either side of a word to know
610 	 * the word is a word).
611 	 * Params:
612 	 * text = text to process
613 	 * length = length in bytes of text
614 	 * level = embedding level, or -1 if unknown
615 	 * language = language tag
616 	 * logAttrs = array with one PangoLogAttr per character in text, plus one extra, to be filled in
617 	 * attrsLen = length of log_attrs array
618 	 */
619 	public static void getLogAttrs(string text, int length, int level, PgLanguage language, PangoLogAttr* logAttrs, int attrsLen)
620 	{
621 		// void pango_get_log_attrs (const char *text,  int length,  int level,  PangoLanguage *language,  PangoLogAttr *log_attrs,  int attrs_len);
622 		pango_get_log_attrs(Str.toStringz(text), length, level, (language is null) ? null : language.getPgLanguageStruct(), logAttrs, attrsLen);
623 	}
624 	
625 	/**
626 	 * Locates a paragraph boundary in text. A boundary is caused by
627 	 * delimiter characters, such as a newline, carriage return, carriage
628 	 * return-newline pair, or Unicode paragraph separator character. The
629 	 * index of the run of delimiters is returned in
630 	 * paragraph_delimiter_index. The index of the start of the paragraph
631 	 * (index after all delimiters) is stored in next_paragraph_start.
632 	 * If no delimiters are found, both paragraph_delimiter_index and
633 	 * next_paragraph_start are filled with the length of text (an index one
634 	 * off the end).
635 	 * Params:
636 	 * text = UTF-8 text
637 	 * length = length of text in bytes, or -1 if nul-terminated
638 	 * paragraphDelimiterIndex = return location for index of delimiter
639 	 * nextParagraphStart = return location for start of next paragraph
640 	 */
641 	public static void findParagraphBoundary(string text, int length, out int paragraphDelimiterIndex, out int nextParagraphStart)
642 	{
643 		// void pango_find_paragraph_boundary (const gchar *text,  gint length,  gint *paragraph_delimiter_index,  gint *next_paragraph_start);
644 		pango_find_paragraph_boundary(Str.toStringz(text), length, &paragraphDelimiterIndex, &nextParagraphStart);
645 	}
646 	
647 	/**
648 	 * This is the default break algorithm, used if no language
649 	 * engine overrides it. Normally you should use pango_break()
650 	 * instead. Unlike pango_break(),
651 	 * analysis can be NULL, but only do that if you know what
652 	 * you're doing. If you need an analysis to pass to pango_break(),
653 	 * you need to pango_itemize(). In most cases however you should
654 	 * simply use pango_get_log_attrs().
655 	 * Params:
656 	 * text = text to break
657 	 * length = length of text in bytes (may be -1 if text is nul-terminated)
658 	 * analysis = a PangoAnalysis for the text
659 	 * attrs = logical attributes to fill in
660 	 * attrsLen = size of the array passed as attrs
661 	 */
662 	public static void defaultBreak(string text, int length, PangoAnalysis* analysis, PangoLogAttr* attrs, int attrsLen)
663 	{
664 		// void pango_default_break (const gchar *text,  int length,  PangoAnalysis *analysis,  PangoLogAttr *attrs,  int attrs_len);
665 		pango_default_break(Str.toStringz(text), length, analysis, attrs, attrsLen);
666 	}
667 	
668 	/**
669 	 * Given a segment of text and the corresponding
670 	 * PangoAnalysis structure returned from pango_itemize(),
671 	 * convert the characters into glyphs. You may also pass
672 	 * in only a substring of the item from pango_itemize().
673 	 * Params:
674 	 * text = the text to process
675 	 * length = the length (in bytes) of text
676 	 * analysis = PangoAnalysis structure from pango_itemize()
677 	 * glyphs = glyph string in which to store results
678 	 */
679 	public static void shape(string text, int length, PangoAnalysis* analysis, PgGlyphString glyphs)
680 	{
681 		// void pango_shape (const gchar *text,  gint length,  const PangoAnalysis *analysis,  PangoGlyphString *glyphs);
682 		pango_shape(Str.toStringz(text), length, analysis, (glyphs is null) ? null : glyphs.getPgGlyphStringStruct());
683 	}
684 	
685 	/**
686 	 * Determines the inherent direction of a character; either
687 	 * PANGO_DIRECTION_LTR, PANGO_DIRECTION_RTL, or
688 	 * PANGO_DIRECTION_NEUTRAL.
689 	 * This function is useful to categorize characters into left-to-right
690 	 * letters, right-to-left letters, and everything else. If full
691 	 * Unicode bidirectional type of a character is needed,
692 	 * pango_bidi_type_for_gunichar() can be used instead.
693 	 * Params:
694 	 * ch = a Unicode character
695 	 * Returns: the direction of the character.
696 	 */
697 	public static PangoDirection unicharDirection(gunichar ch)
698 	{
699 		// PangoDirection pango_unichar_direction (gunichar ch);
700 		return pango_unichar_direction(ch);
701 	}
702 	
703 	/**
704 	 * Searches a string the first character that has a strong
705 	 * direction, according to the Unicode bidirectional algorithm.
706 	 * Since 1.4
707 	 * Params:
708 	 * text = the text to process
709 	 * length = length of text in bytes (may be -1 if text is nul-terminated)
710 	 * Returns: The direction corresponding to the first strong character. If no such character is found, then PANGO_DIRECTION_NEUTRAL is returned.
711 	 */
712 	public static PangoDirection findBaseDir(string text, int length)
713 	{
714 		// PangoDirection pango_find_base_dir (const gchar *text,  gint length);
715 		return pango_find_base_dir(Str.toStringz(text), length);
716 	}
717 	
718 	/**
719 	 * Warning
720 	 * pango_get_mirror_char is deprecated and should not be used in newly-written code.
721 	 * If ch has the Unicode mirrored property and there is another Unicode
722 	 * character that typically has a glyph that is the mirror image of ch's
723 	 * glyph, puts that character in the address pointed to by mirrored_ch.
724 	 * Use g_unichar_get_mirror_char() instead; the docs for that function
725 	 * provide full details.
726 	 * Params:
727 	 * ch = a Unicode character
728 	 * mirroredCh = location to store the mirrored character
729 	 * Returns: TRUE if ch has a mirrored character and mirrored_ch is filled in, FALSE otherwise
730 	 */
731 	public static int getMirrorChar(gunichar ch, gunichar* mirroredCh)
732 	{
733 		// gboolean pango_get_mirror_char (gunichar ch,  gunichar *mirrored_ch);
734 		return pango_get_mirror_char(ch, mirroredCh);
735 	}
736 	
737 	/**
738 	 * Determines the normative bidirectional character type of a
739 	 * character, as specified in the Unicode Character Database.
740 	 * A simplified version of this function is available as
741 	 * pango_unichar_get_direction().
742 	 * Since 1.22
743 	 * Params:
744 	 * ch = a Unicode character
745 	 * Returns: the bidirectional character type, as used in the Unicode bidirectional algorithm.
746 	 */
747 	public static PangoBidiType bidiTypeForUnichar(gunichar ch)
748 	{
749 		// PangoBidiType pango_bidi_type_for_unichar (gunichar ch);
750 		return pango_bidi_type_for_unichar(ch);
751 	}
752 }