FifeGUI 0.2.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#include <string>
9
10#include "fifechan/font.hpp"
11#include "fifechan/platform.hpp"
12
13namespace fcn
14{
22 class FIFEGUI_API DefaultFont : public Font
23 {
24 public:
39 virtual int drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y);
40
41 // Inherited from Font
42
43 void drawString(Graphics* graphics, std::string const & text, int x, int y) override;
44
45 int getWidth(std::string const & text) const override;
46
47 int getHeight() const override;
48
49 int getStringIndexAt(std::string const & text, int x) const override;
50 };
51} // namespace fcn
52
53#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.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57