implement multiline text rendering

This commit is contained in:
ohyzha
2024-08-06 10:22:07 +03:00
parent afccf5dee0
commit cb409268a8
7 changed files with 49 additions and 25 deletions

View File

@@ -55,7 +55,8 @@ namespace OpenVulkano::Scene
return;
}
std::fstream fs(outputFile.c_str(), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
for (const auto& [key, val] : m_symbols)
fs.write(reinterpret_cast<const char*>(&m_meta), sizeof(AtlasMetadata));
for (const auto& [key, val] : m_symbols)
{
fs.write(reinterpret_cast<const char*>(&key), sizeof(uint32_t));
fs.write(reinterpret_cast<const char*>(&val), sizeof(GlyphInfo));
@@ -92,7 +93,9 @@ namespace OpenVulkano::Scene
m_atlasTex.textureBuffer = (msdfgen::byte*) storage.pixels;
m_atlasTex.format = OpenVulkano::DataFormat::R8_UNORM;
m_atlasTex.size = storage.width * storage.height * 1; // 1 channel
m_meta.lineHeight = fontGeometry.getMetrics().lineHeight;
struct Bbox
{
double l = 0, r = 0, t = 0, b = 0;