Jazz2::UI::Windows::ReadableFont class

Readable font of the interface, drawn from an outline font at the size text has.

The plainer font the interface switches to from the pixel font of the game, see Theme::ReadableFont. Its glyphs are drawn from Editor/Fonts/Roboto-Regular.ttf of the content the first time text is shown at a scale, at exactly the size it has there, so the text is crisp at any scale — the pixel font is crisp only at whole multiples of its size. It's measured in the units of the pixel font and its lines are as high, so the interface keeps its layout when the font is switched. The glyphs are gray with a dark rim, as those of the pixel font are, so the colors of text tint them the same way.

The surface of the interface owns it, see Context::GetFont().

Constructors, destructors, conversion operators

ReadableFont()
~ReadableFont()
ReadableFont(const ReadableFont&) deleted

Public functions

auto operator=(const ReadableFont&) -> ReadableFont& deleted
auto Get(float textScale) -> UI::Font*
Returns the font for text drawn at a scale, or nullptr if the font file can't be read.

Function documentation

UI::Font* Jazz2::UI::Windows::ReadableFont::Get(float textScale)

Returns the font for text drawn at a scale, or nullptr if the font file can't be read.

The scale is that of text, see Theme::GetTextScale(). The glyphs are drawn for it if they weren't yet, which takes a moment. The fonts of a couple of scales are kept, but none that was used in the current frame is dropped, text drawn with it is still to be rendered.