render question mark if glyph is not loaded
This commit is contained in:
@@ -57,6 +57,7 @@ namespace OpenVulkano
|
||||
texts.push_back(std::make_pair("ABab?.^{}_cdFGETG123)(", TextConfig()));
|
||||
texts.push_back(std::make_pair("Hello, World!", TextConfig()));
|
||||
texts.push_back(std::make_pair("\u0410\u0411\u0412\u041F", TextConfig()));
|
||||
texts.push_back(std::make_pair("Text with unsupported glyphs \u1E30\u1E31 is coming", TextConfig()));
|
||||
texts.push_back(std::make_pair("This is first line\nSecond gg line\nThird G line", TextConfig()));
|
||||
texts[0].second.applyBorder = true;
|
||||
texts[1].second.backgroundColor.a = 1;
|
||||
|
||||
@@ -170,8 +170,21 @@ namespace OpenVulkano::Scene
|
||||
cursorX = pos.x;
|
||||
continue;
|
||||
}
|
||||
if (symbols->find(c) != symbols->end())
|
||||
|
||||
if (symbols->find(c) == symbols->end())
|
||||
{
|
||||
Logger::RENDER->error("Could not find glyph for character {}", c);
|
||||
if (symbols->find(static_cast<uint32_t>('?')) != symbols->end())
|
||||
{
|
||||
c = static_cast<uint32_t>('?');
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::RENDER->error("Could not find glyph for character ? to replace glyph {}", c);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t vIdx = i * 4;
|
||||
uint32_t indices[] = { 1 + vIdx, 2 + vIdx, 3 + vIdx, 1 + vIdx, 3 + vIdx, 0 + vIdx };
|
||||
GlyphInfo& info = symbols->at(c);
|
||||
@@ -204,12 +217,6 @@ namespace OpenVulkano::Scene
|
||||
// when setting for depth comparison operator will be available( <= )
|
||||
cursorX += info.advance + 0.08;
|
||||
}
|
||||
else
|
||||
{
|
||||
// throw ? replace with ? character (if available) ?
|
||||
Logger::RENDER->error("Could not find glyph for character {}", c);
|
||||
}
|
||||
}
|
||||
SimpleDrawable::Init(m_shader, &m_geometry, &m_material, &m_uniBuffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user