Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PangoGlyphString

[14:7] extends: object

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.

    • @p Handle 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.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • copy ()

    Copy a glyph string and associated storage.

    • @r the 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:

    • @p font is a PangoFont.
    • @p ink_rect is rectangle used to store the extents of the glyph string as drawn.
    • @p logical_rect is rectangle used to store the logical extents of the glyph string.
    • @r None.
  • 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).

    • @p start is start index.
    • @p end is end index (the range is the set of bytes with indices such that start <= index < end).
    • @p font is a PangoFont.
    • @p ink_rect is rectangle used to store the extents of the glyph string range as drawn.
    • @p logical_rect is rectangle used to store the logical extents of the glyph string range.
    • @r None.
  • free ()

    Free a glyph string and associated storage.

    • @r None.
  • 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].

    • @p text is the text corresponding to the glyphs.
    • @p length is the length of @text, in bytes.
    • @p embedding_level is the embedding level of the string.
    • @p logical_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..
    • @r None.
  • 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. ``
    • @r the 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. Glyph positions

    • @p text is the text for the run.
    • @p length is the number of bytes (not characters) in @text..
    • @p analysis is the analysis information return from [func@itemize].
    • @p index_ is the byte index within @text.
    • @p trailing is whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character..
    • @p x_pos is location to store result.
    • @r None.
  • 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.

    • @p text is the text for the run.
    • @p length is the number of bytes (not characters) in @text..
    • @p analysis is the analysis information return from [func@itemize].
    • @p attrs is PangoLogAttr array for @text.
    • @p index_ is the byte index within @text.
    • @p trailing is whether we should compute the result for the beginning (%FALSE) or end (%TRUE) of the character..
    • @p x_pos is location to store result.
    • @r None.
  • set_size (int new_len)

    Resize a glyph string to the given length.

    • @p new_len is the new length of the string.
    • @r None.
  • 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.

    • @p text is the text for the run.
    • @p length is the number of bytes (not characters) in text..
    • @p analysis is the analysis information return from [func@itemize].
    • @p x_pos is the x offset (in Pango units).
    • @p index_ is location to store calculated byte index within @text.
    • @p trailing is location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.
    • @r None.