Skip to content
TextMetrics

TextMetrics

Mojo struct 🡭

TextMetrics

@memory_only
struct TextMetrics

A single line’s measured size. width/height are its tight ink bounding box; advance is the logical cursor-advance distance, which differs whenever leading/trailing whitespace contributes advance but no ink. TextAlign’s CENTER/RIGHT use advance.

Fields

  • width (Float64)
  • height (Float64)
  • advance (Float64)

Implemented traits

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable

Methods

__init__

fn def __init__(out self, width: Float64, height: Float64, advance: Float64)

A single line’s measured size.

Args:

  • width (Float64): Ink bounding box width.
  • height (Float64): Ink bounding box height.
  • advance (Float64): Logical cursor-advance distance.
  • self (Self)

Returns:

Self