Compare commits

...

2 Commits

2 changed files with 10 additions and 8 deletions

View File

@ -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
ImFontConfig config;
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))
{
ImWchar* glyphRanges = nullptr;
if (!font.glyphRanges.empty())
{
glyphRangesConverted.reserve(2 * font.glyphRanges.size() + 1);
glyphRangesConverted.clear();
std::vector<ImWchar>& glyphData = glyphRangesConverted.emplace_back();
glyphData.reserve(2 * font.glyphRanges.size() + 1);
glyphData.clear();
for (const std::pair<ImWchar, ImWchar>& range : font.glyphRanges)
{
glyphRangesConverted.push_back(range.first);
glyphRangesConverted.push_back(range.second);
glyphData.push_back(range.first);
glyphData.push_back(range.second);
}
glyphRangesConverted.push_back(0);
glyphRanges = glyphRangesConverted.data();
glyphData.push_back(0);
glyphRanges = glyphData.data();
}
config.PixelSnapH = font.flags.pixelSnapH;
imguiIO.Fonts->AddFontFromMemoryTTF(data.data(), static_cast<int>(data.byteSize()), font.size, &config, glyphRanges);

View File

@ -89,7 +89,7 @@ public:
virtual ~Application() = default;
[[nodiscard]]
const mijin::StackedFileSystemAdapter& getFS() const { return mFS; }
mijin::StackedFileSystemAdapter& getFS() { return mFS; }
[[nodiscard]]
mijin::SimpleTaskLoop& getLoop() { return mTaskLoop; }