FifeGUI 0.2.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#include <string>
9
10#include "fifechan/platform.hpp"
11
12namespace fcn
13{
14 class Graphics;
15
23 class FIFEGUI_API Font
24 {
25 public:
26 virtual ~Font() = default;
27
29 Font(Font const &) = default;
31 Font& operator=(Font const &) = default;
33 Font(Font&&) = default;
35 Font& operator=(Font&&) = default;
36
44 virtual int getWidth(std::string const & text) const = 0;
45
51 virtual int getHeight() const = 0;
52
62 virtual int getStringIndexAt(std::string const & text, int x) const;
63
75 virtual void drawString(Graphics* graphics, std::string const & text, int x, int y) = 0;
76
77 protected:
78 Font() = default;
79 };
80} // namespace fcn
81
82#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:11
Font & operator=(Font &&)=default
Move assignment operator.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57