FifeGUI 0.3.0
A C++ GUI library designed for games.
defaultfont.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_DEFAULTFONT_HPP_
6#define INCLUDE_FIFECHAN_DEFAULTFONT_HPP_
7
8// Standard library includes
9#include <string>
10
11// Project headers (subdirs before local)
12#include "fifechan/font.hpp"
13
14namespace fcn
15{
23 class FIFEGUI_API DefaultFont : public Font
24 {
25 public:
41 virtual int drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y);
42
43 // Inherited from Font
44
45 void drawString(Graphics* graphics, std::string const & text, int x, int y) override;
46
47 int getWidth(std::string const & text) const override;
48
49 int getHeight() const override;
50
51 int getStringIndexAt(std::string const & text, int x) const override;
52 };
53} // namespace fcn
54
55#endif // INCLUDE_FIFECHAN_DEFAULTFONT_HPP_
A basic font implementation capable only of drawing rectangles (placeholder).
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.
Font(Font const &)=default
Copy constructor.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
Used replacement tokens by configure_file():