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