Layout


Object Hierarchy:

Pango.Layout Pango.Layout Pango.Layout GLib.Object GLib.Object GLib.Object->Pango.Layout

Description:

[ CCode ( type_id = "pango_layout_get_type ()" ) ]
public sealed class Layout : Object

A `PangoLayout` structure represents an entire paragraph of text.

While complete access to the layout capabilities of Pango is provided using the detailed interfaces for itemization and shaping, using that functionality directly involves writing a fairly large amount of code. `PangoLayout` provides a high-level driver for formatting entire paragraphs of text at once. This includes paragraph-level functionality such as line breaking, justification, alignment and ellipsization.

A `PangoLayout` is initialized with a `PangoContext`, UTF-8 string and set of attributes for that string. Once that is done, the set of formatted lines can be extracted from the object, the layout can be rendered, and conversion between logical character positions within the layout's text, and the physical position of the resulting glyphs can be made.

There are a number of parameters to adjust the formatting of a `PangoLayout`. The following image shows adjustable parameters (on the left) and font metrics (on the right):

<picture> <source srcset="layout-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Pango Layout Parameters" src="layout-light.png"> </picture>

The following images demonstrate the effect of alignment and justification on the layout of text:

| | | | --- | --- | | ![align=left](align-left.png) | ![align=left, justify](align-left-justify.png) | | ![align=center](align-center.png) | ![ align=center, justify](align-center-justify.png) | | ![align=right](align-right.png) | ![align=right, justify](align-right-justify.png) |

It is possible, as well, to ignore the 2-D setup, and simply treat the results of a `PangoLayout` as a list of lines.


Namespace: Pango
Package: pango

Content:

Static methods:

Creation methods:

Methods:

Inherited Members: