32 TTFFont(
const std::string& filename,
int ptSize);
44 std::swap(font, other.font);
51 [[nodiscard]]
bool empty()
const {
return font ==
nullptr; }
Wrapper around a SDL_Surface.
int getHeight() const
Return the height of the font.
bool empty() const
Is this an empty font? (a default constructed object).
SDLSurfacePtr render(std::string text, uint8_t r, uint8_t g, uint8_t b) const
Render the given text to a new SDL_Surface.
TTFFont & operator=(const TTFFont &)=delete
TTFFont(TTFFont &&other) noexcept
Move construct.
int getWidth() const
Return the width of the font.
bool isFixedWidth() const
Returns true iff this is a fixed-with (=mono-spaced) font.
TTFFont & operator=(TTFFont &&other) noexcept
Move assignment.
gl::ivec2 getSize(zstring_view text) const
Return the size in pixels of the text if it would be rendered.
TTFFont()=default
Construct an empty font.
TTFFont(const TTFFont &)=delete
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions: