Move FreetypeHelper and cleanup glyph creation
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ft2build.h>
|
||||
#include <../../../cmake-build/debug/_deps/freetype-src/freetype-install/include/freetype2/ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include <memory>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "IFontAtlasGenerator.hpp"
|
||||
#include "Math/AABB.hpp"
|
||||
#include "FreetypeHelper.hpp"
|
||||
#include "Extensions/FreetypeHelper.hpp"
|
||||
#include <variant>
|
||||
#include <set>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user