5#include "fifechan/defaultfont.hpp"
9#include "fifechan/graphics.hpp"
20 return 8 * text.size();
34 int const glyphWidth =
getWidth(
" ");
35 for (
char const & ch : text) {
43 int const glyphWidth =
getWidth(
" ");
44 if (x >
static_cast<int>(text.size()) * glyphWidth) {
48 return x / glyphWidth;
int getWidth(std::string const &text) const override
Gets the width of a string.
virtual int drawGlyph(Graphics *graphics, unsigned char glyph, int x, int y)
Draws a glyph as a rectangle.
int getStringIndexAt(std::string const &text, int x) const override
Gets a string index in a string providing an x coordinate.
int getHeight() const override
Gets the height of the glyphs in the font.
void drawString(Graphics *graphics, std::string const &text, int x, int y) override
Draws a string.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
virtual void drawRectangle(Rectangle const &rectangle)=0
Draws a simple, non-filled rectangle with a one pixel width.