FifeGUI 0.3.0
A C++ GUI library designed for games.
font.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_FONT_HPP_
6#define INCLUDE_FIFECHAN_FONT_HPP_
7
8// Standard library includes
9#include <string>
10
11// Platform config include
12#include "fifechan/platform.hpp"
13
14namespace fcn
15{
16 class Graphics;
17
25 class FIFEGUI_API Font
26 {
27 public:
31 virtual ~Font() = default;
32
36 Font(Font const &) = default;
37
41 Font& operator=(Font const &) = default;
42
46 Font(Font&&) = default;
47
51 Font& operator=(Font&&) = default;
52
62 virtual int getWidth(std::string const & text) const = 0;
63
69 virtual int getHeight() const = 0;
70
81 virtual int getStringIndexAt(std::string const & text, int x) const;
82
94 virtual void drawString(Graphics* graphics, std::string const & text, int x, int y) = 0;
95
96 protected:
97 Font() = default;
98 };
99} // namespace fcn
100
101#endif // INCLUDE_FIFECHAN_FONT_HPP_
Font & operator=(Font const &)=default
Copy assignment operator.
Font(Font &&)=default
Move constructor.
Font(Font const &)=default
Copy constructor.
virtual int getWidth(std::string const &text) const =0
Gets the width of a string.
virtual int getHeight() const =0
Gets the height of the glyphs in the font.
virtual void drawString(Graphics *graphics, std::string const &text, int x, int y)=0
Draws a string.
virtual int getStringIndexAt(std::string const &text, int x) const
Gets a string index in a string providing an x coordinate.
Definition font.cpp:17
Font & operator=(Font &&)=default
Move assignment operator.
virtual ~Font()=default
Virtual destructor.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
Used replacement tokens by configure_file():