Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-integer font sizes lead to the font being regenerated in every frame #12

Closed
mertemba opened this issue Mar 5, 2024 · 1 comment
Closed

Comments

@mertemba
Copy link
Contributor

mertemba commented Mar 5, 2024

imviz/src/imviz.cpp

Lines 76 to 85 in 4ae13c6

if (smallFont == nullptr
|| largeFont == nullptr
|| smallFont->FontSize != fontBaseSize) {
io.Fonts->Clear();
smallFont = io.Fonts->AddFontFromMemoryCompressedTTF(
getSourceSansProData(),
getSourceSansProSize(),
fontBaseSize);

As smallFont->FontSize is a float and fontBaseSize is a double, this needs to be an approximate comparison (because e.g. 29.1 != 29.1f). Also, the font loading seems to leak a bit of GPU memory, however this is probably an upstream (ImGui) bug.

joruof added a commit that referenced this issue Mar 5, 2024
@joruof
Copy link
Owner

joruof commented Mar 5, 2024

Thanks for pointing that out! There was another memory leak in the same function, which has also been fixed now.

@joruof joruof closed this as completed Mar 5, 2024
joruof added a commit that referenced this issue Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants