Path: blob/main/release-content/release-notes/new_font_features.md
9311 views
------TextFont has been expanded to include new fields:
FontSource has two variants: Handle, which identifies a font by asset handle, and Family, which selects a font by its family name.
FontWidth is a newtype struct representing OpenType font stretch classifications ranging from ULTRA_CONDENSED (50%) to ULTRA_EXPANDED (200%).
FontStyle is an enum used to set the slant style of a font, with variants Normal, Italic, or Oblique.
The system font support is very basic for now. You load them using the CosmicFontSystem resource:
Then they are available to be selected by family name using FontSource::Family.
The font_size field is now a FontSize, enabling responsive font sizing.
FontSize is an enum with variants:
Rem units are currently resolved using RemSize, which is a new Resource. RemSize just newtypes an f32 currently.
Text2d's support for viewport coords is limited. A Text2d entity's resolved font size is always based on the size of the primary window, not on the size of its render target(s).