Compare commits
2 Commits
1d75400a2d
...
63f6db2a0c
Author | SHA1 | Date | |
---|---|---|---|
63f6db2a0c | |||
9ed87aa692 |
@ -155,21 +155,23 @@ bool Application::loadFonts(std::span<const FontConfig> fonts)
|
|||||||
// by default ImGui takes ownership of the data, that's now what we want
|
// by default ImGui takes ownership of the data, that's now what we want
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.FontDataOwnedByAtlas = false;
|
config.FontDataOwnedByAtlas = false;
|
||||||
std::vector<ImWchar> glyphRangesConverted;
|
std::vector<std::vector<ImWchar>> glyphRangesConverted;
|
||||||
|
glyphRangesConverted.reserve(fonts.size());
|
||||||
for (const auto& [font, data] : mijin::zip(fonts, buffers))
|
for (const auto& [font, data] : mijin::zip(fonts, buffers))
|
||||||
{
|
{
|
||||||
ImWchar* glyphRanges = nullptr;
|
ImWchar* glyphRanges = nullptr;
|
||||||
if (!font.glyphRanges.empty())
|
if (!font.glyphRanges.empty())
|
||||||
{
|
{
|
||||||
glyphRangesConverted.reserve(2 * font.glyphRanges.size() + 1);
|
std::vector<ImWchar>& glyphData = glyphRangesConverted.emplace_back();
|
||||||
glyphRangesConverted.clear();
|
glyphData.reserve(2 * font.glyphRanges.size() + 1);
|
||||||
|
glyphData.clear();
|
||||||
for (const std::pair<ImWchar, ImWchar>& range : font.glyphRanges)
|
for (const std::pair<ImWchar, ImWchar>& range : font.glyphRanges)
|
||||||
{
|
{
|
||||||
glyphRangesConverted.push_back(range.first);
|
glyphData.push_back(range.first);
|
||||||
glyphRangesConverted.push_back(range.second);
|
glyphData.push_back(range.second);
|
||||||
}
|
}
|
||||||
glyphRangesConverted.push_back(0);
|
glyphData.push_back(0);
|
||||||
glyphRanges = glyphRangesConverted.data();
|
glyphRanges = glyphData.data();
|
||||||
}
|
}
|
||||||
config.PixelSnapH = font.flags.pixelSnapH;
|
config.PixelSnapH = font.flags.pixelSnapH;
|
||||||
imguiIO.Fonts->AddFontFromMemoryTTF(data.data(), static_cast<int>(data.byteSize()), font.size, &config, glyphRanges);
|
imguiIO.Fonts->AddFontFromMemoryTTF(data.data(), static_cast<int>(data.byteSize()), font.size, &config, glyphRanges);
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
virtual ~Application() = default;
|
virtual ~Application() = default;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
const mijin::StackedFileSystemAdapter& getFS() const { return mFS; }
|
mijin::StackedFileSystemAdapter& getFS() { return mFS; }
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
mijin::SimpleTaskLoop& getLoop() { return mTaskLoop; }
|
mijin::SimpleTaskLoop& getLoop() { return mTaskLoop; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user