Skip to content
ttf
RawGlyphOutline

RawGlyphOutline

Mojo struct 🡭

RawGlyphOutline

@memory_only
struct RawGlyphOutline

A decoded glyph outline in plain-List form: on-curve/off-curve points plus per-contour end indices – FreeType’s FT_Outline shape (points, tags, contour ends) as owned Lists rather than raw C pointers, so this module has no pointer surface.

on_curve[i] corresponds to points_x[i]/points_y[i], and contour_ends[c] is the inclusive index of contour c’s last point, matching glyf’s endPtsOfContours and OpenType’s composite-glyph point renumbering – so every component’s contours land in this one flat structure with no special-casing.

Fields

  • points_x (List[Int])
  • points_y (List[Int])
  • on_curve (List[Bool])
  • contour_ends (List[Int])
  • cubic (Bool)

Implemented traits

AnyType, Deinitable, Movable

Methods

__init__

fn def __init__(out self)

Args:

  • self (Self)

Returns:

Self

copied

fn def copied(self) -> Self

An independent copy of this outline’s point lists.

Args:

  • self (Self)

Returns:

Self

bounding_box

fn def bounding_box(self) -> Tuple[Int, Int, Int, Int]

(xMin, yMin, xMax, yMax) across every point, computed from the point coordinate data the way the OpenType spec defines a glyph’s bounding box (“obtained directly from the point coordinate data for the glyph, comparing all on-curve and off-curve points”), rather than from the glyf header’s xMin/yMin/xMax/yMax. Those exist only for simple glyphs, while scanning the assembled post-transform point list also covers composite ones. A glyph with no points (whitespace) returns all zeros.

Args:

  • self (Self)

Returns:

Tuple[Int, Int, Int, Int]