Font
classin packageklyn.gui.windows
public class Font implements ValueType:
Font
All Implemented Interfaces: ValueType

Immutable font used by window widgets.

A font combines one operating-system family, a pixel size and the two styles currently supported by the Klyn text renderer. Assign it to Widget.font; KSS can still override widgets that keep the default font.

title = Label("Klyn")
title.font = Font("Noto Sans", 24, bold=true)
Properties
Modifier and Type Member Description
public readonly property bold
bold as Boolean
Whether the bold face is requested.
public readonly property family
family as String
Operating-system font family, or a comma-separated fallback list.
public readonly property italic
italic as Boolean
Whether the italic face is requested.
public readonly property size
size as Int
Font size expressed in logical pixels.
Constructors
Modifier and Type Member Description
public Font
Font( family as String = "Segoe UI Variable Text, Segoe UI, SF Pro Text, Helvetica Neue, DejaVu Sans, Arial, sans-serif", size as Int = 13, bold as Boolean = false, italic as Boolean = false ):
Creates an immutable font.
Methods
Modifier and Type Member Description
public static installedFamilies
installedFamilies() as ArrayList<String>:
Lists font families exposed by the current operating system.
public static parse
parse(description as String) as Font:
Parses the font description consumed by Painter and KSS.
public override toString
toString() as String:
Returns the CSS-like description consumed by the Klyn painter.
public withBold
withBold(bold as Boolean = true) as Font:
Returns a copy with the requested bold state.
public withItalic
withItalic(italic as Boolean = true) as Font:
Returns a copy with the requested italic state.
public withSize
withSize(size as Int) as Font:
Returns a copy with another size.