Fonts - Factor Documentation (original) (raw)

The fonts vocabulary implements a data type for fonts that other vocabularies, for example UI framework, can use. A font combines a font name, size, style, and color information into a single object.
font
( name -- font )

Modifying fonts:

font-with-foreground ( font color -- font' )

font-with-background ( font color -- font' )

Useful constructors:

monospace-font ( -- font )

sans-serif-font ( -- font )
serif-font ( -- font )

Variables controlling default values:

default-font-size ( -- size )

default-font-foreground ( -- color )
default-font-background ( -- color )
default-monospace-font-name ( -- name )
default-sans-serif-font-name ( -- name )
default-serif-font-name ( -- name )

A data type for font metrics. The fonts vocabulary does not provide any means of computing font metrics, it simply defines a common data type that other vocabularies, such as ui.text may use:

metrics