Layout
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):
The following images demonstrate the effect of alignment and justification on the layout of text:
It is possible, as well, to ignore the 2-D setup, and simply treat the results of a PangoLayout
as a list of lines.
Skipped during bindings generation
parameter
attrs
: attrs: Out parameter is not supportedparameter
n_attrs
: n_attrs: Out parameter is not supportedparameter
width
: width: Out parameter is not supportedparameter
width
: width: Out parameter is not supportedparameter
line
: line: Out parameter is not supportedparameter
new_index
: new_index: Out parameter is not supportedparameter
accel_char
: accel_char: Out parameter is not supportedparameter
index
: index: Out parameter is not supported
Constructors
Functions
Forces recomputation of any state in the PangoLayout
that might depend on the layout's context.
Gets the alignment for the layout: how partial lines are positioned within the horizontal space available.
Gets the attribute list for the layout, if any.
Gets whether to calculate the base direction for the layout according to its contents.
Gets the Y position of baseline of the first line in @layout.
Given an index within a layout, determines the positions that of the strong and weak cursors if the insertion point is at that index.
Returns the number of Unicode characters in the the text of @layout.
Retrieves the PangoContext
used for this layout.
Given an index within a layout, determines the positions that of the strong and weak cursors if the insertion point is at that index.
Gets the text direction at the given character position in @layout.
Gets the type of ellipsization being performed for @layout.
Computes the logical and ink extents of @layout.
Gets the font description for the layout, if any.
Returns an iterator to iterate over the visual extents of the layout.
Gets whether each complete line should be stretched to fill the entire width of the layout.
Gets whether the last line should be stretched to fill the entire width of the layout.
Retrieves a particular line from a PangoLayout
.
Retrieves the count of lines for the @layout.
Retrieves a particular line from a PangoLayout
.
Gets the line spacing factor of @layout.
Returns the lines of the @layout as a list.
Computes the logical and ink extents of @layout in device units.
Obtains whether @layout is in single paragraph mode.
Gets the amount of spacing between the lines of the layout.
Counts the number of unknown glyphs in @layout.
Converts from an index within a PangoLayout
to the onscreen position corresponding to the grapheme at that index.
Queries whether the layout had to ellipsize any paragraphs.
Serializes the @layout for later deserialization via func@Pango.Layout.deserialize.
Sets the alignment for the layout: how partial lines are positioned within the horizontal space available.
Sets the text attributes for a layout object.
Sets whether to calculate the base direction for the layout according to its contents.
Sets the type of ellipsization being performed for @layout.
Sets the default font description for the layout.
Sets whether each complete line should be stretched to fill the entire width of the layout.
Sets whether the last line should be stretched to fill the entire width of the layout.
Sets a factor for line spacing.
Sets the single paragraph mode of @layout.
Sets the amount of spacing in Pango units between the lines of the layout.
A convenience method to serialize a layout to a file.