Skip to content

FontWeight

Mojo struct 🡭

FontWeight

@memory_only
struct FontWeight

A font’s normal/bold weight, defined here for the same reason FontSlant is.

Aliases

  • NORMAL = FontWeight(Int(0))
  • BOLD = FontWeight(Int(1))

Implemented traits

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

Methods

__init__

fn def __init__(out self, value: Int)

Prefer the NORMAL/BOLD comptime constants over constructing one directly.

Args:

  • value (Int): 0 for NORMAL, 1 for BOLD.
  • 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