2.17 <PangoGlyphString>

Structure: <PangoGlyphString>

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.

Fields

num-glyphs

number of glyphs in this glyph string

glyphs

array of glyph information

log-clusters

logical cluster info, indexed by the byte index within the text corresponding to the glyph string

Procedures

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

Copy a glyph string and associated storage.

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

%return

Returned: a <PangoGlyphString>, or #f.

the newly allocated <PangoGlyphString>

Method: glyph-string:extents! self font ink-rect logical-rect ⇒ ink-rect logical-rect
Method: extents! self font ink-rect logical-rect ⇒ ink-rect logical-rect

Compute the logical and ink extents of a glyph string.

See the documentation for font:get-glyph-extents! for details about the interpretation of the rectangles.

Examples of logical (red) and ink (green) rects:

![](rects1.png) ![](rects2.png)

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

font

Passed: a <PangoFont>.

a <PangoFont>

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the extents of the glyph string as drawn

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the logical extents of the glyph string

Method: glyph-string:extents-range! self start end font ink-rect logical-rect ⇒ ink-rect logical-rect
Method: extents-range! self start end font ink-rect logical-rect ⇒ ink-rect logical-rect

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

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

start

Passed: a 32-bit integer.

start index

end

Passed: a 32-bit integer.

end index (the range is the set of bytes with indices such that start <= index < end)

font

Passed: a <PangoFont>.

a <PangoFont>

ink-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the extents of the glyph string range as drawn

logical-rect

Passed, filled in, and returned: a <PangoRectangle>.

rectangle used to store the logical extents of the glyph string range

Method: glyph-string:free self
Method: free self

Free a glyph string and associated storage.

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>, may be #f

Method: glyph-string:get-logical-widths! self text length embedding-level logical-widths ⇒ logical-widths
Method: get-logical-widths! self text length embedding-level logical-widths ⇒ logical-widths

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

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

text

Passed: a string.

the text corresponding to the glyphs

length

Passed: a 32-bit integer.

the length of text, in bytes

embedding-level

Passed: a 32-bit integer.

the embedding level of the string

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 text (equal to g_utf8_strlen (text, length) unless text has NUL bytes) to be filled in with the resulting character widths.

Method: glyph-string:get-width self ⇒ %return
Method: get-width self ⇒ %return

Computes the logical width of the glyph string.

This can also be computed using glyph-string: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 self.

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

%return

Returned: a 32-bit integer.

the logical width of the glyph string.

Procedure: glyph-string:new ⇒ %return

Create a new <PangoGlyphString>.

%return

Returned: a <PangoGlyphString>.

the newly allocated <PangoGlyphString>, which should be freed with glyph-string:free.

Method: glyph-string:set-size self new-len
Method: set-size self new-len

Resize a glyph string to the given length.

self

Passed: a <PangoGlyphString>.

a <PangoGlyphString>.

new-len

Passed: a 32-bit integer.

the new length of the string