Class

PangoLayout

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):

Pango Layout Parameters

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

align=left align=left, justify
align=center align=center, justify
align=right align=right, justify

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

Ancestors

Constructors

pango_layout_new

Create a new PangoLayout object with attributes initialized to default values for a particular PangoContext.

Functions

pango_layout_deserialize

Loads data previously created via pango_layout_serialize().

since: 1.50

Instance methods

pango_layout_context_changed

Forces recomputation of any state in the PangoLayout that might depend on the layout’s context.

pango_layout_copy

Creates a deep copy-by-value of the layout.

pango_layout_get_alignment

Gets the alignment for the layout: how partial lines are positioned within the horizontal space available.

pango_layout_get_attributes

Gets the attribute list for the layout, if any.

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_baseline

Gets the Y position of baseline of the first line in layout.

since: 1.22

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_context

Retrieves the PangoContext used for this layout.

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.

pango_layout_get_direction

Gets the text direction at the given character position in layout.

since: 1.46

pango_layout_get_ellipsize

Gets the type of ellipsization being performed for layout.

since: 1.6

pango_layout_get_extents

Computes the logical and ink extents of layout.

pango_layout_get_font_description

Gets the font description for the layout, if any.

since: 1.8

pango_layout_get_height

Gets the height of layout used for ellipsization.

since: 1.20

pango_layout_get_indent

Gets the paragraph indent width in Pango units.

pango_layout_get_iter

Returns an iterator to iterate over the visual extents of the layout.

pango_layout_get_justify

Gets whether each complete line should be stretched to fill the entire width of the layout.

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_line

Retrieves a particular line from a PangoLayout.

pango_layout_get_line_count

Retrieves the count of lines for the layout.

pango_layout_get_line_readonly

Retrieves a particular line from a PangoLayout.

since: 1.16

pango_layout_get_line_spacing

Gets the line spacing factor of layout.

since: 1.44

pango_layout_get_lines

Returns the lines of the layout as a list.

pango_layout_get_lines_readonly

Returns the lines of the layout as a list.

since: 1.16

pango_layout_get_log_attrs

Retrieves an array of logical attributes for each character in the layout.

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.

pango_layout_get_pixel_size

Determines the logical width and height of a PangoLayout in device units.

pango_layout_get_serial

Returns the current serial number of layout.

since: 1.32.4

pango_layout_get_single_paragraph_mode

Obtains whether layout is in single paragraph mode.

pango_layout_get_size

Determines the logical width and height of a PangoLayout in Pango units.

pango_layout_get_spacing

Gets the amount of spacing between the lines of the layout.

pango_layout_get_tabs

Gets the current PangoTabArray used by this layout.

pango_layout_get_text

Gets the text in the layout.

pango_layout_get_unknown_glyphs_count

Counts the number of unknown glyphs in layout.

since: 1.16

pango_layout_get_width

Gets the width to which the lines of the PangoLayout should wrap.

pango_layout_get_wrap

Gets the wrap mode for the layout.

pango_layout_index_to_line_x

Converts from byte index_ within the layout to line and X position.

pango_layout_index_to_pos

Converts from an index within a PangoLayout to the onscreen position corresponding to the grapheme at that index.

pango_layout_is_ellipsized

Queries whether the layout had to ellipsize any paragraphs.

since: 1.16

pango_layout_is_wrapped

Queries whether the layout had to wrap any paragraphs.

since: 1.16

pango_layout_move_cursor_visually

Computes a new cursor position from an old position and a direction.

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.

pango_layout_set_attributes

Sets the text attributes for a layout object.

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_ellipsize

Sets the type of ellipsization being performed for layout.

since: 1.6

pango_layout_set_font_description

Sets the default font description for the layout.

pango_layout_set_height

Sets the height to which the PangoLayout should be ellipsized at.

since: 1.20

pango_layout_set_indent

Sets the width in Pango units to indent each paragraph.

pango_layout_set_justify

Sets whether each complete line should be stretched to fill the entire width of the layout.

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_line_spacing

Sets a factor for line spacing.

since: 1.44

pango_layout_set_markup

Sets the layout text and attribute list from marked-up text.

pango_layout_set_markup_with_accel

Sets the layout text and attribute list from marked-up text.

pango_layout_set_single_paragraph_mode

Sets the single paragraph mode of layout.

pango_layout_set_spacing

Sets the amount of spacing in Pango units between the lines of the layout.

pango_layout_set_tabs

Sets the tabs to use for layout, overriding the default tabs.

pango_layout_set_text

Sets the text of the layout.

pango_layout_set_width

Sets the width to which the lines of the PangoLayout should wrap or ellipsized.

pango_layout_set_wrap

Sets the wrap mode.

pango_layout_write_to_file

A convenience method to serialize a layout to a file.

since: 1.50

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.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

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.

Class structure

struct PangoLayoutClass {
  /* no available fields */
}

No description available.