Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
text_renderer.hpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2025 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5#pragma once
6
7#include <cstdint>
8#include <iostream>
9#include <map>
10#include <algorithm>
11#include "image_data.hpp"
12#include "boost/filesystem.hpp"
13#include <ft2build.h>
14#include FT_FREETYPE_H
15#include FT_GLYPH_H
16#include FT_TYPES_H
17#include FT_OUTLINE_H
18#include FT_RENDER_H
19
20namespace rendering_engine
21{
22
24{
25public:
26 TextRenderer( std::string const pathToFont, unsigned int const size );
28
29 ImageData CreateGlyphBitmap( char const character );
30 //Not effective method. It is not using texAtlas.
31 ImageData CreateStringBitmap( std::string text );
32
33 static ImageData CreateGlyphBitmap( std::string const pathToFont, char const character );
34
35private:
37 TextRenderer operator=(TextRenderer const &);
38
39protected:
40 FT_Error mErrorResult = FT_Err_Ok;
41 FT_Library mLibrary = 0;
42 FT_Face mFace = 0;
43
44 std::map<char, ImageData> mGlyphBitmaps;
46
47 //TO DO evaluate to store all needed data for each character
48 std::map<char, std::pair<unsigned int, unsigned int>> mTexAtlasData;
49};
50
51} //namespace rendering_engine
Represents raw 2D image data stored in memory.
std::map< char, ImageData > mGlyphBitmaps
std::map< char, std::pair< unsigned int, unsigned int > > mTexAtlasData
ImageData CreateGlyphBitmap(char const character)
ImageData CreateStringBitmap(std::string text)
TextRenderer(std::string const pathToFont, unsigned int const size)