5#include <SDL3_ttf/SDL_ttf.h>
37 std::filesystem::path
path;
69 std::u16string_view
text);
71 std::wstring_view
text);
90 std::
string familyName = {});
102 std::string_view
utf8)
const;
104 std::u16string_view
utf16)
const;
139 struct PresentationFace
141 std::unique_ptr<TTF_Font, CloseFont>
font;
142 int size{}, weight{};
143 bool italic{}, underline{}, strikeOut{};
144 std::uint64_t lastUsed{};
146 void clearPresentationFaces()
noexcept;
147 [[
nodiscard]] std::expected<data::LegacyBitmapRGBA8, Error> renderFace(
151 bool ttfInitialized_{};
154 std::array<std::optional<Settings>,
SlotCount> slots_{};
160 [[
nodiscard]] std::expected<std::filesystem::path, Error>
std::expected< void, Error > setFont(const std::filesystem::path &path, std::string familyName={})
Runtime & operator=(const Runtime &)=delete
void resetCharacteristics()
std::size_t presentationFaceCount() const noexcept
const Settings * savedSettings(std::size_t slot) const noexcept
std::expected< Metrics, Error > measure(std::string_view utf8) const
std::expected< data::LegacyBitmapRGBA8, Error > renderPresentation(std::string_view utf8, std::uint32_t colorRef, int size, int weight, bool italic, bool underline=false, bool strikeOut=false, bool antialiased=true)
static constexpr std::size_t PresentationFaceLimit
const Settings & settings() const noexcept
std::expected< data::LegacyBitmapRGBA8, Error > render(std::string_view utf8, std::uint32_t colorRef, bool antialiased=false) const
static constexpr std::size_t SlotCount
void setWeight(int weight)
void setUnderline(bool enabled)
std::expected< void, Error > setSize(int points)
Runtime(const Runtime &)=delete
std::expected< void, Error > saveSettings(std::size_t slot)
std::expected< data::LegacyBitmapRGBA8, Error > renderClipped(std::string_view utf8, std::uint32_t colorRef, ClipRect clip, bool antialiased=false) const
bool ready() const noexcept
std::expected< std::vector< std::string >, Error > wrap(std::string_view utf8, int width) const
std::expected< void, Error > restoreSettings(std::size_t slot)
void setStrikeOut(bool enabled)
void setItalic(bool enabled)
std::expected< void, Error > blitText(data::LegacyBitmapRGBA8 &destination, std::string_view utf8, int x, int y, std::uint32_t colorRef) const
std::expected< std::string, Error > transcodeUtf8(std::u16string_view text)
@ SurfaceConversionFailed
std::expected< std::filesystem::path, Error > resolveRetailArial(std::span< const std::filesystem::path > roots)
std::filesystem::path path
std::filesystem::path fontPath
auto operator<=>(const Settings &) const =default