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  * The Pango rendering pipeline takes a string of
110  * Unicode characters and converts it into glyphs.
111  * The functions described in this section accomplish
112  * various steps of this process.
113  */
114 public class PgContext : ObjectG
115 {
116 	
117 	/** the main Gtk struct */
118 	protected PangoContext* pangoContext;
119 	
120 	
121 	public PangoContext* getPgContextStruct()
122 	{
123 		return pangoContext;
124 	}
125 	
126 	
127 	/** the main Gtk struct as a void* */
128 	protected override void* getStruct()
129 	{
130 		return cast(void*)pangoContext;
131 	}
132 	
133 	/**
134 	 * Sets our main struct and passes it to the parent class
135 	 */
136 	public this (PangoContext* pangoContext)
137 	{
138 		super(cast(GObject*)pangoContext);
139 		this.pangoContext = pangoContext;
140 	}
141 	
142 	protected override void setStruct(GObject* obj)
143 	{
144 		super.setStruct(obj);
145 		pangoContext = cast(PangoContext*)obj;
146 	}
147 	
148 	/**
149 	 * Determines possible line, word, and character breaks
150 	 * for a string of Unicode text with a single analysis. For most
151 	 * purposes you may want to use pango_get_log_attrs().
152 	 * Params:
153 	 * text =  the text to process
154 	 * length =  length of text in bytes (may be -1 if text is nul-terminated)
155 	 * analysis =  PangoAnalysis structure from pango_itemize()
156 	 * attrs =  an array to store character information in
157 	 * attrsLen =  size of the array passed as attrs
158 	 */
159 	public static void pangoBreak(string text, int length, PangoAnalysis* analysis, PangoLogAttr* attrs, int attrsLen)
160 	{
161 		// void pango_break (const gchar *text,  int length,  PangoAnalysis *analysis,  PangoLogAttr *attrs,  int attrs_len);
162 		pango_break(Str.toStringz(text), length, analysis, attrs, attrsLen);
163 	}
164 	
165 	/**
166 	 * Pango supports bidirectional text (like Arabic and Hebrew) automatically.
167 	 * Some applications however, need some help to correctly handle bidirectional
168 	 * text.
169 	 *
170 	 * The PangoDirection type can be used with pango_context_set_base_dir() to
171 	 * instruct Pango about direction of text, though in most cases Pango detects
172 	 * that correctly and automatically. The rest of the facilities in this section
173 	 * are used internally by Pango already, and are provided to help applications
174 	 * that need more direct control over bidirectional setting of text.
175 	 */
176 	
177 	/**
178 	 * Breaks a piece of text into segments with consistent
179 	 * directional level and shaping engine. Each byte of text will
180 	 * be contained in exactly one of the items in the returned list;
181 	 * the generated list of items will be in logical order (the start
182 	 * offsets of the items are ascending).
183 	 * cached_iter should be an iterator over attrs currently positioned at a
184 	 * range before or containing start_index; cached_iter will be advanced to
185 	 * the range covering the position just after start_index + length.
186 	 * (i.e. if itemizing in a loop, just keep passing in the same cached_iter).
187 	 * Params:
188 	 * text = the text to itemize.
189 	 * startIndex = first byte in text to process
190 	 * length = the number of bytes (not characters) to process
191 	 * after start_index.
192 	 * This must be >= 0.
193 	 * attrs = the set of attributes that apply to text.
194 	 * cachedIter = Cached attribute iterator, or NULL. [allow-none]
195 	 * 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(). [transfer full][element-type Pango.Item]
196 	 */
197 	public ListG itemize(string text, int startIndex, int length, PgAttributeList attrs, PgAttributeIterator cachedIter)
198 	{
199 		// GList * pango_itemize (PangoContext *context,  const char *text,  int start_index,  int length,  PangoAttrList *attrs,  PangoAttrIterator *cached_iter);
200 		auto p = pango_itemize(pangoContext, Str.toStringz(text), startIndex, length, (attrs is null) ? null : attrs.getPgAttributeListStruct(), (cachedIter is null) ? null : cachedIter.getPgAttributeIteratorStruct());
201 		
202 		if(p is null)
203 		{
204 			return null;
205 		}
206 		
207 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
208 	}
209 	
210 	/**
211 	 * Like pango_itemize(), but the base direction to use when
212 	 * computing bidirectional levels (see pango_context_set_base_dir()),
213 	 * is specified explicitly rather than gotten from the PangoContext.
214 	 * Since 1.4
215 	 * Params:
216 	 * baseDir = base direction to use for bidirectional processing
217 	 * text = the text to itemize.
218 	 * startIndex = first byte in text to process
219 	 * length = the number of bytes (not characters) to process
220 	 * after start_index. This must be >= 0.
221 	 * attrs = the set of attributes that apply to text.
222 	 * cachedIter = Cached attribute iterator, or NULL. [allow-none]
223 	 * 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(). [transfer full][element-type Pango.Item]
224 	 */
225 	public ListG itemizeWithBaseDir(PangoDirection baseDir, string text, int startIndex, int length, PgAttributeList attrs, PgAttributeIterator cachedIter)
226 	{
227 		// GList * pango_itemize_with_base_dir (PangoContext *context,  PangoDirection base_dir,  const char *text,  int start_index,  int length,  PangoAttrList *attrs,  PangoAttrIterator *cached_iter);
228 		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());
229 		
230 		if(p is null)
231 		{
232 			return null;
233 		}
234 		
235 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
236 	}
237 	
238 	/**
239 	 * From a list of items in logical order and the associated
240 	 * directional levels, produce a list in visual order.
241 	 * The original list is unmodified.
242 	 * Params:
243 	 * logicalItems = a GList of PangoItem in logical order. [element-type Pango.Item]
244 	 * 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.). [transfer full][element-type Pango.Item]
245 	 */
246 	public static ListG reorderItems(ListG logicalItems)
247 	{
248 		// GList * pango_reorder_items (GList *logical_items);
249 		auto p = pango_reorder_items((logicalItems is null) ? null : logicalItems.getListGStruct());
250 		
251 		if(p is null)
252 		{
253 			return null;
254 		}
255 		
256 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
257 	}
258 	
259 	/**
260 	 * Creates a new PangoContext initialized to default values.
261 	 * This function is not particularly useful as it should always
262 	 * be followed by a pango_context_set_font_map() call, and the
263 	 * function pango_font_map_create_context() does these two steps
264 	 * together and hence users are recommended to use that.
265 	 * If you are using Pango as part of a higher-level system,
266 	 * that system may have it's own way of create a PangoContext.
267 	 * For instance, the GTK+ toolkit has, among others,
268 	 * gdk_pango_context_get_for_screen(), and
269 	 * gtk_widget_get_pango_context(). Use those instead.
270 	 * Throws: ConstructionException GTK+ fails to create the object.
271 	 */
272 	public this ()
273 	{
274 		// PangoContext * pango_context_new (void);
275 		auto p = pango_context_new();
276 		if(p is null)
277 		{
278 			throw new ConstructionException("null returned by pango_context_new()");
279 		}
280 		this(cast(PangoContext*) p);
281 	}
282 	
283 	/**
284 	 * Forces a change in the context, which will cause any PangoLayout
285 	 * using this context to re-layout.
286 	 * This function is only useful when implementing a new backend
287 	 * for Pango, something applications won't do. Backends should
288 	 * call this function if they have attached extra data to the context
289 	 * and such data is changed.
290 	 * Since 1.32.4
291 	 */
292 	public void changed()
293 	{
294 		// void pango_context_changed (PangoContext *context);
295 		pango_context_changed(pangoContext);
296 	}
297 	
298 	/**
299 	 * Returns the current serial number of context. The serial number is
300 	 * initialized to an small number larger than zero when a new context
301 	 * is created and is increased whenever the context is changed using any
302 	 * of the setter functions, or the PangoFontMap it uses to find fonts has
303 	 * changed. The serial may wrap, but will never have the value 0. Since it
304 	 * can wrap, never compare it with "less than", always use "not equals".
305 	 * This can be used to automatically detect changes to a PangoContext, and
306 	 * is only useful when implementing objects that need update when their
307 	 * PangoContext changes, like PangoLayout.
308 	 * Since 1.32.4
309 	 * Returns: The current serial number of context.
310 	 */
311 	public uint getSerial()
312 	{
313 		// guint pango_context_get_serial (PangoContext *context);
314 		return pango_context_get_serial(pangoContext);
315 	}
316 	
317 	/**
318 	 * Sets the font map to be searched when fonts are looked-up in this context.
319 	 * This is only for internal use by Pango backends, a PangoContext obtained
320 	 * via one of the recommended methods should already have a suitable font map.
321 	 * Params:
322 	 * fontMap = the PangoFontMap to set.
323 	 */
324 	public void setFontMap(PgFontMap fontMap)
325 	{
326 		// void pango_context_set_font_map (PangoContext *context,  PangoFontMap *font_map);
327 		pango_context_set_font_map(pangoContext, (fontMap is null) ? null : fontMap.getPgFontMapStruct());
328 	}
329 	
330 	/**
331 	 * Gets the PangoFontmap used to look up fonts for this context.
332 	 * Since 1.6
333 	 * Returns: the font map for the PangoContext. This value is owned by Pango and should not be unreferenced. [transfer none]
334 	 */
335 	public PgFontMap getFontMap()
336 	{
337 		// PangoFontMap * pango_context_get_font_map (PangoContext *context);
338 		auto p = pango_context_get_font_map(pangoContext);
339 		
340 		if(p is null)
341 		{
342 			return null;
343 		}
344 		
345 		return ObjectG.getDObject!(PgFontMap)(cast(PangoFontMap*) p);
346 	}
347 	
348 	/**
349 	 * Retrieve the default font description for the context.
350 	 * Returns: a pointer to the context's default font description. This value must not be modified or freed. [transfer none]
351 	 */
352 	public PgFontDescription getFontDescription()
353 	{
354 		// PangoFontDescription * pango_context_get_font_description  (PangoContext *context);
355 		auto p = pango_context_get_font_description(pangoContext);
356 		
357 		if(p is null)
358 		{
359 			return null;
360 		}
361 		
362 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
363 	}
364 	
365 	/**
366 	 * Set the default font description for the context
367 	 * Params:
368 	 * desc = the new pango font description
369 	 */
370 	public void setFontDescription(PgFontDescription desc)
371 	{
372 		// void pango_context_set_font_description (PangoContext *context,  const PangoFontDescription *desc);
373 		pango_context_set_font_description(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct());
374 	}
375 	
376 	/**
377 	 * Retrieves the global language tag for the context.
378 	 * Returns: the global language tag.
379 	 */
380 	public PgLanguage getLanguage()
381 	{
382 		// PangoLanguage * pango_context_get_language (PangoContext *context);
383 		auto p = pango_context_get_language(pangoContext);
384 		
385 		if(p is null)
386 		{
387 			return null;
388 		}
389 		
390 		return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p);
391 	}
392 	
393 	/**
394 	 * Sets the global language tag for the context. The default language
395 	 * for the locale of the running process can be found using
396 	 * pango_language_get_default().
397 	 * Params:
398 	 * language = the new language tag.
399 	 */
400 	public void setLanguage(PgLanguage language)
401 	{
402 		// void pango_context_set_language (PangoContext *context,  PangoLanguage *language);
403 		pango_context_set_language(pangoContext, (language is null) ? null : language.getPgLanguageStruct());
404 	}
405 	
406 	/**
407 	 * Retrieves the base direction for the context. See
408 	 * pango_context_set_base_dir().
409 	 * Returns: the base direction for the context.
410 	 */
411 	public PangoDirection getBaseDir()
412 	{
413 		// PangoDirection pango_context_get_base_dir (PangoContext *context);
414 		return pango_context_get_base_dir(pangoContext);
415 	}
416 	
417 	/**
418 	 * Sets the base direction for the context.
419 	 * The base direction is used in applying the Unicode bidirectional
420 	 * algorithm; if the direction is PANGO_DIRECTION_LTR or
421 	 * PANGO_DIRECTION_RTL, then the value will be used as the paragraph
422 	 * direction in the Unicode bidirectional algorithm. A value of
423 	 * PANGO_DIRECTION_WEAK_LTR or PANGO_DIRECTION_WEAK_RTL is used only
424 	 * for paragraphs that do not contain any strong characters themselves.
425 	 * Params:
426 	 * direction = the new base direction
427 	 */
428 	public void setBaseDir(PangoDirection direction)
429 	{
430 		// void pango_context_set_base_dir (PangoContext *context,  PangoDirection direction);
431 		pango_context_set_base_dir(pangoContext, direction);
432 	}
433 	
434 	/**
435 	 * Retrieves the base gravity for the context. See
436 	 * pango_context_set_base_gravity().
437 	 * Since 1.16
438 	 * Returns: the base gravity for the context.
439 	 */
440 	public PangoGravity getBaseGravity()
441 	{
442 		// PangoGravity pango_context_get_base_gravity (PangoContext *context);
443 		return pango_context_get_base_gravity(pangoContext);
444 	}
445 	
446 	/**
447 	 * Sets the base gravity for the context.
448 	 * The base gravity is used in laying vertical text out.
449 	 * Since 1.16
450 	 * Params:
451 	 * gravity = the new base gravity
452 	 */
453 	public void setBaseGravity(PangoGravity gravity)
454 	{
455 		// void pango_context_set_base_gravity (PangoContext *context,  PangoGravity gravity);
456 		pango_context_set_base_gravity(pangoContext, gravity);
457 	}
458 	
459 	/**
460 	 * Retrieves the gravity for the context. This is similar to
461 	 * pango_context_get_base_gravity(), except for when the base gravity
462 	 * is PANGO_GRAVITY_AUTO for which pango_gravity_get_for_matrix() is used
463 	 * to return the gravity from the current context matrix.
464 	 * Since 1.16
465 	 * Returns: the resolved gravity for the context.
466 	 */
467 	public PangoGravity getGravity()
468 	{
469 		// PangoGravity pango_context_get_gravity (PangoContext *context);
470 		return pango_context_get_gravity(pangoContext);
471 	}
472 	
473 	/**
474 	 * Retrieves the gravity hint for the context. See
475 	 * pango_context_set_gravity_hint() for details.
476 	 * Since 1.16
477 	 * Returns: the gravity hint for the context.
478 	 */
479 	public PangoGravityHint getGravityHint()
480 	{
481 		// PangoGravityHint pango_context_get_gravity_hint (PangoContext *context);
482 		return pango_context_get_gravity_hint(pangoContext);
483 	}
484 	
485 	/**
486 	 * Sets the gravity hint for the context.
487 	 * The gravity hint is used in laying vertical text out, and is only relevant
488 	 * if gravity of the context as returned by pango_context_get_gravity()
489 	 * is set PANGO_GRAVITY_EAST or PANGO_GRAVITY_WEST.
490 	 * Since 1.16
491 	 * Params:
492 	 * hint = the new gravity hint
493 	 */
494 	public void setGravityHint(PangoGravityHint hint)
495 	{
496 		// void pango_context_set_gravity_hint (PangoContext *context,  PangoGravityHint hint);
497 		pango_context_set_gravity_hint(pangoContext, hint);
498 	}
499 	
500 	/**
501 	 * Gets the transformation matrix that will be applied when
502 	 * rendering with this context. See pango_context_set_matrix().
503 	 * Since 1.6
504 	 * 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.
505 	 */
506 	public PgMatrix getMatrix()
507 	{
508 		// const PangoMatrix * pango_context_get_matrix (PangoContext *context);
509 		auto p = pango_context_get_matrix(pangoContext);
510 		
511 		if(p is null)
512 		{
513 			return null;
514 		}
515 		
516 		return ObjectG.getDObject!(PgMatrix)(cast(PangoMatrix*) p);
517 	}
518 	
519 	/**
520 	 * Sets the transformation matrix that will be applied when rendering
521 	 * with this context. Note that reported metrics are in the user space
522 	 * coordinates before the application of the matrix, not device-space
523 	 * coordinates after the application of the matrix. So, they don't scale
524 	 * with the matrix, though they may change slightly for different
525 	 * matrices, depending on how the text is fit to the pixel grid.
526 	 * Since 1.6
527 	 * Params:
528 	 * matrix = a PangoMatrix, or NULL to unset any existing
529 	 * matrix. (No matrix set is the same as setting the identity matrix.). [allow-none]
530 	 */
531 	public void setMatrix(PgMatrix matrix)
532 	{
533 		// void pango_context_set_matrix (PangoContext *context,  const PangoMatrix *matrix);
534 		pango_context_set_matrix(pangoContext, (matrix is null) ? null : matrix.getPgMatrixStruct());
535 	}
536 	
537 	/**
538 	 * Loads the font in one of the fontmaps in the context
539 	 * that is the closest match for desc.
540 	 * Params:
541 	 * desc = a PangoFontDescription describing the font to load
542 	 * Returns: the newly allocated PangoFont that was loaded, or NULL if no font matched. [transfer full]
543 	 */
544 	public PgFont loadFont(PgFontDescription desc)
545 	{
546 		// PangoFont * pango_context_load_font (PangoContext *context,  const PangoFontDescription *desc);
547 		auto p = pango_context_load_font(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct());
548 		
549 		if(p is null)
550 		{
551 			return null;
552 		}
553 		
554 		return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p);
555 	}
556 	
557 	/**
558 	 * Load a set of fonts in the context that can be used to render
559 	 * a font matching desc.
560 	 * Params:
561 	 * desc = a PangoFontDescription describing the fonts to load
562 	 * language = a PangoLanguage the fonts will be used for
563 	 * Returns: the newly allocated PangoFontset loaded, or NULL if no font matched. [transfer full]
564 	 */
565 	public PgFontset loadFontset(PgFontDescription desc, PgLanguage language)
566 	{
567 		// PangoFontset * pango_context_load_fontset (PangoContext *context,  const PangoFontDescription *desc,  PangoLanguage *language);
568 		auto p = pango_context_load_fontset(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct(), (language is null) ? null : language.getPgLanguageStruct());
569 		
570 		if(p is null)
571 		{
572 			return null;
573 		}
574 		
575 		return ObjectG.getDObject!(PgFontset)(cast(PangoFontset*) p);
576 	}
577 	
578 	/**
579 	 * Get overall metric information for a particular font
580 	 * description. Since the metrics may be substantially different for
581 	 * different scripts, a language tag can be provided to indicate that
582 	 * the metrics should be retrieved that correspond to the script(s)
583 	 * used by that language.
584 	 * The PangoFontDescription is interpreted in the same way as
585 	 * by pango_itemize(), and the family name may be a comma separated
586 	 * list of figures. If characters from multiple of these families
587 	 * would be used to render the string, then the returned fonts would
588 	 * be a composite of the metrics for the fonts loaded for the
589 	 * individual families.
590 	 * Params:
591 	 * desc = a PangoFontDescription structure. NULL means that the
592 	 * font description from the context will be used. [allow-none]
593 	 * language = language tag used to determine which script to get
594 	 * the metrics for. NULL means that the language tag from the context
595 	 * will be used. If no language tag is set on the context, metrics
596 	 * for the default language (as determined by pango_language_get_default())
597 	 * will be returned. [allow-none]
598 	 * Returns: a PangoFontMetrics object. The caller must call pango_font_metrics_unref() when finished using the object.
599 	 */
600 	public PgFontMetrics getMetrics(PgFontDescription desc, PgLanguage language)
601 	{
602 		// PangoFontMetrics * pango_context_get_metrics (PangoContext *context,  const PangoFontDescription *desc,  PangoLanguage *language);
603 		auto p = pango_context_get_metrics(pangoContext, (desc is null) ? null : desc.getPgFontDescriptionStruct(), (language is null) ? null : language.getPgLanguageStruct());
604 		
605 		if(p is null)
606 		{
607 			return null;
608 		}
609 		
610 		return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p);
611 	}
612 	
613 	/**
614 	 * List all families for a context.
615 	 * Params:
616 	 * families = location to store a pointer to
617 	 * an array of PangoFontFamily *. This array should be freed
618 	 * with g_free(). [out][array length=n_families][transfer container]
619 	 */
620 	public void listFamilies(out PgFontFamily[] families)
621 	{
622 		// void pango_context_list_families (PangoContext *context,  PangoFontFamily ***families,  int *n_families);
623 		PangoFontFamily** outfamilies = null;
624 		int nFamilies;
625 		
626 		pango_context_list_families(pangoContext, &outfamilies, &nFamilies);
627 		
628 		
629 		families = new PgFontFamily[nFamilies];
630 		for(int i = 0; i < nFamilies; i++)
631 		{
632 			families[i] = ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) outfamilies[i]);
633 		}
634 	}
635 	
636 	/**
637 	 * Computes a PangoLogAttr for each character in text. The log_attrs
638 	 * array must have one PangoLogAttr for each position in text; if
639 	 * text contains N characters, it has N+1 positions, including the
640 	 * last position at the end of the text. text should be an entire
641 	 * paragraph; logical attributes can't be computed without context
642 	 * (for example you need to see spaces on either side of a word to know
643 	 * the word is a word).
644 	 * Params:
645 	 * text = text to process
646 	 * length = length in bytes of text
647 	 * level = embedding level, or -1 if unknown
648 	 * language = language tag
649 	 * logAttrs = array with one PangoLogAttr
650 	 * per character in text, plus one extra, to be filled in. [array length=attrs_len]
651 	 * attrsLen = length of log_attrs array
652 	 */
653 	public static void getLogAttrs(string text, int length, int level, PgLanguage language, PangoLogAttr* logAttrs, int attrsLen)
654 	{
655 		// void pango_get_log_attrs (const char *text,  int length,  int level,  PangoLanguage *language,  PangoLogAttr *log_attrs,  int attrs_len);
656 		pango_get_log_attrs(Str.toStringz(text), length, level, (language is null) ? null : language.getPgLanguageStruct(), logAttrs, attrsLen);
657 	}
658 	
659 	/**
660 	 * Locates a paragraph boundary in text. A boundary is caused by
661 	 * delimiter characters, such as a newline, carriage return, carriage
662 	 * return-newline pair, or Unicode paragraph separator character. The
663 	 * index of the run of delimiters is returned in
664 	 * paragraph_delimiter_index. The index of the start of the paragraph
665 	 * (index after all delimiters) is stored in next_paragraph_start.
666 	 * If no delimiters are found, both paragraph_delimiter_index and
667 	 * next_paragraph_start are filled with the length of text (an index one
668 	 * off the end).
669 	 * Params:
670 	 * text = UTF-8 text
671 	 * length = length of text in bytes, or -1 if nul-terminated
672 	 * paragraphDelimiterIndex = return location for index of
673 	 * delimiter. [out]
674 	 * nextParagraphStart = return location for start of next
675 	 * paragraph. [out]
676 	 */
677 	public static void findParagraphBoundary(string text, int length, out int paragraphDelimiterIndex, out int nextParagraphStart)
678 	{
679 		// void pango_find_paragraph_boundary (const gchar *text,  gint length,  gint *paragraph_delimiter_index,  gint *next_paragraph_start);
680 		pango_find_paragraph_boundary(Str.toStringz(text), length, &paragraphDelimiterIndex, &nextParagraphStart);
681 	}
682 	
683 	/**
684 	 * This is the default break algorithm, used if no language
685 	 * engine overrides it. Normally you should use pango_break()
686 	 * instead. Unlike pango_break(),
687 	 * analysis can be NULL, but only do that if you know what
688 	 * you're doing. If you need an analysis to pass to pango_break(),
689 	 * you need to pango_itemize(). In most cases however you should
690 	 * simply use pango_get_log_attrs().
691 	 * Params:
692 	 * text = text to break
693 	 * length = length of text in bytes (may be -1 if text is nul-terminated)
694 	 * analysis = a PangoAnalysis for the text
695 	 * attrs = logical attributes to fill in
696 	 * attrsLen = size of the array passed as attrs
697 	 */
698 	public static void defaultBreak(string text, int length, PangoAnalysis* analysis, PangoLogAttr* attrs, int attrsLen)
699 	{
700 		// void pango_default_break (const gchar *text,  int length,  PangoAnalysis *analysis,  PangoLogAttr *attrs,  int attrs_len);
701 		pango_default_break(Str.toStringz(text), length, analysis, attrs, attrsLen);
702 	}
703 	
704 	/**
705 	 * Given a segment of text and the corresponding
706 	 * PangoAnalysis structure returned from pango_itemize(),
707 	 * convert the characters into glyphs. You may also pass
708 	 * in only a substring of the item from pango_itemize().
709 	 * It is recommended that you use pango_shape_full() instead, since
710 	 * that API allows for shaping interaction happening across text item
711 	 * boundaries.
712 	 * Params:
713 	 * text = the text to process
714 	 * length = the length (in bytes) of text
715 	 * analysis = PangoAnalysis structure from pango_itemize()
716 	 * glyphs = glyph string in which to store results
717 	 */
718 	public static void shape(string text, int length, PangoAnalysis* analysis, PgGlyphString glyphs)
719 	{
720 		// void pango_shape (const gchar *text,  gint length,  const PangoAnalysis *analysis,  PangoGlyphString *glyphs);
721 		pango_shape(Str.toStringz(text), length, analysis, (glyphs is null) ? null : glyphs.getPgGlyphStringStruct());
722 	}
723 	
724 	/**
725 	 * Given a segment of text and the corresponding
726 	 * PangoAnalysis structure returned from pango_itemize(),
727 	 * convert the characters into glyphs. You may also pass
728 	 * in only a substring of the item from pango_itemize().
729 	 * This is similar to pango_shape(), except it also can optionally take
730 	 * the full paragraph text as input, which will then be used to perform
731 	 * certain cross-item shaping interactions. If you have access to the broader
732 	 * text of which item_text is part of, provide the broader text as
733 	 * paragraph_text. If paragraph_text is NULL, item text is used instead.
734 	 * Since 1.32
735 	 * Params:
736 	 * itemText = valid UTF-8 text to shape.
737 	 * paragraphText = (allow-none) text of the paragraph (see details). May be NULL.
738 	 * analysis = PangoAnalysis structure from pango_itemize().
739 	 * glyphs = glyph string in which to store results.
740 	 */
741 	public static void shapeFull(string itemText, string paragraphText, PangoAnalysis* analysis, PgGlyphString glyphs)
742 	{
743 		// void pango_shape_full (const gchar *item_text,  gint item_length,  const gchar *paragraph_text,  gint paragraph_length,  const PangoAnalysis *analysis,  PangoGlyphString *glyphs);
744 		pango_shape_full(cast(char*)itemText.ptr, cast(int) itemText.length, cast(char*)paragraphText.ptr, cast(int) paragraphText.length, analysis, (glyphs is null) ? null : glyphs.getPgGlyphStringStruct());
745 	}
746 	
747 	/**
748 	 * Determines the inherent direction of a character; either
749 	 * PANGO_DIRECTION_LTR, PANGO_DIRECTION_RTL, or
750 	 * PANGO_DIRECTION_NEUTRAL.
751 	 * This function is useful to categorize characters into left-to-right
752 	 * letters, right-to-left letters, and everything else. If full
753 	 * Unicode bidirectional type of a character is needed,
754 	 * pango_bidi_type_for_gunichar() can be used instead.
755 	 * Params:
756 	 * ch = a Unicode character
757 	 * Returns: the direction of the character.
758 	 */
759 	public static PangoDirection unicharDirection(gunichar ch)
760 	{
761 		// PangoDirection pango_unichar_direction (gunichar ch);
762 		return pango_unichar_direction(ch);
763 	}
764 	
765 	/**
766 	 * Searches a string the first character that has a strong
767 	 * direction, according to the Unicode bidirectional algorithm.
768 	 * Since 1.4
769 	 * Params:
770 	 * text = the text to process
771 	 * length = length of text in bytes (may be -1 if text is nul-terminated)
772 	 * Returns: The direction corresponding to the first strong character. If no such character is found, then PANGO_DIRECTION_NEUTRAL is returned.
773 	 */
774 	public static PangoDirection findBaseDir(string text, int length)
775 	{
776 		// PangoDirection pango_find_base_dir (const gchar *text,  gint length);
777 		return pango_find_base_dir(Str.toStringz(text), length);
778 	}
779 	
780 	/**
781 	 * Warning
782 	 * pango_get_mirror_char is deprecated and should not be used in newly-written code.
783 	 * If ch has the Unicode mirrored property and there is another Unicode
784 	 * character that typically has a glyph that is the mirror image of ch's
785 	 * glyph, puts that character in the address pointed to by mirrored_ch.
786 	 * Use g_unichar_get_mirror_char() instead; the docs for that function
787 	 * provide full details.
788 	 * Params:
789 	 * ch = a Unicode character
790 	 * mirroredCh = location to store the mirrored character
791 	 * Returns: TRUE if ch has a mirrored character and mirrored_ch is filled in, FALSE otherwise
792 	 */
793 	public static int getMirrorChar(gunichar ch, gunichar* mirroredCh)
794 	{
795 		// gboolean pango_get_mirror_char (gunichar ch,  gunichar *mirrored_ch);
796 		return pango_get_mirror_char(ch, mirroredCh);
797 	}
798 	
799 	/**
800 	 * Determines the normative bidirectional character type of a
801 	 * character, as specified in the Unicode Character Database.
802 	 * A simplified version of this function is available as
803 	 * pango_unichar_get_direction().
804 	 * Since 1.22
805 	 * Params:
806 	 * ch = a Unicode character
807 	 * Returns: the bidirectional character type, as used in the Unicode bidirectional algorithm.
808 	 */
809 	public static PangoBidiType bidiTypeForUnichar(gunichar ch)
810 	{
811 		// PangoBidiType pango_bidi_type_for_unichar (gunichar ch);
812 		return pango_bidi_type_for_unichar(ch);
813 	}
814 }