Update to FontAtlasFactory for more eficent loading
This commit is contained in:
@@ -24,16 +24,18 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
void BitmapFontAtlasGenerator::Generate(const std::span<const uint8_t>& fontData,
|
||||
const std::set<uint32_t>& chset,
|
||||
const std::set<uint32_t>& inCs,
|
||||
const std::optional<std::string>& pngOutput)
|
||||
{
|
||||
if (chset.empty())
|
||||
{
|
||||
Logger::APP->info("Charset is empty. Nothing to generate.");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& [lib, face] = FontAtlasGeneratorBase::InitFreetype(fontData);
|
||||
|
||||
std::set<uint32_t> fallback;
|
||||
if (inCs.empty())
|
||||
{
|
||||
FontAtlasGeneratorBase::LoadAllGlyphs(fallback, face);
|
||||
}
|
||||
const auto& charset = inCs.empty() ? fallback : inCs;
|
||||
|
||||
FT_Set_Pixel_Sizes(face.get(), 0, m_pixelSizeConfig.CalculatePixelSize());
|
||||
if (m_subpixelLayout != SubpixelLayout::UNKNOWN)
|
||||
{
|
||||
@@ -46,7 +48,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
}
|
||||
|
||||
auto [allGlyphs, atlasWidth] = InitGlyphsForPacking(chset, face);
|
||||
auto [allGlyphs, atlasWidth] = InitGlyphsForPacking(charset, face);
|
||||
std::vector<Shelf> shelves = Shelf::CreateShelves(atlasWidth, allGlyphs, face.get(), m_channelsCount);
|
||||
uint32_t atlasHeight = 0;
|
||||
std::for_each(shelves.begin(), shelves.end(), [&](const Shelf& shelf) { atlasHeight += shelf.GetHeight(); });
|
||||
|
||||
Reference in New Issue
Block a user