Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PangoGlyphItem

[15:7] extends: object

A PangoGlyphItem is a pair of a PangoItem and the glyphs resulting from shaping the items text. As an example of the usage of PangoGlyphItem, the results of shaping text with PangoLayout is a list of PangoLayoutLine, each of which contains a list of PangoGlyphItem.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • PangoGlyphItem (Handle = null)

    Creates a new GlyphItem by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • 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.
  • apply_attrs (string text, object arg2List)

    Splits a shaped item (PangoGlyphItem) into multiple items based on an attribute list. The idea is that if you have attributes that don't affect shaping, such as color or underline, to avoid affecting shaping, you filter them out ([method@Pango.AttrList.filter]), apply the shaping process and then reapply them to the result using this function. All attributes that start or end inside a cluster are applied to that cluster; for instance, if half of a cluster is underlined and the other-half strikethrough, then the cluster will end up with both underline and strikethrough attributes. In these cases, it may happen that @item->extra_attrs for some of the result items can have multiple attributes of the same type. This function takes ownership of

    • @glyph_item; it will be reused as one of the elements in the list.
    • @p text is text that @list applies to.
    • @p list is a PangoAttrList.
    • @r a list of glyph items resulting from splitting @glyph_item. Free the elements using [method@Pango.GlyphItem.free], the list using g_slist_free()..
  • copy ()

    Make a deep copy of an existing PangoGlyphItem structure.

    • @r the newly allocated PangoGlyphItem.
  • free ()

    Frees a PangoGlyphItem and resources to which it points.

    • @r None.
  • get_logical_widths (string text)

    Given a PangoGlyphItem and the 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.GlyphString.get_logical_widths]. FRAGILE: the result length is the glyph item's num_chars, which lives two structs deep (glyph_item->item->num_chars). PangoGlyphItem is an opaque handle with no field accessor, so num_chars is read by overlaying minimal struct layouts that hardcode the public, ABI-stable PangoItem field order (offset, length, num_chars). A PangoItem ABI change ahead of num_chars would break the size.

    • @p text is text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text).
    • @p logical_widths is an array whose length is the number of characters in glyph_item (equal to glyph_item->item->num_chars) to be filled in with the resulting character widths..
    • @r None.
  • letter_space (string text, list log_attrs, int letter_spacing)

    Adds spacing between the graphemes of @glyph_item to give the effect of typographic letter spacing.

    • @p text is text that @glyph_item corresponds to (glyph_item->item->offset is an offset from the start of @text).
    • @p log_attrs is logical attributes for the item (the first logical attribute refers to the position before the first character in the item).
    • @p letter_spacing is amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results..
    • @r None.
  • split (string text, int split_index)

    Modifies @orig to cover only the text after @split_index, and returns a new item that covers the text before @split_index that used to be in

    • @orig. You can think of @split_index as the length of the returned item.
    • @split_index may not be 0, and it may not be greater than or equal to the length of @orig (that is, there must be at least one byte assigned to each item, you can't create a zero-length item). This function is similar in function to pango_item_split() (and uses it internally.)
    • @p text is text to which positions in @orig apply.
    • @p split_index is byte index of position to split item, relative to the start of the item.
    • @r the newly allocated item representing text before @split_index, which should be freed with pango_glyph_item_free()..
  • apply_attrs_list ()

    Returns apply_attrs as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use apply_attrs() when lazy or change-notify access is required.

    • @r An Aussom list of elements.