Class
PangoLayout
since: 1.0
Description [src]
final class Pango.Layout : GObject.Object
{
/* No available fields */
}
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.
Available since: 1.0
Constructors
pango_layout_new
Create a new PangoLayout
object with attributes initialized to
default values for a particular PangoContext
.
since: 1.0
Instance methods
pango_layout_context_changed
Forces recomputation of any state in the PangoLayout
that
might depend on the layout’s context.
since: 1.0
pango_layout_get_alignment
Gets the alignment for the layout: how partial lines are positioned within the horizontal space available.
since: 1.0
pango_layout_get_auto_dir
Gets whether to calculate the base direction for the layout according to its contents.
since: 1.4
pango_layout_get_caret_pos
Given an index within a layout, determines the positions that of the strong and weak cursors if the insertion point is at that index.
since: 1.50
pango_layout_get_character_count
Returns the number of Unicode characters in the
the text of layout
.
since: 1.30
pango_layout_get_cursor_pos
Given an index within a layout, determines the positions that of the strong and weak cursors if the insertion point is at that index.
since: 1.0
pango_layout_get_direction
Gets the text direction at the given character position in layout
.
since: 1.46
pango_layout_get_iter
Returns an iterator to iterate over the visual extents of the layout.
since: 1.0
pango_layout_get_justify
Gets whether each complete line should be stretched to fill the entire width of the layout.
since: 1.0
pango_layout_get_justify_last_line
Gets whether the last line should be stretched to fill the entire width of the layout.
since: 1.50
pango_layout_get_log_attrs
Retrieves an array of logical attributes for each character in the layout
.
since: 1.0
pango_layout_get_log_attrs_readonly
Retrieves an array of logical attributes for each character in the layout
.
since: 1.30
pango_layout_get_pixel_extents
Computes the logical and ink extents of layout
in device units.
since: 1.0
pango_layout_get_pixel_size
Determines the logical width and height of a PangoLayout
in device units.
since: 1.0
pango_layout_get_single_paragraph_mode
Obtains whether layout
is in single paragraph mode.
since: 1.0
pango_layout_get_size
Determines the logical width and height of a PangoLayout
in Pango units.
since: 1.0
pango_layout_index_to_line_x
Converts from byte index_
within the layout
to line and X position.
since: 1.0
pango_layout_index_to_pos
Converts from an index within a PangoLayout
to the onscreen position
corresponding to the grapheme at that index.
since: 1.0
pango_layout_move_cursor_visually
Computes a new cursor position from an old position and a direction.
since: 1.0
pango_layout_serialize
Serializes the layout
for later deserialization via pango_layout_deserialize()
.
since: 1.50
pango_layout_set_alignment
Sets the alignment for the layout: how partial lines are positioned within the horizontal space available.
since: 1.0
pango_layout_set_auto_dir
Sets whether to calculate the base direction for the layout according to its contents.
since: 1.4
pango_layout_set_height
Sets the height to which the PangoLayout
should be ellipsized at.
since: 1.20
pango_layout_set_justify
Sets whether each complete line should be stretched to fill the entire width of the layout.
since: 1.0
pango_layout_set_justify_last_line
Sets whether the last line should be stretched to fill the entire width of the layout.
since: 1.50
pango_layout_set_markup_with_accel
Sets the layout text and attribute list from marked-up text.
since: 1.0
pango_layout_set_spacing
Sets the amount of spacing in Pango units between the lines of the layout.
since: 1.0
pango_layout_set_width
Sets the width to which the lines of the PangoLayout
should wrap or
get ellipsized.
since: 1.0
pango_layout_xy_to_index
Converts from X and Y position within a layout to the byte index to the character at that logical position.
since: 1.0
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
unstable since: 2.0