A PangoGlyphString is used to store strings of glyphs with geometry and
visual attribute information. The storage for the glyph information is owned
by the structure which simplifies memory management.
Members
handleObj
lib
retainedCallbacks
signalHandlerNames
signalSetterHandlers
Methods
PangoGlyphString (Handle = null)
Create a new PangoGlyphString.
@pHandle is an optional native handle or wrapper whose handle to adopt; when the native constructor is called.
toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.
@pSource is the raw handle, raw buffer, wrapper, or null.
@rA raw pointer carrier or null when no pointer is present.
getLib ()
Returns the opened native library for this generated wrapper.
@rThe opened native library.
handle ()
Returns the wrapped NativeHandle.
@rThe wrapped NativeHandle.
isNull ()
Returns true when the wrapped handle is null.
@rA bool.
describe ()
Returns a small string for debugging generated wrappers.
@rA string.
copy ()
Copy a glyph string and associated storage.
@rthe newly allocated PangoGlyphString.
extents (object font)
Compute the logical and ink extents of a glyph string. See the documentation for [method@Pango.Font.get_glyph_extents] for details about the interpretation of the rectangles. Examples of logical (red) and ink (green) rects:
@pfont is a PangoFont.
@pink_rect is rectangle used to store the extents of the glyph string as drawn.
@plogical_rect is rectangle used to store the logical extents of the glyph string.
@rNone.
extents_range (int start, int end, object font)
Computes the extents of a sub-portion of a glyph string. The extents are relative to the start of the glyph string range (the origin of their coordinate system is at the start of the range, not at the start of the entire glyph string).
@pstart is start index.
@pend is end index (the range is the set of bytes with indices such that start <= index < end).
@pfont is a PangoFont.
@pink_rect is rectangle used to store the extents of the glyph string range as drawn.
@plogical_rect is rectangle used to store the logical extents of the glyph string range.
@rNone.
free ()
Free a glyph string and associated storage.
@rNone.
get_logical_widths (string text, int length, int embedding_level)
Given a PangoGlyphString and corresponding text, determine the width corresponding to each character. When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters. See also [method@Pango.GlyphItem.get_logical_widths].
@ptext is the text corresponding to the glyphs.
@plength is the length of @text, in bytes.
@pembedding_level is the embedding level of the string.
@plogical_widths is an array whose length is the number of characters in text (equal to g_utf8_strlen (text, length) unless text has NUL bytes) to be filled in with the resulting character widths..
@rNone.
get_width ()
Computes the logical width of the glyph string. This can also be computed using [method@Pango.GlyphString.extents]. However, since this only computes the width, it's much faster. This is in fact only a convenience function that computes the sum of @geometry.width for each glyph in the
@glyphs. ``
@rthe logical width of the glyph string..
index_to_x (string text, int length, object analysis, int index_, bool trailing)
Converts from character position to x position. The X position is measured from the left edge of the run. Character positions are obtained using font metrics for ligatures where available, and computed by dividing up each cluster into equal portions, otherwise.
@ptext is the text for the run.
@plength is the number of bytes (not characters) in @text..
@panalysis is the analysis information return from [func@itemize].
@pindex_ is the byte index within @text.
@ptrailing is whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character..
@px_pos is location to store result.
@rNone.
index_to_x_full (string text, int length, object analysis, attrs, int index_, bool trailing)
Converts from character position to x position. This variant of [method@Pango.GlyphString.index_to_x] additionally accepts a PangoLogAttr array. The grapheme boundary information in it can be used to disambiguate positioning inside some complex clusters.
@ptext is the text for the run.
@plength is the number of bytes (not characters) in @text..
@panalysis is the analysis information return from [func@itemize].
@pattrs is PangoLogAttr array for @text.
@pindex_ is the byte index within @text.
@ptrailing is whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character..
@px_pos is location to store result.
@rNone.
set_size (int new_len)
Resize a glyph string to the given length.
@pnew_len is the new length of the string.
@rNone.
x_to_index (string text, int length, object analysis, int x_pos)
Convert from x offset to character position. Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.
@ptext is the text for the run.
@plength is the number of bytes (not characters) in text..
@panalysis is the analysis information return from [func@itemize].
@px_pos is the x offset (in Pango units).
@pindex_ is location to store calculated byte index within @text.
@ptrailing is location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.