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-Layout-Objects.html
27  * outPack = pango
28  * outFile = PgLayout
29  * strct   = PangoLayout
30  * realStrct=
31  * ctorStrct=
32  * clss    = PgLayout
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- pango_layout_
41  * omit structs:
42  * omit prefixes:
43  * 	- pango_layout_iter_
44  * 	- pango_layout_line_
45  * omit code:
46  * 	- pango_layout_set_text
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- pango.PgLayoutLine
51  * 	- pango.PgContext
52  * 	- pango.PgAttributeList
53  * 	- pango.PgFontDescription
54  * 	- pango.PgTabArray
55  * 	- pango.PgLayoutIter
56  * 	- glib.ListSG
57  * structWrap:
58  * 	- GSList* -> ListSG
59  * 	- PangoAttrList* -> PgAttributeList
60  * 	- PangoContext* -> PgContext
61  * 	- PangoFontDescription* -> PgFontDescription
62  * 	- PangoLayout* -> PgLayout
63  * 	- PangoLayoutIter* -> PgLayoutIter
64  * 	- PangoLayoutLine* -> PgLayoutLine
65  * 	- PangoTabArray* -> PgTabArray
66  * module aliases:
67  * local aliases:
68  * overrides:
69  */
70 
71 module pango.PgLayout;
72 
73 public  import gtkc.pangotypes;
74 
75 private import gtkc.pango;
76 private import glib.ConstructionException;
77 private import gobject.ObjectG;
78 
79 private import glib.Str;
80 private import pango.PgLayoutLine;
81 private import pango.PgContext;
82 private import pango.PgAttributeList;
83 private import pango.PgFontDescription;
84 private import pango.PgTabArray;
85 private import pango.PgLayoutIter;
86 private import glib.ListSG;
87 
88 
89 private import gobject.ObjectG;
90 
91 /**
92  * While complete access to the layout capabilities of Pango is provided
93  * using the detailed interfaces for itemization and shaping, using
94  * that functionality directly involves writing a fairly large amount
95  * of code. The objects and functions in this section provide a
96  * high-level driver for formatting entire paragraphs of text
97  * at once.
98  */
99 public class PgLayout : ObjectG
100 {
101 	
102 	/** the main Gtk struct */
103 	protected PangoLayout* pangoLayout;
104 	
105 	
106 	/** Get the main Gtk struct */
107 	public PangoLayout* getPgLayoutStruct()
108 	{
109 		return pangoLayout;
110 	}
111 	
112 	
113 	/** the main Gtk struct as a void* */
114 	protected override void* getStruct()
115 	{
116 		return cast(void*)pangoLayout;
117 	}
118 	
119 	/**
120 	 * Sets our main struct and passes it to the parent class
121 	 */
122 	public this (PangoLayout* pangoLayout)
123 	{
124 		super(cast(GObject*)pangoLayout);
125 		this.pangoLayout = pangoLayout;
126 	}
127 	
128 	protected override void setStruct(GObject* obj)
129 	{
130 		super.setStruct(obj);
131 		pangoLayout = cast(PangoLayout*)obj;
132 	}
133 	
134 	/**
135 	 * Sets the text of the layout.
136 	 * Params:
137 	 *  text = a UTF-8 string
138 	 */
139 	public void setText(string text)
140 	{
141 		// void pango_layout_set_text (PangoLayout *layout,  const char *text,  int length);
142 		pango_layout_set_text(pangoLayout, Str.toStringz(text), cast(int) text.length);
143 	}
144 	
145 	
146 	/**
147 	 */
148 	
149 	/**
150 	 * Create a new PangoLayout object with attributes initialized to
151 	 * default values for a particular PangoContext.
152 	 * Params:
153 	 * context = a PangoContext
154 	 * Throws: ConstructionException GTK+ fails to create the object.
155 	 */
156 	public this (PgContext context)
157 	{
158 		// PangoLayout * pango_layout_new (PangoContext *context);
159 		auto p = pango_layout_new((context is null) ? null : context.getPgContextStruct());
160 		if(p is null)
161 		{
162 			throw new ConstructionException("null returned by pango_layout_new((context is null) ? null : context.getPgContextStruct())");
163 		}
164 		this(cast(PangoLayout*) p);
165 	}
166 	
167 	/**
168 	 * Does a deep copy-by-value of the src layout. The attribute list,
169 	 * tab array, and text from the original layout are all copied by
170 	 * value.
171 	 * Returns: the newly allocated PangoLayout, with a reference count of one, which should be freed with g_object_unref(). [transfer full]
172 	 */
173 	public PgLayout copy()
174 	{
175 		// PangoLayout * pango_layout_copy (PangoLayout *src);
176 		auto p = pango_layout_copy(pangoLayout);
177 		
178 		if(p is null)
179 		{
180 			return null;
181 		}
182 		
183 		return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p);
184 	}
185 	
186 	/**
187 	 * Retrieves the PangoContext used for this layout.
188 	 * Returns: the PangoContext for the layout. This does not have an additional refcount added, so if you want to keep a copy of this around, you must reference it yourself. [transfer none]
189 	 */
190 	public PgContext getContext()
191 	{
192 		// PangoContext * pango_layout_get_context (PangoLayout *layout);
193 		auto p = pango_layout_get_context(pangoLayout);
194 		
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 		
200 		return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p);
201 	}
202 	
203 	/**
204 	 * Forces recomputation of any state in the PangoLayout that
205 	 * might depend on the layout's context. This function should
206 	 * be called if you make changes to the context subsequent
207 	 * to creating the layout.
208 	 */
209 	public void contextChanged()
210 	{
211 		// void pango_layout_context_changed (PangoLayout *layout);
212 		pango_layout_context_changed(pangoLayout);
213 	}
214 	
215 	/**
216 	 * Returns the current serial number of layout. The serial number is
217 	 * initialized to an small number larger than zero when a new layout
218 	 * is created and is increased whenever the layout is changed using any
219 	 * of the setter functions, or the PangoContext it uses has changed.
220 	 * The serial may wrap, but will never have the value 0. Since it
221 	 * can wrap, never compare it with "less than", always use "not equals".
222 	 * This can be used to automatically detect changes to a PangoLayout, and
223 	 * is useful for example to decide whether a layout needs redrawing.
224 	 * To force the serial to be increased, use pango_layout_context_changed().
225 	 * Since 1.32.4
226 	 * Returns: The current serial number of layout.
227 	 */
228 	public uint getSerial()
229 	{
230 		// guint pango_layout_get_serial (PangoLayout *layout);
231 		return pango_layout_get_serial(pangoLayout);
232 	}
233 	
234 	/**
235 	 * Gets the text in the layout. The returned text should not
236 	 * be freed or modified.
237 	 * Returns: the text in the layout.
238 	 */
239 	public string getText()
240 	{
241 		// const char * pango_layout_get_text (PangoLayout *layout);
242 		return Str.toString(pango_layout_get_text(pangoLayout));
243 	}
244 	
245 	/**
246 	 * Returns the number of Unicode characters in the
247 	 * the text of layout.
248 	 * Since 1.30
249 	 * Returns: the number of Unicode characters in the text of layout
250 	 */
251 	public int getCharacterCount()
252 	{
253 		// gint pango_layout_get_character_count (PangoLayout *layout);
254 		return pango_layout_get_character_count(pangoLayout);
255 	}
256 	
257 	/**
258 	 * Same as pango_layout_set_markup_with_accel(), but
259 	 * the markup text isn't scanned for accelerators.
260 	 * Params:
261 	 * markup = marked-up text
262 	 * length = length of marked-up text in bytes, or -1 if markup is
263 	 * null-terminated
264 	 */
265 	public void setMarkup(string markup, int length)
266 	{
267 		// void pango_layout_set_markup (PangoLayout *layout,  const char *markup,  int length);
268 		pango_layout_set_markup(pangoLayout, Str.toStringz(markup), length);
269 	}
270 	
271 	/**
272 	 * Sets the layout text and attribute list from marked-up text (see
273 	 * markup format). Replaces
274 	 * the current text and attribute list.
275 	 * If accel_marker is nonzero, the given character will mark the
276 	 * character following it as an accelerator. For example, accel_marker
277 	 * might be an ampersand or underscore. All characters marked
278 	 * as an accelerator will receive a PANGO_UNDERLINE_LOW attribute,
279 	 * and the first character so marked will be returned in accel_char.
280 	 * Two accel_marker characters following each other produce a single
281 	 * literal accel_marker character.
282 	 * Params:
283 	 * markup = marked-up text
284 	 * (see markup format)
285 	 * length = length of marked-up text in bytes, or -1 if markup is
286 	 * null-terminated
287 	 * accelMarker = marker for accelerators in the text
288 	 * accelChar = return location
289 	 * for first located accelerator, or NULL. [out caller-allocates][allow-none]
290 	 */
291 	public void setMarkupWithAccel(string markup, int length, gunichar accelMarker, gunichar* accelChar)
292 	{
293 		// void pango_layout_set_markup_with_accel (PangoLayout *layout,  const char *markup,  int length,  gunichar accel_marker,  gunichar *accel_char);
294 		pango_layout_set_markup_with_accel(pangoLayout, Str.toStringz(markup), length, accelMarker, accelChar);
295 	}
296 	
297 	/**
298 	 * Sets the text attributes for a layout object.
299 	 * References attrs, so the caller can unref its reference.
300 	 * Params:
301 	 * attrs = a PangoAttrList, can be NULL. [allow-none][transfer none]
302 	 */
303 	public void setAttributes(PgAttributeList attrs)
304 	{
305 		// void pango_layout_set_attributes (PangoLayout *layout,  PangoAttrList *attrs);
306 		pango_layout_set_attributes(pangoLayout, (attrs is null) ? null : attrs.getPgAttributeListStruct());
307 	}
308 	
309 	/**
310 	 * Gets the attribute list for the layout, if any.
311 	 * Returns: a PangoAttrList. [transfer none]
312 	 */
313 	public PgAttributeList getAttributes()
314 	{
315 		// PangoAttrList * pango_layout_get_attributes (PangoLayout *layout);
316 		auto p = pango_layout_get_attributes(pangoLayout);
317 		
318 		if(p is null)
319 		{
320 			return null;
321 		}
322 		
323 		return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p);
324 	}
325 	
326 	/**
327 	 * Sets the default font description for the layout. If no font
328 	 * description is set on the layout, the font description from
329 	 * the layout's context is used.
330 	 * Params:
331 	 * desc = the new PangoFontDescription, or NULL to unset the
332 	 * current font description. [allow-none]
333 	 */
334 	public void setFontDescription(PgFontDescription desc)
335 	{
336 		// void pango_layout_set_font_description (PangoLayout *layout,  const PangoFontDescription *desc);
337 		pango_layout_set_font_description(pangoLayout, (desc is null) ? null : desc.getPgFontDescriptionStruct());
338 	}
339 	
340 	/**
341 	 * Gets the font description for the layout, if any.
342 	 * Since 1.8
343 	 * Returns: a pointer to the layout's font description, or NULL if the font description from the layout's context is inherited. This value is owned by the layout and must not be modified or freed.
344 	 */
345 	public PgFontDescription getFontDescription()
346 	{
347 		// const PangoFontDescription * pango_layout_get_font_description  (PangoLayout *layout);
348 		auto p = pango_layout_get_font_description(pangoLayout);
349 		
350 		if(p is null)
351 		{
352 			return null;
353 		}
354 		
355 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
356 	}
357 	
358 	/**
359 	 * Sets the width to which the lines of the PangoLayout should wrap or
360 	 * ellipsized. The default value is -1: no width set.
361 	 * Params:
362 	 * width = the desired width in Pango units, or -1 to indicate that no
363 	 * wrapping or ellipsization should be performed.
364 	 */
365 	public void setWidth(int width)
366 	{
367 		// void pango_layout_set_width (PangoLayout *layout,  int width);
368 		pango_layout_set_width(pangoLayout, width);
369 	}
370 	
371 	/**
372 	 * Gets the width to which the lines of the PangoLayout should wrap.
373 	 * Returns: the width in Pango units, or -1 if no width set.
374 	 */
375 	public int getWidth()
376 	{
377 		// int pango_layout_get_width (PangoLayout *layout);
378 		return pango_layout_get_width(pangoLayout);
379 	}
380 	
381 	/**
382 	 * Sets the height to which the PangoLayout should be ellipsized at. There
383 	 * are two different behaviors, based on whether height is positive or
384 	 * negative.
385 	 * If height is positive, it will be the maximum height of the layout. Only
386 	 * lines would be shown that would fit, and if there is any text omitted,
387 	 * an ellipsis added. At least one line is included in each paragraph regardless
388 	 * of how small the height value is. A value of zero will render exactly one
389 	 * line for the entire layout.
390 	 * If height is negative, it will be the (negative of) maximum number of lines per
391 	 * paragraph. That is, the total number of lines shown may well be more than
392 	 * this value if the layout contains multiple paragraphs of text.
393 	 * The default value of -1 means that first line of each paragraph is ellipsized.
394 	 * This behvaior may be changed in the future to act per layout instead of per
395 	 * paragraph. File a bug against pango at http://bugzilla.gnome.org/ if your
396 	 * code relies on this behavior.
397 	 * Height setting only has effect if a positive width is set on
398 	 * layout and ellipsization mode of layout is not PANGO_ELLIPSIZE_NONE.
399 	 * The behavior is undefined if a height other than -1 is set and
400 	 * ellipsization mode is set to PANGO_ELLIPSIZE_NONE, and may change in the
401 	 * future.
402 	 * Since 1.20
403 	 * Params:
404 	 * height = the desired height of the layout in Pango units if positive,
405 	 * or desired number of lines if negative.
406 	 */
407 	public void setHeight(int height)
408 	{
409 		// void pango_layout_set_height (PangoLayout *layout,  int height);
410 		pango_layout_set_height(pangoLayout, height);
411 	}
412 	
413 	/**
414 	 * Gets the height of layout used for ellipsization. See
415 	 * pango_layout_set_height() for details.
416 	 * Since 1.20
417 	 * Returns: the height, in Pango units if positive, or number of lines if negative.
418 	 */
419 	public int getHeight()
420 	{
421 		// int pango_layout_get_height (PangoLayout *layout);
422 		return pango_layout_get_height(pangoLayout);
423 	}
424 	
425 	/**
426 	 * Sets the wrap mode; the wrap mode only has effect if a width
427 	 * is set on the layout with pango_layout_set_width().
428 	 * To turn off wrapping, set the width to -1.
429 	 * Params:
430 	 * wrap = the wrap mode
431 	 */
432 	public void setWrap(PangoWrapMode wrap)
433 	{
434 		// void pango_layout_set_wrap (PangoLayout *layout,  PangoWrapMode wrap);
435 		pango_layout_set_wrap(pangoLayout, wrap);
436 	}
437 	
438 	/**
439 	 * Gets the wrap mode for the layout.
440 	 * Use pango_layout_is_wrapped() to query whether any paragraphs
441 	 * were actually wrapped.
442 	 * Returns: active wrap mode.
443 	 */
444 	public PangoWrapMode getWrap()
445 	{
446 		// PangoWrapMode pango_layout_get_wrap (PangoLayout *layout);
447 		return pango_layout_get_wrap(pangoLayout);
448 	}
449 	
450 	/**
451 	 * Queries whether the layout had to wrap any paragraphs.
452 	 * This returns TRUE if a positive width is set on layout,
453 	 * ellipsization mode of layout is set to PANGO_ELLIPSIZE_NONE,
454 	 * and there are paragraphs exceeding the layout width that have
455 	 * to be wrapped.
456 	 * Since 1.16
457 	 * Returns: TRUE if any paragraphs had to be wrapped, FALSE otherwise.
458 	 */
459 	public int isWrapped()
460 	{
461 		// gboolean pango_layout_is_wrapped (PangoLayout *layout);
462 		return pango_layout_is_wrapped(pangoLayout);
463 	}
464 	
465 	/**
466 	 * Sets the type of ellipsization being performed for layout.
467 	 * Depending on the ellipsization mode ellipsize text is
468 	 * removed from the start, middle, or end of text so they
469 	 * fit within the width and height of layout set with
470 	 * pango_layout_set_width() and pango_layout_set_height().
471 	 * If the layout contains characters such as newlines that
472 	 * force it to be layed out in multiple paragraphs, then whether
473 	 * each paragraph is ellipsized separately or the entire layout
474 	 * is ellipsized as a whole depends on the set height of the layout.
475 	 * See pango_layout_set_height() for details.
476 	 * Since 1.6
477 	 * Params:
478 	 * ellipsize = the new ellipsization mode for layout
479 	 */
480 	public void setEllipsize(PangoEllipsizeMode ellipsize)
481 	{
482 		// void pango_layout_set_ellipsize (PangoLayout *layout,  PangoEllipsizeMode ellipsize);
483 		pango_layout_set_ellipsize(pangoLayout, ellipsize);
484 	}
485 	
486 	/**
487 	 * Gets the type of ellipsization being performed for layout.
488 	 * See pango_layout_set_ellipsize()
489 	 * Since 1.6
490 	 * Returns: the current ellipsization mode for layout. Use pango_layout_is_ellipsized() to query whether any paragraphs were actually ellipsized.
491 	 */
492 	public PangoEllipsizeMode getEllipsize()
493 	{
494 		// PangoEllipsizeMode pango_layout_get_ellipsize (PangoLayout *layout);
495 		return pango_layout_get_ellipsize(pangoLayout);
496 	}
497 	
498 	/**
499 	 * Queries whether the layout had to ellipsize any paragraphs.
500 	 * This returns TRUE if the ellipsization mode for layout
501 	 * is not PANGO_ELLIPSIZE_NONE, a positive width is set on layout,
502 	 * and there are paragraphs exceeding that width that have to be
503 	 * ellipsized.
504 	 * Since 1.16
505 	 * Returns: TRUE if any paragraphs had to be ellipsized, FALSE otherwise.
506 	 */
507 	public int isEllipsized()
508 	{
509 		// gboolean pango_layout_is_ellipsized (PangoLayout *layout);
510 		return pango_layout_is_ellipsized(pangoLayout);
511 	}
512 	
513 	/**
514 	 * Sets the width in Pango units to indent each paragraph. A negative value
515 	 * of indent will produce a hanging indentation. That is, the first line will
516 	 * have the full width, and subsequent lines will be indented by the
517 	 * absolute value of indent.
518 	 * The indent setting is ignored if layout alignment is set to
519 	 * PANGO_ALIGN_CENTER.
520 	 * Params:
521 	 * indent = the amount by which to indent.
522 	 */
523 	public void setIndent(int indent)
524 	{
525 		// void pango_layout_set_indent (PangoLayout *layout,  int indent);
526 		pango_layout_set_indent(pangoLayout, indent);
527 	}
528 	
529 	/**
530 	 * Gets the paragraph indent width in Pango units. A negative value
531 	 * indicates a hanging indentation.
532 	 * Returns: the indent in Pango units.
533 	 */
534 	public int getIndent()
535 	{
536 		// int pango_layout_get_indent (PangoLayout *layout);
537 		return pango_layout_get_indent(pangoLayout);
538 	}
539 	
540 	/**
541 	 * Gets the amount of spacing between the lines of the layout.
542 	 * Returns: the spacing in Pango units.
543 	 */
544 	public int getSpacing()
545 	{
546 		// int pango_layout_get_spacing (PangoLayout *layout);
547 		return pango_layout_get_spacing(pangoLayout);
548 	}
549 	
550 	/**
551 	 * Sets the amount of spacing in Pango unit between the lines of the
552 	 * layout.
553 	 * Params:
554 	 * spacing = the amount of spacing
555 	 */
556 	public void setSpacing(int spacing)
557 	{
558 		// void pango_layout_set_spacing (PangoLayout *layout,  int spacing);
559 		pango_layout_set_spacing(pangoLayout, spacing);
560 	}
561 	
562 	/**
563 	 * Sets whether each complete line should be stretched to
564 	 * fill the entire width of the layout. This stretching is typically
565 	 * done by adding whitespace, but for some scripts (such as Arabic),
566 	 * the justification may be done in more complex ways, like extending
567 	 * the characters.
568 	 * Note that this setting is not implemented and so is ignored in Pango
569 	 * older than 1.18.
570 	 * Params:
571 	 * justify = whether the lines in the layout should be justified.
572 	 */
573 	public void setJustify(int justify)
574 	{
575 		// void pango_layout_set_justify (PangoLayout *layout,  gboolean justify);
576 		pango_layout_set_justify(pangoLayout, justify);
577 	}
578 	
579 	/**
580 	 * Gets whether each complete line should be stretched to fill the entire
581 	 * width of the layout.
582 	 * Returns: the justify.
583 	 */
584 	public int getJustify()
585 	{
586 		// gboolean pango_layout_get_justify (PangoLayout *layout);
587 		return pango_layout_get_justify(pangoLayout);
588 	}
589 	
590 	/**
591 	 * Sets whether to calculate the bidirectional base direction
592 	 * for the layout according to the contents of the layout;
593 	 * when this flag is on (the default), then paragraphs in
594 	 *  layout that begin with strong right-to-left characters
595 	 * (Arabic and Hebrew principally), will have right-to-left
596 	 * layout, paragraphs with letters from other scripts will
597 	 * have left-to-right layout. Paragraphs with only neutral
598 	 * characters get their direction from the surrounding paragraphs.
599 	 * When FALSE, the choice between left-to-right and
600 	 * right-to-left layout is done according to the base direction
601 	 * of the layout's PangoContext. (See pango_context_set_base_dir()).
602 	 * When the auto-computed direction of a paragraph differs from the
603 	 * base direction of the context, the interpretation of
604 	 * PANGO_ALIGN_LEFT and PANGO_ALIGN_RIGHT are swapped.
605 	 * Since 1.4
606 	 * Params:
607 	 * autoDir = if TRUE, compute the bidirectional base direction
608 	 * from the layout's contents.
609 	 */
610 	public void setAutoDir(int autoDir)
611 	{
612 		// void pango_layout_set_auto_dir (PangoLayout *layout,  gboolean auto_dir);
613 		pango_layout_set_auto_dir(pangoLayout, autoDir);
614 	}
615 	
616 	/**
617 	 * Gets whether to calculate the bidirectional base direction
618 	 * for the layout according to the contents of the layout.
619 	 * See pango_layout_set_auto_dir().
620 	 * Since 1.4
621 	 * Returns: TRUE if the bidirectional base direction is computed from the layout's contents, FALSE otherwise.
622 	 */
623 	public int getAutoDir()
624 	{
625 		// gboolean pango_layout_get_auto_dir (PangoLayout *layout);
626 		return pango_layout_get_auto_dir(pangoLayout);
627 	}
628 	
629 	/**
630 	 * Sets the alignment for the layout: how partial lines are
631 	 * positioned within the horizontal space available.
632 	 * Params:
633 	 * alignment = the alignment
634 	 */
635 	public void setAlignment(PangoAlignment alignment)
636 	{
637 		// void pango_layout_set_alignment (PangoLayout *layout,  PangoAlignment alignment);
638 		pango_layout_set_alignment(pangoLayout, alignment);
639 	}
640 	
641 	/**
642 	 * Gets the alignment for the layout: how partial lines are
643 	 * positioned within the horizontal space available.
644 	 * Returns: the alignment.
645 	 */
646 	public PangoAlignment getAlignment()
647 	{
648 		// PangoAlignment pango_layout_get_alignment (PangoLayout *layout);
649 		return pango_layout_get_alignment(pangoLayout);
650 	}
651 	
652 	/**
653 	 * Sets the tabs to use for layout, overriding the default tabs
654 	 * (by default, tabs are every 8 spaces). If tabs is NULL, the default
655 	 * tabs are reinstated. tabs is copied into the layout; you must
656 	 * free your copy of tabs yourself.
657 	 * Params:
658 	 * tabs = a PangoTabArray, or NULL. [allow-none]
659 	 */
660 	public void setTabs(PgTabArray tabs)
661 	{
662 		// void pango_layout_set_tabs (PangoLayout *layout,  PangoTabArray *tabs);
663 		pango_layout_set_tabs(pangoLayout, (tabs is null) ? null : tabs.getPgTabArrayStruct());
664 	}
665 	
666 	/**
667 	 * Gets the current PangoTabArray used by this layout. If no
668 	 * PangoTabArray has been set, then the default tabs are in use
669 	 * and NULL is returned. Default tabs are every 8 spaces.
670 	 * The return value should be freed with pango_tab_array_free().
671 	 * Returns: a copy of the tabs for this layout, or NULL.
672 	 */
673 	public PgTabArray getTabs()
674 	{
675 		// PangoTabArray * pango_layout_get_tabs (PangoLayout *layout);
676 		auto p = pango_layout_get_tabs(pangoLayout);
677 		
678 		if(p is null)
679 		{
680 			return null;
681 		}
682 		
683 		return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p);
684 	}
685 	
686 	/**
687 	 * If setting is TRUE, do not treat newlines and similar characters
688 	 * as paragraph separators; instead, keep all text in a single paragraph,
689 	 * and display a glyph for paragraph separator characters. Used when
690 	 * you want to allow editing of newlines on a single text line.
691 	 * Params:
692 	 * setting = new setting
693 	 */
694 	public void setSingleParagraphMode(int setting)
695 	{
696 		// void pango_layout_set_single_paragraph_mode  (PangoLayout *layout,  gboolean setting);
697 		pango_layout_set_single_paragraph_mode(pangoLayout, setting);
698 	}
699 	
700 	/**
701 	 * Obtains the value set by pango_layout_set_single_paragraph_mode().
702 	 * Returns: TRUE if the layout does not break paragraphs at paragraph separator characters, FALSE otherwise.
703 	 */
704 	public int getSingleParagraphMode()
705 	{
706 		// gboolean pango_layout_get_single_paragraph_mode  (PangoLayout *layout);
707 		return pango_layout_get_single_paragraph_mode(pangoLayout);
708 	}
709 	
710 	/**
711 	 * Counts the number unknown glyphs in layout. That is, zero if
712 	 * glyphs for all characters in the layout text were found, or more
713 	 * than zero otherwise.
714 	 * This function can be used to determine if there are any fonts
715 	 * available to render all characters in a certain string, or when
716 	 * used in combination with PANGO_ATTR_FALLBACK, to check if a
717 	 * certain font supports all the characters in the string.
718 	 * Since 1.16
719 	 * Returns: The number of unknown glyphs in layout.
720 	 */
721 	public int getUnknownGlyphsCount()
722 	{
723 		// int pango_layout_get_unknown_glyphs_count  (PangoLayout *layout);
724 		return pango_layout_get_unknown_glyphs_count(pangoLayout);
725 	}
726 	
727 	/**
728 	 * Retrieves an array of logical attributes for each character in
729 	 * the layout.
730 	 * Params:
731 	 * attrs = location to store a pointer to an array of logical attributes
732 	 * This value must be freed with g_free(). [out][array length=n_attrs][transfer container]
733 	 */
734 	public void getLogAttrs(out PangoLogAttr[] attrs)
735 	{
736 		// void pango_layout_get_log_attrs (PangoLayout *layout,  PangoLogAttr **attrs,  gint *n_attrs);
737 		PangoLogAttr* outattrs = null;
738 		int nAttrs;
739 		
740 		pango_layout_get_log_attrs(pangoLayout, &outattrs, &nAttrs);
741 		
742 		attrs = outattrs[0 .. nAttrs];
743 	}
744 	
745 	/**
746 	 * Retrieves an array of logical attributes for each character in
747 	 * the layout.
748 	 * This is a faster alternative to pango_layout_get_log_attrs().
749 	 * The returned array is part of layout and must not be modified.
750 	 * Modifying the layout will invalidate the returned array.
751 	 * The number of attributes returned in n_attrs will be one more
752 	 * than the total number of characters in the layout, since there
753 	 * need to be attributes corresponding to both the position before
754 	 * the first character and the position after the last character.
755 	 * Since 1.30
756 	 * Returns: an array of logical attributes. [array length=n_attrs]
757 	 */
758 	public PangoLogAttr[] getLogAttrsReadonly()
759 	{
760 		// const PangoLogAttr * pango_layout_get_log_attrs_readonly  (PangoLayout *layout,  gint *n_attrs);
761 		int nAttrs;
762 		auto p = pango_layout_get_log_attrs_readonly(pangoLayout, &nAttrs);
763 		
764 		if(p is null)
765 		{
766 			return null;
767 		}
768 		
769 		return p[0 .. nAttrs];
770 	}
771 	
772 	/**
773 	 * Converts from an index within a PangoLayout to the onscreen position
774 	 * corresponding to the grapheme at that index, which is represented
775 	 * as rectangle. Note that pos->x is always the leading
776 	 * edge of the grapheme and pos->x + pos->width the trailing
777 	 * edge of the grapheme. If the directionality of the grapheme is right-to-left,
778 	 * then pos->width will be negative.
779 	 * Params:
780 	 * index = byte index within layout
781 	 * pos = rectangle in which to store the position of the grapheme. [out]
782 	 */
783 	public void indexToPos(int index, PangoRectangle* pos)
784 	{
785 		// void pango_layout_index_to_pos (PangoLayout *layout,  int index_,  PangoRectangle *pos);
786 		pango_layout_index_to_pos(pangoLayout, index, pos);
787 	}
788 	
789 	/**
790 	 * Converts from byte index_ within the layout to line and X position.
791 	 * (X position is measured from the left edge of the line)
792 	 * Params:
793 	 * index = the byte index of a grapheme within the layout.
794 	 * trailing = an integer indicating the edge of the grapheme to retrieve the
795 	 * position of. If 0, the trailing edge of the grapheme, if > 0,
796 	 * the leading of the grapheme.
797 	 * line = location to store resulting line index. (which will
798 	 * between 0 and pango_layout_get_line_count(layout) - 1), or NULL. [out][allow-none]
799 	 * xPos = location to store resulting position within line
800 	 * (PANGO_SCALE units per device unit), or NULL. [out][allow-none]
801 	 */
802 	public void indexToLineX(int index, int trailing, out int line, out int xPos)
803 	{
804 		// void pango_layout_index_to_line_x (PangoLayout *layout,  int index_,  gboolean trailing,  int *line,  int *x_pos);
805 		pango_layout_index_to_line_x(pangoLayout, index, trailing, &line, &xPos);
806 	}
807 	
808 	/**
809 	 * Converts from X and Y position within a layout to the byte
810 	 * index to the character at that logical position. If the
811 	 * Y position is not inside the layout, the closest position is chosen
812 	 * (the position will be clamped inside the layout). If the
813 	 * X position is not within the layout, then the start or the
814 	 * end of the line is chosen as described for pango_layout_x_to_index().
815 	 * If either the X or Y positions were not inside the layout, then the
816 	 * function returns FALSE; on an exact hit, it returns TRUE.
817 	 * Params:
818 	 * x = the X offset (in Pango units)
819 	 * from the left edge of the layout.
820 	 * y = the Y offset (in Pango units)
821 	 * from the top edge of the layout
822 	 * index = location to store calculated byte index. [out]
823 	 * trailing = location to store a integer indicating where
824 	 * in the grapheme the user clicked. It will either
825 	 * be zero, or the number of characters in the
826 	 * grapheme. 0 represents the trailing edge of the grapheme. [out]
827 	 * Returns: TRUE if the coordinates were inside text, FALSE otherwise.
828 	 */
829 	public int xyToIndex(int x, int y, out int index, out int trailing)
830 	{
831 		// gboolean pango_layout_xy_to_index (PangoLayout *layout,  int x,  int y,  int *index_,  int *trailing);
832 		return pango_layout_xy_to_index(pangoLayout, x, y, &index, &trailing);
833 	}
834 	
835 	/**
836 	 * Given an index within a layout, determines the positions that of the
837 	 * strong and weak cursors if the insertion point is at that
838 	 * index. The position of each cursor is stored as a zero-width
839 	 * rectangle. The strong cursor location is the location where
840 	 * characters of the directionality equal to the base direction of the
841 	 * layout are inserted. The weak cursor location is the location
842 	 * where characters of the directionality opposite to the base
843 	 * direction of the layout are inserted.
844 	 * Params:
845 	 * index = the byte index of the cursor
846 	 * strongPos = location to store the strong cursor position
847 	 * (may be NULL). [out][allow-none]
848 	 * weakPos = location to store the weak cursor position (may be NULL). [out][allow-none]
849 	 */
850 	public void getCursorPos(int index, PangoRectangle* strongPos, PangoRectangle* weakPos)
851 	{
852 		// void pango_layout_get_cursor_pos (PangoLayout *layout,  int index_,  PangoRectangle *strong_pos,  PangoRectangle *weak_pos);
853 		pango_layout_get_cursor_pos(pangoLayout, index, strongPos, weakPos);
854 	}
855 	
856 	/**
857 	 * Computes a new cursor position from an old position and
858 	 * a count of positions to move visually. If direction is positive,
859 	 * then the new strong cursor position will be one position
860 	 * to the right of the old cursor position. If direction is negative,
861 	 * then the new strong cursor position will be one position
862 	 * to the left of the old cursor position.
863 	 * In the presence of bidirectional text, the correspondence
864 	 * between logical and visual order will depend on the direction
865 	 * of the current run, and there may be jumps when the cursor
866 	 * is moved off of the end of a run.
867 	 * Motion here is in cursor positions, not in characters, so a
868 	 * single call to pango_layout_move_cursor_visually() may move the
869 	 * cursor over multiple characters when multiple characters combine
870 	 * to form a single grapheme.
871 	 * Params:
872 	 * strong = whether the moving cursor is the strong cursor or the
873 	 * weak cursor. The strong cursor is the cursor corresponding
874 	 * to text insertion in the base direction for the layout.
875 	 * oldIndex = the byte index of the grapheme for the old index
876 	 * oldTrailing = if 0, the cursor was at the trailing edge of the
877 	 * grapheme indicated by old_index, if > 0, the cursor
878 	 * was at the leading edge.
879 	 * direction = direction to move cursor. A negative
880 	 * value indicates motion to the left.
881 	 * newIndex = location to store the new cursor byte index. A value of -1
882 	 * indicates that the cursor has been moved off the beginning
883 	 * of the layout. A value of G_MAXINT indicates that
884 	 * the cursor has been moved off the end of the layout. [out]
885 	 * newTrailing = number of characters to move forward from the
886 	 * location returned for new_index to get the position
887 	 * where the cursor should be displayed. This allows
888 	 * distinguishing the position at the beginning of one
889 	 * line from the position at the end of the preceding
890 	 * line. new_index is always on the line where the
891 	 * cursor should be displayed. [out]
892 	 */
893 	public void moveCursorVisually(int strong, int oldIndex, int oldTrailing, int direction, out int newIndex, out int newTrailing)
894 	{
895 		// void pango_layout_move_cursor_visually (PangoLayout *layout,  gboolean strong,  int old_index,  int old_trailing,  int direction,  int *new_index,  int *new_trailing);
896 		pango_layout_move_cursor_visually(pangoLayout, strong, oldIndex, oldTrailing, direction, &newIndex, &newTrailing);
897 	}
898 	
899 	/**
900 	 * Computes the logical and ink extents of layout. Logical extents
901 	 * are usually what you want for positioning things. Note that both extents
902 	 * may have non-zero x and y. You may want to use those to offset where you
903 	 * render the layout. Not doing that is a very typical bug that shows up as
904 	 * right-to-left layouts not being correctly positioned in a layout with
905 	 * a set width.
906 	 * The extents are given in layout coordinates and in Pango units; layout
907 	 * coordinates begin at the top left corner of the layout.
908 	 * Params:
909 	 * inkRect = rectangle used to store the extents of the
910 	 * layout as drawn or NULL to indicate that the result is
911 	 * not needed. [out][allow-none]
912 	 * logicalRect = rectangle used to store the logical
913 	 * extents of the layout or NULL to indicate that the
914 	 * result is not needed. [out][allow-none]
915 	 */
916 	public void getExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect)
917 	{
918 		// void pango_layout_get_extents (PangoLayout *layout,  PangoRectangle *ink_rect,  PangoRectangle *logical_rect);
919 		pango_layout_get_extents(pangoLayout, inkRect, logicalRect);
920 	}
921 	
922 	/**
923 	 * Computes the logical and ink extents of layout in device units.
924 	 * This function just calls pango_layout_get_extents() followed by
925 	 * two pango_extents_to_pixels() calls, rounding ink_rect and logical_rect
926 	 * such that the rounded rectangles fully contain the unrounded one (that is,
927 	 * passes them as first argument to pango_extents_to_pixels()).
928 	 * Params:
929 	 * inkRect = rectangle used to store the extents of the
930 	 * layout as drawn or NULL to indicate that the result is
931 	 * not needed. [out][allow-none]
932 	 * logicalRect = rectangle used to store the logical
933 	 * extents of the layout or NULL to indicate that the
934 	 * result is not needed. [out][allow-none]
935 	 */
936 	public void getPixelExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect)
937 	{
938 		// void pango_layout_get_pixel_extents (PangoLayout *layout,  PangoRectangle *ink_rect,  PangoRectangle *logical_rect);
939 		pango_layout_get_pixel_extents(pangoLayout, inkRect, logicalRect);
940 	}
941 	
942 	/**
943 	 * Determines the logical width and height of a PangoLayout
944 	 * in Pango units (device units scaled by PANGO_SCALE). This
945 	 * is simply a convenience function around pango_layout_get_extents().
946 	 * Params:
947 	 * width = location to store the logical width, or NULL. [out caller-allocates][allow-none]
948 	 * height = location to store the logical height, or NULL. [out caller-allocates][allow-none]
949 	 */
950 	public void getSize(out int width, out int height)
951 	{
952 		// void pango_layout_get_size (PangoLayout *layout,  int *width,  int *height);
953 		pango_layout_get_size(pangoLayout, &width, &height);
954 	}
955 	
956 	/**
957 	 * Determines the logical width and height of a PangoLayout
958 	 * in device units. (pango_layout_get_size() returns the width
959 	 * and height scaled by PANGO_SCALE.) This
960 	 * is simply a convenience function around
961 	 * pango_layout_get_pixel_extents().
962 	 * Params:
963 	 * width = location to store the logical width, or NULL. [out][allow-none]
964 	 * height = location to store the logical height, or NULL. [out][allow-none]
965 	 */
966 	public void getPixelSize(out int width, out int height)
967 	{
968 		// void pango_layout_get_pixel_size (PangoLayout *layout,  int *width,  int *height);
969 		pango_layout_get_pixel_size(pangoLayout, &width, &height);
970 	}
971 	
972 	/**
973 	 * Gets the Y position of baseline of the first line in layout.
974 	 * Since 1.22
975 	 * Returns: baseline of first line, from top of layout.
976 	 */
977 	public int getBaseline()
978 	{
979 		// int pango_layout_get_baseline (PangoLayout *layout);
980 		return pango_layout_get_baseline(pangoLayout);
981 	}
982 	
983 	/**
984 	 * Retrieves the count of lines for the layout.
985 	 * Returns: the line count.
986 	 */
987 	public int getLineCount()
988 	{
989 		// int pango_layout_get_line_count (PangoLayout *layout);
990 		return pango_layout_get_line_count(pangoLayout);
991 	}
992 	
993 	/**
994 	 * Retrieves a particular line from a PangoLayout.
995 	 * Use the faster pango_layout_get_line_readonly() if you do not plan
996 	 * to modify the contents of the line (glyphs, glyph widths, etc.).
997 	 * Params:
998 	 * line = the index of a line, which must be between 0 and
999 	 * pango_layout_get_line_count(layout) - 1, inclusive.
1000 	 * Returns: the requested PangoLayoutLine, or NULL if the index is out of range. This layout line can be ref'ed and retained, but will become invalid if changes are made to the PangoLayout. [transfer none]
1001 	 */
1002 	public PgLayoutLine getLine(int line)
1003 	{
1004 		// PangoLayoutLine * pango_layout_get_line (PangoLayout *layout,  int line);
1005 		auto p = pango_layout_get_line(pangoLayout, line);
1006 		
1007 		if(p is null)
1008 		{
1009 			return null;
1010 		}
1011 		
1012 		return ObjectG.getDObject!(PgLayoutLine)(cast(PangoLayoutLine*) p);
1013 	}
1014 	
1015 	/**
1016 	 * Retrieves a particular line from a PangoLayout.
1017 	 * This is a faster alternative to pango_layout_get_line(),
1018 	 * but the user is not expected
1019 	 * to modify the contents of the line (glyphs, glyph widths, etc.).
1020 	 * Since 1.16
1021 	 * Params:
1022 	 * line = the index of a line, which must be between 0 and
1023 	 * pango_layout_get_line_count(layout) - 1, inclusive.
1024 	 * Returns: the requested PangoLayoutLine, or NULL if the index is out of range. This layout line can be ref'ed and retained, but will become invalid if changes are made to the PangoLayout. No changes should be made to the line. [transfer none]
1025 	 */
1026 	public PgLayoutLine getLineReadonly(int line)
1027 	{
1028 		// PangoLayoutLine * pango_layout_get_line_readonly (PangoLayout *layout,  int line);
1029 		auto p = pango_layout_get_line_readonly(pangoLayout, line);
1030 		
1031 		if(p is null)
1032 		{
1033 			return null;
1034 		}
1035 		
1036 		return ObjectG.getDObject!(PgLayoutLine)(cast(PangoLayoutLine*) p);
1037 	}
1038 	
1039 	/**
1040 	 * Returns the lines of the layout as a list.
1041 	 * Use the faster pango_layout_get_lines_readonly() if you do not plan
1042 	 * to modify the contents of the lines (glyphs, glyph widths, etc.).
1043 	 * Returns: a GSList containing the lines in the layout. This points to internal data of the PangoLayout and must be used with care. It will become invalid on any change to the layout's text or properties. [element-type Pango.LayoutLine][transfer none]
1044 	 */
1045 	public ListSG getLines()
1046 	{
1047 		// GSList * pango_layout_get_lines (PangoLayout *layout);
1048 		auto p = pango_layout_get_lines(pangoLayout);
1049 		
1050 		if(p is null)
1051 		{
1052 			return null;
1053 		}
1054 		
1055 		return ObjectG.getDObject!(ListSG)(cast(GSList*) p);
1056 	}
1057 	
1058 	/**
1059 	 * Returns the lines of the layout as a list.
1060 	 * This is a faster alternative to pango_layout_get_lines(),
1061 	 * but the user is not expected
1062 	 * to modify the contents of the lines (glyphs, glyph widths, etc.).
1063 	 * Since 1.16
1064 	 * Returns: a GSList containing the lines in the layout. This points to internal data of the PangoLayout and must be used with care. It will become invalid on any change to the layout's text or properties. No changes should be made to the lines. [element-type Pango.LayoutLine][transfer none]
1065 	 */
1066 	public ListSG getLinesReadonly()
1067 	{
1068 		// GSList * pango_layout_get_lines_readonly (PangoLayout *layout);
1069 		auto p = pango_layout_get_lines_readonly(pangoLayout);
1070 		
1071 		if(p is null)
1072 		{
1073 			return null;
1074 		}
1075 		
1076 		return ObjectG.getDObject!(ListSG)(cast(GSList*) p);
1077 	}
1078 	
1079 	/**
1080 	 * Returns an iterator to iterate over the visual extents of the layout.
1081 	 * Returns: the new PangoLayoutIter that should be freed using pango_layout_iter_free().
1082 	 */
1083 	public PgLayoutIter getIter()
1084 	{
1085 		// PangoLayoutIter * pango_layout_get_iter (PangoLayout *layout);
1086 		auto p = pango_layout_get_iter(pangoLayout);
1087 		
1088 		if(p is null)
1089 		{
1090 			return null;
1091 		}
1092 		
1093 		return ObjectG.getDObject!(PgLayoutIter)(cast(PangoLayoutIter*) p);
1094 	}
1095 }