W Wrapl, The Programming Language

Libraries:Gtk:Pango:Layout

Types

T

Inherits from:

Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New(context @ Gtk.Pango.Context.T) : Gtk.Pango.Layout.T

Create a new T object with attributes initialized to default values for a particular Gtk.Pango.Context.T.

context a Gtk.Pango.Context.T
Returns the newly allocated T, with a reference count of one, which should be freed with g_object_unref().


Methods

:ContextChanged(self @ T) : Std.Object.T

Forces recomputation of any state in the T that might depend on the layout's context. This function should be called if you make changes to the context subsequent to creating the layout.

layout a T


:Copy(self @ T) : Gtk.Pango.Layout.T

Does a deep copy-by-value of the src layout. The attribute list, tab array, and text from the original layout are all copied by value.

src a T
Returns the newly allocated T, with a reference count of one, which should be freed with g_object_unref(). [transfer full]


:GetAlignment(self @ T) : Gtk.Pango.Alignment.T

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

layout a T
Returns the alignment.


:GetAttributes(self @ T) : Gtk.Pango.AttrList.T

Gets the attribute list for the layout, if any.

layout a T
Returns a Gtk.Pango.AttrList.T.


:GetAutoDir(self @ T) : Std.Symbol.T

Gets whether to calculate the bidirectional base direction for the layout according to the contents of the layout. See SetAutoDir.

layout a T
Returns TRUE if the bidirectional base direction is computed from the layout's contents, FALSE otherwise.


:GetBaseline(self @ T) : Std.Integer.SmallT

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

layout a T
Returns baseline of first line, from top of layout.


:GetContext(self @ T) : Gtk.Pango.Context.T

Retrieves the Gtk.Pango.Context.T used for this layout.

layout a T
Returns the Gtk.Pango.Context.T for the layout. This does not have an additional refcount added, so if you want to keep a copy of this around, you must reference it yourself. [transfer none]


:GetCursorPos(self @ T, index_ @ Std.Integer.SmallT, strong_pos @ Gtk.Pango.Rectangle.T, weak_pos @ Gtk.Pango.Rectangle.T) : Std.Object.T

Given an index within a layout, determines the positions that of the strong and weak cursors if the insertion point is at that index. The position of each cursor is stored as a zero-width rectangle. The strong cursor location is the location where characters of the directionality equal to the base direction of the layout are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction of the layout are inserted.

layout a T
index_ the byte index of the cursor
strong_pos location to store the strong cursor position (may be NULL). [out][allow-none]
weak_pos location to store the weak cursor position (may be NULL). [out][allow-none]


:GetEllipsize(self @ T) : Gtk.Pango.EllipsizeMode.T

Gets the type of ellipsization being performed for layout. See SetEllipsize

layout a T
Returns the current ellipsization mode for layout. Use IsEllipsized to query whether any paragraphs were actually ellipsized.


:GetExtents(self @ T, ink_rect @ Gtk.Pango.Rectangle.T, logical_rect @ Gtk.Pango.Rectangle.T) : Std.Object.T

Computes the logical and ink extents of layout. Logical extents are usually what you want for positioning things. Note that both extents may have non-zero x and y. You may want to use those to offset where you render the layout. Not doing that is a very typical bug that shows up as right-to-left layouts not being correctly positioned in a layout with a set width.

The extents are given in layout coordinates and in Pango units; layout coordinates begin at the top left corner of the layout.

layout a T
ink_rect rectangle used to store the extents of the layout as drawn or NULL to indicate that the result is not needed. [out][allow-none]
logical_rect rectangle used to store the logical extents of the layout or NULL to indicate that the result is not needed. [out][allow-none]


:GetFontDescription(self @ T) : Gtk.Pango.FontDescription.T

Gets the font description for the layout, if any.

layout a T
Returns a pointer to the layout's font description, or NULL if the font description from the layout's context is inherited. This value is owned by the layout and must not be modified or freed.


:GetHeight(self @ T) : Std.Integer.SmallT

Gets the height of layout used for ellipsization. See SetHeight for details.

layout a T
Returns the height, in Pango units if positive, or number of lines if negative.


:GetIndent(self @ T) : Std.Integer.SmallT

Gets the paragraph indent width in Pango units. A negative value indicates a hanging indentation.

layout a T
Returns the indent in Pango units.


:GetIter(self @ T) : Gtk.Pango.LayoutIter.T

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

layout a T
Returns the new Gtk.Pango.LayoutIter.T that should be freed using Gtk.Pango.LayoutIter.Free.


:GetJustify(self @ T) : Std.Symbol.T

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

layout a T
Returns the justify.


:GetLine(self @ T, line @ Std.Integer.SmallT) : Gtk.Pango.LayoutLine.T

Retrieves a particular line from a T.

Use the faster GetLineReadonly if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

layout a T
line the index of a line, which must be between 0 and pango_layout_get_line_count(layout) - 1, inclusive.
Returns the requested Gtk.Pango.LayoutLine.T, or NULL if the index is out of range. This layout line can be ref'ed and retained, but will become invalid if changes are made to the T. [transfer none]


:GetLineCount(self @ T) : Std.Integer.SmallT

Retrieves the count of lines for the layout.

layout T
Returns the line count.


:GetLineReadonly(self @ T, line @ Std.Integer.SmallT) : Gtk.Pango.LayoutLine.T

Retrieves a particular line from a T.

This is a faster alternative to GetLine, but the user is not expected to modify the contents of the line (glyphs, glyph widths, etc.).

layout a T
line the index of a line, which must be between 0 and pango_layout_get_line_count(layout) - 1, inclusive.
Returns the requested Gtk.Pango.LayoutLine.T, or NULL if the index is out of range. This layout line can be ref'ed and retained, but will become invalid if changes are made to the T. No changes should be made to the line. [transfer none]


:GetLines(self @ T) : Std.Object.T

Returns the lines of the layout as a list.

Use the faster GetLinesReadonly if you do not plan to modify the contents of the lines (glyphs, glyph widths, etc.).

layout a T
Returns a GSList containing the lines in the layout. This points to internal data of the T and must be used with care. It will become invalid on any change to the layout's text or properties. [element-type Pango.LayoutLine][transfer none]


:GetLinesReadonly(self @ T) : Std.Object.T

Returns the lines of the layout as a list.

This is a faster alternative to GetLines, but the user is not expected to modify the contents of the lines (glyphs, glyph widths, etc.).

layout a T
Returns a GSList containing the lines in the layout. This points to internal data of the T and must be used with care. It will become invalid on any change to the layout's text or properties. No changes should be made to the lines. [element-type Pango.LayoutLine][transfer none]


:GetLogAttrs(self @ T, attrs @ Std.Object.T, n_attrs @ Std.Object.T) : Std.Object.T

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

layout a T
attrs location to store a pointer to an array of logical attributes This value must be freed with g_free(). [out][array length=n_attrs][transfer container]
n_attrs location to store the number of the attributes in the array. (The stored value will be one more than the total number of characters in the layout, since there need to be attributes corresponding to both the position before the first character and the position after the last character.)


:GetPixelExtents(self @ T, ink_rect @ Gtk.Pango.Rectangle.T, logical_rect @ Gtk.Pango.Rectangle.T) : Std.Object.T

Computes the logical and ink extents of layout in device units. This function just calls GetExtents followed by two Gtk.Pango.Global.ExtentsToPixels calls, rounding ink_rect and logical_rect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to Gtk.Pango.Global.ExtentsToPixels).

layout a T
ink_rect rectangle used to store the extents of the layout as drawn or NULL to indicate that the result is not needed. [out][allow-none]
logical_rect rectangle used to store the logical extents of the layout or NULL to indicate that the result is not needed. [out][allow-none]


:GetPixelSize(self @ T, width, height) : Std.Object.T

Determines the logical width and height of a T in device units. (GetSize returns the width and height scaled by PANGO_SCALE.) This is simply a convenience function around GetPixelExtents.

layout a T
width location to store the logical width, or NULL. [out][allow-none]
height location to store the logical height, or NULL. [out][allow-none]


:GetSingleParagraphMode(self @ T) : Std.Symbol.T

Obtains the value set by SetSingleParagraphMode.

layout a T
Returns TRUE if the layout does not break paragraphs at paragraph separator characters, FALSE otherwise.


:GetSize(self @ T, width, height) : Std.Object.T

Determines the logical width and height of a T in Pango units (device units scaled by PANGO_SCALE). This is simply a convenience function around GetExtents.

layout a T
width location to store the logical width, or NULL. [out caller-allocates][allow-none]
height location to store the logical height, or NULL. [out caller-allocates][allow-none]


:GetSpacing(self @ T) : Std.Integer.SmallT

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

layout a T
Returns the spacing in Pango units.


:GetTabs(self @ T) : Gtk.Pango.TabArray.T

Gets the current Gtk.Pango.TabArray.T used by this layout. If no Gtk.Pango.TabArray.T has been set, then the default tabs are in use and NULL is returned. Default tabs are every 8 spaces. The return value should be freed with Gtk.Pango.TabArray.Free.

layout a T
Returns a copy of the tabs for this layout, or NULL.


:GetText(self @ T) : Std.String.T

Gets the text in the layout. The returned text should not be freed or modified.

layout a T
Returns the text in the layout.


:GetUnknownGlyphsCount(self @ T) : Std.Integer.SmallT

Counts the number unknown glyphs in layout. That is, zero if glyphs for all characters in the layout text were found, or more than zero otherwise.

This function can be used to determine if there are any fonts available to render all characters in a certain string, or when used in combination with Gtk.Pango.AttrType.Fallback, to check if a certain font supports all the characters in the string.

layout a T
Returns The number of unknown glyphs in layout.


:GetWidth(self @ T) : Std.Integer.SmallT

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

layout a T
Returns the width in Pango units, or -1 if no width set.


:GetWrap(self @ T) : Gtk.Pango.WrapMode.T

Gets the wrap mode for the layout.

Use IsWrapped to query whether any paragraphs were actually wrapped.

layout a T
Returns active wrap mode.


:IndexToLineX(self @ T, index_ @ Std.Integer.SmallT, trailing @ Std.Symbol.T, line @ Std.Object.T, x_pos @ Std.Object.T) : Std.Object.T

Converts from byte index_ within the layout to line and X position. (X position is measured from the left edge of the line)

layout a T
index_ the byte index of a grapheme within the layout.
trailing an integer indicating the edge of the grapheme to retrieve the position of. If 0, the trailing edge of the grapheme, if > 0, the leading of the grapheme.
line location to store resulting line index. (which will between 0 and pango_layout_get_line_count(layout) - 1), or NULL. [out][allow-none]
x_pos location to store resulting position within line (PANGO_SCALE units per device unit), or NULL. [out][allow-none]


:IndexToPos(self @ T, index_ @ Std.Integer.SmallT, pos @ Gtk.Pango.Rectangle.T) : Std.Object.T

Converts from an index within a T to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle. Note that pos->x is always the leading edge of the grapheme and pos->x + pos->width the trailing edge of the grapheme. If the directionality of the grapheme is right-to-left, then pos->width will be negative.

layout a T
index_ byte index within layout
pos rectangle in which to store the position of the grapheme. [out]


:IsEllipsized(self @ T) : Std.Symbol.T

Queries whether the layout had to ellipsize any paragraphs.

This returns TRUE if the ellipsization mode for layout is not Gtk.Pango.EllipsizeMode.None, a positive width is set on layout, and there are paragraphs exceeding that width that have to be ellipsized.

layout a T
Returns TRUE if any paragraphs had to be ellipsized, FALSE otherwise.


:IsWrapped(self @ T) : Std.Symbol.T

Queries whether the layout had to wrap any paragraphs.

This returns TRUE if a positive width is set on layout, ellipsization mode of layout is set to Gtk.Pango.EllipsizeMode.None, and there are paragraphs exceeding the layout width that have to be wrapped.

layout a T
Returns TRUE if any paragraphs had to be wrapped, FALSE otherwise.


:MoveCursorVisually(self @ T, strong @ Std.Symbol.T, old_index @ Std.Integer.SmallT, old_trailing @ Std.Integer.SmallT, direction @ Std.Integer.SmallT, new_index @ Std.Object.T, new_trailing @ Std.Object.T) : Std.Object.T

Computes a new cursor position from an old position and a count of positions to move visually. If direction is positive, then the new strong cursor position will be one position to the right of the old cursor position. If direction is negative, then the new strong cursor position will be one position to the left of the old cursor position.

In the presence of bidirectional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off of the end of a run.

Motion here is in cursor positions, not in characters, so a single call to MoveCursorVisually may move the cursor over multiple characters when multiple characters combine to form a single grapheme.

layout a T.
strong whether the moving cursor is the strong cursor or the weak cursor. The strong cursor is the cursor corresponding to text insertion in the base direction for the layout.
old_index the byte index of the grapheme for the old index
old_trailing if 0, the cursor was at the trailing edge of the grapheme indicated by old_index, if > 0, the cursor was at the leading edge.
direction direction to move cursor. A negative value indicates motion to the left.
new_index location to store the new cursor byte index. A value of -1 indicates that the cursor has been moved off the beginning of the layout. A value of G_MAXINT indicates that the cursor has been moved off the end of the layout. [out]
new_trailing number of characters to move forward from the location returned for new_index to get the position where the cursor should be displayed. This allows distinguishing the position at the beginning of one line from the position at the end of the preceding line. new_index is always on the line where the cursor should be displayed.


:SetAlignment(self @ T, alignment @ Gtk.Pango.Alignment.T) : Std.Object.T

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

layout a T
alignment the alignment


:SetAttributes(self @ T, attrs @ Gtk.Pango.AttrList.T) : Std.Object.T

Sets the text attributes for a layout object. References attrs, so the caller can unref its reference.

layout a T
attrs a Gtk.Pango.AttrList.T, can be NULL. [allow-none][transfer full]


:SetAutoDir(self @ T, auto_dir @ Std.Symbol.T) : Std.Object.T

Sets whether to calculate the bidirectional base direction for the layout according to the contents of the layout; when this flag is on (the default), then paragraphs in layout that begin with strong right-to-left characters (Arabic and Hebrew principally), will have right-to-left layout, paragraphs with letters from other scripts will have left-to-right layout. Paragraphs with only neutral characters get their direction from the surrounding paragraphs.

When FALSE, the choice between left-to-right and right-to-left layout is done according to the base direction of the layout's Gtk.Pango.Context.T. (See Gtk.Pango.Context.SetBaseDir).

When the auto-computed direction of a paragraph differs from the base direction of the context, the interpretation of Gtk.Pango.Alignment.Left and Gtk.Pango.Alignment.Right are swapped.

layout a T
auto_dir if TRUE, compute the bidirectional base direction from the layout's contents.


:SetEllipsize(self @ T, ellipsize @ Gtk.Pango.EllipsizeMode.T) : Std.Object.T

Sets the type of ellipsization being performed for layout. Depending on the ellipsization mode ellipsize text is removed from the start, middle, or end of text so they fit within the width and height of layout set with SetWidth and SetHeight.

If the layout contains characters such as newlines that force it to be layed out in multiple paragraphs, then whether each paragraph is ellipsized separately or the entire layout is ellipsized as a whole depends on the set height of the layout. See SetHeight for details.

layout a T
ellipsize the new ellipsization mode for layout


:SetFontDescription(self @ T, desc @ Gtk.Pango.FontDescription.T) : Std.Object.T

Sets the default font description for the layout. If no font description is set on the layout, the font description from the layout's context is used.

layout a T
desc the new Gtk.Pango.FontDescription.T, or NULL to unset the current font description. [allow-none]


:SetHeight(self @ T, height @ Std.Integer.SmallT) : Std.Object.T

Sets the height to which the T should be ellipsized at. There are two different behaviors, based on whether height is positive or negative.

If height is positive, it will be the maximum height of the layout. Only lines would be shown that would fit, and if there is any text omitted, an ellipsis added. At least one line is included in each paragraph regardless of how small the height value is. A value of zero will render exactly one line for the entire layout.

If height is negative, it will be the (negative of) maximum number of lines per paragraph. That is, the total number of lines shown may well be more than this value if the layout contains multiple paragraphs of text. The default value of -1 means that first line of each paragraph is ellipsized. This behvaior may be changed in the future to act per layout instead of per paragraph. File a bug against pango at http://bugzilla.gnome.org/ if your code relies on this behavior.

Height setting only has effect if a positive width is set on layout and ellipsization mode of layout is not Gtk.Pango.EllipsizeMode.None. The behavior is undefined if a height other than -1 is set and ellipsization mode is set to Gtk.Pango.EllipsizeMode.None, and may change in the future.

layout a T.
height the desired height of the layout in Pango units if positive, or desired number of lines if negative.


:SetIndent(self @ T, indent @ Std.Integer.SmallT) : Std.Object.T

Sets the width in Pango units to indent each paragraph. A negative value of indent will produce a hanging indentation. That is, the first line will have the full width, and subsequent lines will be indented by the absolute value of indent.

The indent setting is ignored if layout alignment is set to Gtk.Pango.Alignment.Center.

layout a T.
indent the amount by which to indent.


:SetJustify(self @ T, justify @ Std.Symbol.T) : Std.Object.T

Sets whether each complete line should be stretched to fill the entire width of the layout. This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification may be done in more complex ways, like extending the characters.

Note that this setting is not implemented and so is ignored in Pango older than 1.18.

layout a T
justify whether the lines in the layout should be justified.


:SetMarkup(self @ T, markup @ Std.String.T, length @ Std.Integer.SmallT) : Std.Object.T

Same as SetMarkupWithAccel, but the markup text isn't scanned for accelerators.

layout a T
markup marked-up text
length length of marked-up text in bytes, or -1 if markup is null-terminated


:SetMarkupWithAccel(self @ T, markup @ Std.String.T, length @ Std.Integer.SmallT, accel_marker @ Std.Integer.SmallT, accel_char @ Std.Object.T) : Std.Object.T

Sets the layout text and attribute list from marked-up text (see markup format). Replaces the current text and attribute list.

If accel_marker is nonzero, the given character will mark the character following it as an accelerator. For example, accel_marker might be an ampersand or underscore. All characters marked as an accelerator will receive a Gtk.Pango.Underline.Low attribute, and the first character so marked will be returned in accel_char. Two accel_marker characters following each other produce a single literal accel_marker character.

layout a T
markup marked-up text (see markup format)
length length of marked-up text in bytes, or -1 if markup is null-terminated
accel_marker marker for accelerators in the text
accel_char return location for first located accelerator, or NULL. [out caller-allocates][allow-none]


:SetSingleParagraphMode(self @ T, setting @ Std.Symbol.T) : Std.Object.T

If setting is TRUE, do not treat newlines and similar characters as paragraph separators; instead, keep all text in a single paragraph, and display a glyph for paragraph separator characters. Used when you want to allow editing of newlines on a single text line.

layout a T
setting new setting


:SetSpacing(self @ T, spacing @ Std.Integer.SmallT) : Std.Object.T

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

layout a T.
spacing the amount of spacing


:SetTabs(self @ T, tabs @ Gtk.Pango.TabArray.T) : Std.Object.T

Sets the tabs to use for layout, overriding the default tabs (by default, tabs are every 8 spaces). If tabs is NULL, the default tabs are reinstated. tabs is copied into the layout; you must free your copy of tabs yourself.

layout a T
tabs a Gtk.Pango.TabArray.T, or NULL. [allow-none]


:SetText(self @ T, text @ Std.String.T, length @ Std.Integer.SmallT) : Std.Object.T

Sets the text of the layout.

Note that if you have used SetMarkup or SetMarkupWithAccel on layout before, you may want to call SetAttributes to clear the attributes set on the layout from the markup as this function does not clear attributes.

layout a T
text a valid UTF-8 string
length maximum length of text, in bytes. -1 indicates that the string is nul-terminated and the length should be calculated. The text will also be truncated on encountering a nul-termination even when length is positive.


:SetWidth(self @ T, width @ Std.Integer.SmallT) : Std.Object.T

Sets the width to which the lines of the T should wrap or ellipsized. The default value is -1: no width set.

layout a T.
width the desired width in Pango units, or -1 to indicate that no wrapping or ellipsization should be performed.


:SetWrap(self @ T, wrap @ Gtk.Pango.WrapMode.T) : Std.Object.T

Sets the wrap mode; the wrap mode only has effect if a width is set on the layout with SetWidth. To turn off wrapping, set the width to -1.

layout a T
wrap the wrap mode


:XyToIndex(self @ T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT, index_ @ Std.Object.T, trailing @ Std.Object.T) : Std.Symbol.T

Converts from X and Y position within a layout to the byte index to the character at that logical position. If the Y position is not inside the layout, the closest position is chosen (the position will be clamped inside the layout). If the X position is not within the layout, then the start or the end of the line is chosen as described for pango_layout_x_to_index(). If either the X or Y positions were not inside the layout, then the function returns FALSE; on an exact hit, it returns TRUE.

layout a T
x the X offset (in Pango units) from the left edge of the layout.
y the Y offset (in Pango units) from the top edge of the layout
index_ location to store calculated byte index. [out]
trailing location to store a integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme. [out]
Returns TRUE if the coordinates were inside text, FALSE otherwise.