Font

Mechanica

Alias for NSFontDescriptor.SymbolicTraits.

  • Mechanica

    Applies the specified traits to self without changing the current size.

  • Mechanica

    Applies the bold trait.

    Example:

    let font = Font.preferredFont(forTextStyle: .body).bold() // iOS/tvOS/watchOS
    let font = Font.systemFont(ofSize: 16).bold() // macOS
    

    Note

    iOS, watchOS, tvOS

    Special care is required when working with a descriptor generated by preferredFont(forTextStyle:). Not all fonts support all traits. The headline font, for instance, is weighted according to the user’s preferred content size and even if you can strip the descriptor of its bold trait, the matching UIFont will be bold.

  • Mechanica

    Returns a new font removing the bold trait.

  • Mechanica

    Applies the italic trait.

    Example:

    let font = Font.preferredFont(forTextStyle: .body).italic() // iOS/tvOS/watchOS
    let font = Font.systemFont(ofSize: 16).italic() // macOS
    

    Note

    iOS, watchOS, tvOS

    Special care is required when working with a descriptor generated by preferredFont(forTextStyle:). Not all fonts support all traits. The headline font, for instance, is weighted according to the user’s preferred content size and even if you can strip the descriptor of its bold trait, the matching UIFont will be bold.

  • Mechanica

    Returns a new font removing the italic trait.

  • Mechanica

    Returns true if the font contains the bold trait.

  • Mechanica

    Returns true if the font contains the italic trait.