Skip to content

glyph_path

Mojo function 🡭

glyph_path

fn def glyph_path(mut face: TTFFace, codepoint: Int, pen_x: Float64, pen_y: Float64) -> Path

One character’s outline as a Path, positioned so its local (0, 0) – the glyph origin – lands at (pen_x, pen_y) in pixel space. The caller advances the pen by glyph_metrics(face, codepoint).advance before the next character.

A glyph with no outline (whitespace maps to a valid glyph index with zero contours) returns an empty Path.

Args:

  • face (TTFFace): Face to read the glyph from, with a pixel size already set.
  • codepoint (Int): Unicode codepoint to render.
  • pen_x (Float64): Glyph origin x, in pixel space.
  • pen_y (Float64): Glyph origin y, in pixel space.

Returns:

Path: The glyph’s outline as a Path, positioned at (pen_x, pen_y).

Raises: