Next: , Previous: Fonts, Up: Top

## 4 Glyph Storage

Structures for storing information about glyphs

### 4.1 Overview

`pango-shape` produces a string of glyphs which can be measured or drawn to the screen. The following structures are used to store information about glyphs.

### 4.2 Usage

— Class: <pango-matrix>

Derives from `<gboxed>`.

This class defines no direct slots.

— Class: <pango-glyph-string>

Derives from `<gboxed>`.

This class defines no direct slots.

— Function: pango-matrix-copy (self `<pango-matrix>`) ⇒  (ret `<pango-matrix>`)

Copies a `<pango-matrix>`.

matrix
a `<pango-matrix>`, can be ‘`#f`
ret
the newly allocated `<pango-matrix>`, which should be freed with `pango-matrix-free`, or ‘`#f`’ if matrix was ‘`#f`’.

Since 1.6

— Function: pango-matrix-translate (self `<pango-matrix>`) (tx `double`) (ty `double`)

Changes the transformation represented by matrix to be the transformation given by first translating by (tx, ty) then applying the original transformation.

matrix
a `<pango-matrix>`
tx
amount to translate in the X direction
ty
amount to translate in the Y direction

Since 1.6

— Function: pango-matrix-scale (self `<pango-matrix>`) (scale_x `double`) (scale_y `double`)

Changes the transformation represented by matrix to be the transformation given by first scaling by sx in the X direction and sy in the Y direction then applying the original transformation.

matrix
a `<pango-matrix>`
scale-x
amount to scale by in X direction
scale-y
amount to scale by in Y direction

Since 1.6

— Function: pango-matrix-rotate (self `<pango-matrix>`) (degrees `double`)

Changes the transformation represented by matrix to be the transformation given by first rotating by degrees degrees counter-clockwise then applying the original transformation.

matrix
a `<pango-matrix>`
degrees
degrees to rotate counter-clockwise

Since 1.6

— Function: pango-matrix-concat (self `<pango-matrix>`) (new_matrix `<pango-matrix>`)

Changes the transformation represented by matrix to be the transformation given by first applying transformation given by new-matrix then applying the original transformation.

matrix
a `<pango-matrix>`
new-matrix
a `<pango-matrix>`

Since 1.6

— Function: pango-matrix-get-font-scale-factor (self `<pango-matrix>`) ⇒  (ret `double`)

Returns the scale factor of a matrix on the height of the font. That is, the scale factor in the direction perpendicular to the vector that the X coordinate is mapped to.

matrix
a `<pango-matrix>`, may be ‘`#f`
ret
the scale factor of matrix on the height of the font, or 1.0 if matrix is ‘`#f`’.

Since 1.12

— Function: pango-glyph-string-new ⇒  (ret `<pango-glyph-string>`)

Create a new `<pango-glyph-string>`.

ret
the newly allocated `<pango-glyph-string>`, which should be freed with `pango-glyph-string-free`.
— Function: pango-glyph-string-copy (self `<pango-glyph-string>`) ⇒  (ret `<pango-glyph-string>`)

Copy a glyph string and associated storage.

string
a `<pango-glyph-string>`.
ret
the newly allocated `<pango-glyph-string>`, which should be freed with `pango-glyph-string-free`.
— Function: pango-glyph-string-set-size (self `<pango-glyph-string>`) (new_len `int`)

Resize a glyph string to the given length.

string
a `<pango-glyph-string>`.
new-len
the new length of the string.
— Function: pango-glyph-string-extents (self `<pango-glyph-string>`) (font `<pango-font>`) ⇒  (ink_rect `<pango-rectangle>`) (logical_rect `<pango-rectangle>`)

Compute the logical and ink extents of a glyph string. See the documentation for `pango-font-get-glyph-extents` for details about the interpretation of the rectangles.

glyphs
a `<pango-glyph-string>`
font
a `<pango-font>`
ink-rect
rectangle used to store the extents of the glyph string as drawn or ‘`#f`’ to indicate that the result is not needed.
logical-rect
rectangle used to store the logical extents of the glyph string or ‘`#f`’ to indicate that the result is not needed.
— Function: pango-glyph-string-extents-range (self `<pango-glyph-string>`) (start `int`) (end `int`) (font `<pango-font>`) ⇒  (ink_rect `<pango-rectangle>`) (logical_rect `<pango-rectangle>`)

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

glyphs
a `<pango-glyph-string>`
start
start index
end
end index (the range is the set of bytes with indices such that start <= index < end)
font
a `<pango-font>`
ink-rect
rectangle used to store the extents of the glyph string range as drawn or ‘`#f`’ to indicate that the result is not needed.
logical-rect
rectangle used to store the logical extents of the glyph string range or ‘`#f`’ to indicate that the result is not needed.
— Function: pango-glyph-string-get-width (self `<pango-glyph-string>`) ⇒  (ret `int`)

Computes the logical width of the glyph string as can also be computed using `pango-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 glyphs.

glyphs
a `<pango-glyph-string>`
ret
the logical width of the glyph string.

Since 1.14