Create a new pango.layout.Layout object with attributes initialized to default values for a particular pango.context.Context.
Forces recomputation of any state in the pango.layout.Layout that might depend on the layout's context.
Creates a deep copy-by-value of the layout.
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 pango.context.Context 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.
Gets the height of layout used for ellipsization.
Gets the paragraph indent width in Pango units.
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 pango.layout.Layout.
Retrieves the count of lines for the layout.
Retrieves a particular line from a pango.layout.Layout.
Gets the line spacing factor of layout.
Returns the lines of the layout as a list.
Returns the lines of the layout as a list.
Retrieves an array of logical attributes for each character in the layout.
Retrieves an array of logical attributes for each character in the layout.
Computes the logical and ink extents of layout in device units.
Determines the logical width and height of a pango.layout.Layout in device units.
Returns the current serial number of layout.
Obtains whether layout is in single paragraph mode.
Determines the logical width and height of a pango.layout.Layout in Pango units.
Gets the amount of spacing between the lines of the layout.
Gets the current pango.tab_array.TabArray used by this layout.
Gets the text in the layout.
Counts the number of unknown glyphs in layout.
Gets the width to which the lines of the pango.layout.Layout should wrap.
Gets the wrap mode for the layout.
Converts from byte index_ within the layout to line and X position.
Converts from an index within a pango.layout.Layout to the onscreen position corresponding to the grapheme at that index.
Queries whether the layout had to ellipsize any paragraphs.
Queries whether the layout had to wrap any paragraphs.
Computes a new cursor position from an old position and a direction.
Serializes the layout for later deserialization via pango.layout.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 the height to which the pango.layout.Layout should be ellipsized at.
Sets the width in Pango units to indent each paragraph.
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 layout text and attribute list from marked-up text.
Sets the layout text and attribute list from marked-up text.
Sets the single paragraph mode of layout.
Sets the amount of spacing in Pango units between the lines of the layout.
Sets the tabs to use for layout, overriding the default tabs.
Sets the text of the layout.
Sets the width to which the lines of the pango.layout.Layout should wrap or ellipsized.
Sets the wrap mode.
A convenience method to serialize a layout to a file.
Converts from X and Y position within a layout to the byte index to the character at that logical position.
Loads data previously created via pango.layout.Layout.serialize.
Set the GObject of a D ObjectG wrapper.
Get a pointer to the underlying C object.
Calls g_object_ref() on a GObject.
Calls g_object_unref() on a GObject.
Get the GType of an object.
GObject GType property.
Convenience method to return this cast to a type. For use in D with statements.
Template to get the D object from a C GObject and cast it to the given D object type.
Connect a D closure to an object signal.
Template for setting a GObject property.
Template for getting a GObject property.
Creates a binding between source_property on source and target_property on target.
Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.
This function is intended for #GObject implementations to re-enforce a floating[floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling gobject.object.ObjectG.refSink.
Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.
Gets a named field from the objects table of associations (see gobject.object.ObjectG.setData).
Gets a property of an object.
This function gets back user data pointers stored via gobject.object.ObjectG.setQdata.
Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.
Checks whether object has a floating[floating-ref] reference.
Emits a "notify" signal for the property property_name on object.
Emits a "notify" signal for the property specified by pspec on object.
Increase the reference count of object, and possibly remove the floating[floating-ref] reference, if object has a floating reference.
Releases all references to other objects. This can be used to break reference cycles.
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
Sets a property on an object.
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
This function gets back user data pointers stored via gobject.object.ObjectG.setQdata and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:
Reverts the effect of a previous call to gobject.object.ObjectG.freezeNotify. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.
This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling gobject.closure.Closure.invalidate on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, gobject.object.ObjectG.ref_ and gobject.object.ObjectG.unref are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.
Connect to Notify signal.
It is possible, as well, to ignore the 2-D setup, and simply treat the results of a pango.layout.Layout as a list of lines.
A pango.layout.Layout 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. pango.layout.Layout 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 pango.layout.Layout is initialized with a pango.context.Context, 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 pango.layout.Layout. 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:
| | | | --- | --- | |
|
|
|
|
|
|
|
|