refactoring
This commit is contained in:
@@ -60,7 +60,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
FontAtlas::Ptr FontAtlasFactory::GetFontAtlas(const std::string& fontIdentifier, float ptSize,
|
||||
std::optional<SubpixelLayout> subpixelLayout,
|
||||
SubpixelLayout subpixelLayout,
|
||||
const std::set<uint32_t>& charset) const
|
||||
{
|
||||
const auto& fontData = FindFont(fontIdentifier);
|
||||
@@ -71,7 +71,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
|
||||
const std::set<uint32_t>& setRef = (charset.empty() ? FontAtlasGeneratorBase::LoadAllGlyphs(fontData) : charset);
|
||||
FontIdentifier id(fontIdentifier, setRef, subpixelLayout.value_or(SubpixelLayout::UNKNOWN), ptSize,
|
||||
FontIdentifier id(fontIdentifier, setRef, subpixelLayout, ptSize,
|
||||
subpixelLayout ? FontAtlasType::BITMAP_SUBPIXEL : FontAtlasType::BITMAP);
|
||||
|
||||
auto it = m_atlasesCache.find(id);
|
||||
@@ -88,19 +88,21 @@ namespace OpenVulkano::Scene
|
||||
|
||||
Array<char> FontAtlasFactory::FindFont(const std::string& fontIdentifier) const
|
||||
{
|
||||
Array<char> resource = ResourceLoader::GetInstance().GetResource(fontIdentifier);
|
||||
if (resource.Empty())
|
||||
try
|
||||
{
|
||||
if (!std::filesystem::exists(fontIdentifier))
|
||||
{
|
||||
if (!m_allowSystemFonts)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
return Utils::ReadFile(SystemFontResolver::GetSystemFontPath(fontIdentifier));
|
||||
}
|
||||
return Utils::ReadFile(fontIdentifier);
|
||||
return ResourceLoader::GetInstance().GetResource(fontIdentifier);
|
||||
}
|
||||
return resource;
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (!std::filesystem::exists(fontIdentifier))
|
||||
{
|
||||
if (!m_allowSystemFonts)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
return Utils::ReadFile(SystemFontResolver::GetSystemFontPath(fontIdentifier), true);
|
||||
}
|
||||
return Utils::ReadFile(fontIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user