5#ifndef INCLUDE_FIFECHAN_IMAGEFONT_HPP_
6#define INCLUDE_FIFECHAN_IMAGEFONT_HPP_
11#include "fifechan/font.hpp"
12#include "fifechan/platform.hpp"
13#include "fifechan/rectangle.hpp"
63 ImageFont(std::string
const & filename, std::string
const & glyphs);
92 explicit ImageFont(std::string
const & filename,
unsigned char glyphsFrom = 32,
unsigned char glyphsTo = 126);
156 virtual int getWidth(
unsigned char glyph)
const;
160 int getWidth(std::string
const & text)
const override;
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
virtual int getRowSpacing()
Gets the space between rows in pixels.
int mHeight
Holds the height of the image font.
virtual int drawGlyph(Graphics *graphics, unsigned char glyph, int x, int y)
Draws a glyph.
int getHeight() const override
Gets the height of the glyphs in the font.
int getStringIndexAt(std::string const &text, int x) const override
Gets a string index in a string providing an x coordinate.
Rectangle scanForGlyph(unsigned char glyph, int x, int y, Color const &separator)
Scans for a certain glyph.
Image * mImage
Holds the image with the font data.
std::array< Rectangle, 256 > mGlyph
Holds the glyphs areas in the image.
std::string mFilename
Holds the filename of the image with the font data.
virtual void setRowSpacing(int spacing)
Sets the space between rows in pixels.
ImageFont(std::string const &filename, std::string const &glyphs)
Constructor.
virtual int getWidth(unsigned char glyph) const
Gets a width of a glyph in pixels.
virtual int getGlyphSpacing()
Gets the spacing between letters in pixels.
virtual void setGlyphSpacing(int spacing)
Sets the spacing between glyphs in pixels.
int mGlyphSpacing
Holds the glyph spacing of the image font.
int mRowSpacing
Holds the row spacing of the image font.
void drawString(Graphics *graphics, std::string const &text, int x, int y) override
Draws a string.
Abstract holder for image data.
Represents a rectangular area (X, Y, Width, Height).