FifeGUI 0.3.0
A C++ GUI library designed for games.
fontloader.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
3
4#ifndef INCLUDE_FIFECHAN_FONTLOADER_HPP
5#define INCLUDE_FIFECHAN_FONTLOADER_HPP
6
7// Standard library includes
8#include <filesystem>
9#include <memory>
10#include <string>
11#include <vector>
12
13// Project headers (subdirs before local)
14#include "fifechan/font.hpp"
15#include "fifechan/graphics.hpp"
16
17namespace fcn::font
18{
19
27 class FIFEGUI_API FontLoader
28 {
29 public:
34 static std::vector<std::filesystem::path> getDefaultSearchPaths();
35
44 static std::filesystem::path findFontFile(
45 std::string const & fontName, std::vector<std::filesystem::path> const & searchPaths = {});
46
57 static std::shared_ptr<Font> loadFont(
58 Graphics& graphics,
59 std::string const & fontName,
60 int size,
61 std::vector<std::filesystem::path> const & searchPaths = {});
62 };
63
64} // namespace fcn::font
65
66#endif // INCLUDE_FIFECHAN_FONTLOADER_HPP
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:58
Helper class for searching and loading fonts.
static std::filesystem::path findFontFile(std::string const &fontName, std::vector< std::filesystem::path > const &searchPaths={})
Find a font file by name searching the provided paths.
static std::vector< std::filesystem::path > getDefaultSearchPaths()
Returns default search paths used when locating font files on the current platform.
static std::shared_ptr< Font > loadFont(Graphics &graphics, std::string const &fontName, int size, std::vector< std::filesystem::path > const &searchPaths={})
Load a Font object for the given font name and size using the provided Graphics implementation.