Skip to content

FontSlant

Mojo struct 🡭

FontSlant

@memory_only
struct FontSlant

A font’s upright/italic/oblique style. Defined here to keep this module independent of canvas.text; render.mojo re-exports it.

Aliases

  • NORMAL = FontSlant(Int(0))
  • ITALIC = FontSlant(Int(1))
  • OBLIQUE = FontSlant(Int(2))

Implemented traits

AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, Writable

Methods

__init__

fn def __init__(out self, value: Int)

Prefer the NORMAL/ITALIC/OBLIQUE comptime constants over constructing one directly.

Args:

  • value (Int): 0 for NORMAL, 1 for ITALIC, 2 for OBLIQUE.
  • self (Self)

Returns:

Self

__eq__

fn def __eq__(self, other: Self) -> Bool

Args:

  • self (Self)
  • other (Self)

Returns:

Bool

write_to

fn def write_to[W: Writer](self, mut writer: W)

Parameters:

  • W (Writer)

Args:

  • self (Self)
  • writer (W)

__str__

fn def __str__(self) -> String

Args:

  • self (Self)

Returns:

String