Jazz2::UI::Font class

Bitmap font.

Public static variables

static Colorf DefaultColor constexpr
Default (yellow) font color.
static Colorf TransparentDefaultColor constexpr
Default (yellow) font color with 60% transparency.
static Colorf RandomColor constexpr
Random (rainbow) font color.
static Colorf TransparentRandomColor constexpr
Random (rainbow) font color with 60% transparency.

Constructors, destructors, conversion operators

Font(StringView path, const std::uint32_t* palette)

Public functions

auto GetSizeInPixels() const -> std::int32_t
auto GetAscentInPixels() const -> std::int32_t
auto MeasureChar(char32_t c) const -> Vector2f
Returns size of a single character.
auto MeasureString(StringView text, float scale = 1.0f, float charSpacing = 1.0f, float lineSpacing = 1.0f) -> Vector2f
Returns size of a string.
auto MeasureStringEx(StringView text, float scale, float charSpacing, float maxWidth, std::int32_t* charFit, float* charFitWidths) -> Vector2f
Returns size of a string and its cumulative widths.
void DrawString(Canvas* canvas, StringView text, std::int32_t& charOffset, float x, float y, std::uint16_t z, Alignment align, Colorf color, float scale = 1.0f, float angleOffset = 0.0f, float varianceX = 4.0f, float varianceY = 4.0f, float speed = 0.4f, float charSpacing = 1.0f, float lineSpacing = 1.0f)
Draws a string.