19#ifndef HEADER_FACE_TTF_HPP
20#define HEADER_FACE_TTF_HPP
22#include "utils/no_copy.hpp"
62 std::vector<std::pair<FT_Face, std::map<unsigned, FontArea> > >
m_ft_faces;
74 for (
unsigned int i = 0; i <
m_ft_faces.size(); i++)
80 void loadTTF(std::vector<FT_Face> faces)
82 for (
unsigned int i = 0; i < faces.size(); i++)
83 m_ft_faces.emplace_back(faces[i], std::map<unsigned, FontArea>());
99 void insertFontArea(
const FontArea& a,
unsigned font_index,
100 unsigned glyph_index)
103 ttf[glyph_index] = a;
106 bool enabledForFont(
unsigned idx)
const
109 const FontArea* getFontArea(
unsigned font_index,
unsigned glyph_index)
112 auto it = ttf.find(glyph_index);
118 bool getFontAndGlyphFromChar(uint32_t c,
unsigned* font,
unsigned* glyph)
120 for (
unsigned i = 0; i <
m_ft_faces.size(); i++)
122 unsigned glyph_index = FT_Get_Char_Index(
m_ft_faces[i].first, c);
126 *glyph = glyph_index;
This class will load a list of TTF files from FontManager, and save them inside m_ft_faces for FontWi...
Definition: face_ttf.hpp:57
std::vector< std::pair< FT_Face, std::map< unsigned, FontArea > > > m_ft_faces
Contains all FT_Face with a list of loaded glyph index with the FontArea.
Definition: face_ttf.hpp:62
unsigned int getTotalFaces() const
Return the total TTF files loaded.
Definition: face_ttf.hpp:96
FT_Face getFace(unsigned int i) const
Return a TTF in m_ft_faces.
Definition: face_ttf.hpp:89
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Glyph metrics for each glyph loaded.
Definition: face_ttf.hpp:37
int offset_y
Top side bearing for horizontal layout.
Definition: face_ttf.hpp:45
int spriteno
Index number in sprite bank of FontWithFace.
Definition: face_ttf.hpp:49
int bearing_x
Left side bearing for horizontal layout.
Definition: face_ttf.hpp:43
int offset_y_bt
Top side bearing for horizontal layout used in billboard text.
Definition: face_ttf.hpp:47
int advance_x
Advance width for horizontal layout.
Definition: face_ttf.hpp:41