2.15 <PangoGlyphItem>

Structure: <PangoGlyphItem>

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>.

Fields

item

corresponding <PangoItem>

glyphs

corresponding <PangoGlyphString>

y-offset

shift of the baseline, relative to the baseline of the containing line. Positive values shift upwards

start-x-offset

horizontal displacement to apply before the glyph item. Positive values shift right

end-x-offset

horizontal displacement to apply after th glyph item. Positive values shift right

Procedures

Method: glyph-item:apply-attrs self text list ⇒ %return
Method: apply-attrs self text list ⇒ %return

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 (attr-list: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 self; it will be reused as one of the elements in the list.

self

Passed: a <PangoGlyphItem>.

a shaped item

text

Passed: a string.

text that list applies to

list

Passed: a <PangoAttrList>.

a <PangoAttrList>

%return

Returned: a list, each a <PangoGlyphItem>.

a list of glyph items resulting from splitting self. Free the elements using glyph-item:free, the list using g_slist_free().

Method: glyph-item:copy self ⇒ %return
Method: copy self ⇒ %return

Make a deep copy of an existing <PangoGlyphItem> structure.

self

Passed: a <PangoGlyphItem>.

a <PangoGlyphItem>

%return

Returned: a <PangoGlyphItem>, or #f.

the newly allocated <PangoGlyphItem>

Method: glyph-item:free self
Method: free self

Frees a <PangoGlyphItem> and resources to which it points.

self

Passed: a <PangoGlyphItem>.

a <PangoGlyphItem>

Method: glyph-item:get-logical-widths! self text logical-widths ⇒ logical-widths
Method: get-logical-widths! self text logical-widths ⇒ logical-widths

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 glyph-string:get-logical-widths!.

self

Passed: a <PangoGlyphItem>.

a <PangoGlyphItem>

text

Passed: a string.

text that self corresponds to (glyph_item->item->offset is an offset from the start of text)

logical-widths

Passed: a foreign pointer, or a bytevector. It is filled in, and returned: a foreign pointer.

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.

Method: glyph-item:letter-space self text log-attrs letter-spacing
Method: letter-space self text log-attrs letter-spacing

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

self

Passed: a <PangoGlyphItem>.

a <PangoGlyphItem>

text

Passed: a string.

text that self corresponds to (glyph_item->item->offset is an offset from the start of text)

log-attrs

Passed: a foreign pointer, or a bytevector.

logical attributes for the item (the first logical attribute refers to the position before the first character in the item)

letter-spacing

Passed: a 32-bit integer.

amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results.

Method: glyph-item:split self text split-index ⇒ %return
Method: split self text split-index ⇒ %return

Modifies self 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 self.

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 self (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 item:split (and uses it internally.)

self

Passed: a <PangoGlyphItem>.

a <PangoItem>

text

Passed: a string.

text to which positions in self apply

split-index

Passed: a 32-bit integer.

byte index of position to split item, relative to the start of the item

%return

Returned: a <PangoGlyphItem>, or #f.

the newly allocated item representing text before split-index, which should be freed with glyph-item:free.