Move FreetypeHelper and cleanup glyph creation

This commit is contained in:
Georg Hagen
2025-01-04 11:59:13 +01:00
parent 994ae12b80
commit fad309d96d
3 changed files with 8 additions and 12 deletions

View File

@@ -140,22 +140,18 @@ namespace OpenVulkano::Scene
m_text = text;
size_t len = utf8::distance(text.begin(), text.end());
const size_t len = utf8::distance(text.begin(), text.end());
m_geometry.Close();
m_geometry.Init(len * 4, len * 6);
AtlasMetadata* meta;
std::map<uint32_t, GlyphInfo>* symbols;
symbols = &m_atlasData->glyphs;
meta = &m_atlasData->meta;
std::map<uint32_t, GlyphInfo>* symbols = &m_atlasData->glyphs;
AtlasMetadata* meta = &m_atlasData->meta;
double cursorX = pos.x;
auto begin = text.begin();
auto end = text.end();
const double lineHeight = meta->lineHeight;
double posY = pos.y;
int i = 0;
Math::Vector3f bmin(pos), bmax(pos);
while (begin != end)
int i = 0;
for (auto begin = text.begin(), end = text.end(); begin != end;)
{
uint32_t c = utf8::next(begin, end);
if (c == '\n')
@@ -165,7 +161,7 @@ namespace OpenVulkano::Scene
continue;
}
if (symbols->find(c) == symbols->end())
if (!symbols->contains(c))
{
Logger::RENDER->warn("Could not find glyph for character {}, using fallback", c);
c = fallbackGlyph;