-
Notifications
You must be signed in to change notification settings - Fork 59
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
egui::Context::set_zoom_factor does not work #338
Comments
A workaround is to use Context::style_mut to change all of the font sizes during initialization. One thing that was not obvious to me is that it's necessary to call Graphics::render on the egui output, even though there is nothing to render yet, or else the app crashes with the error "GL_INVALID_VALUE: Offset overflows texture dimensions." |
I ran into this as well last week. This would be great for accessibility. I'll try your workaround @dgulotta , thank you for that! My use case would be to allow changing UI scale at runtime and not during initialization, I'll try if the workaround works in that case too. |
I've been looking a bit into this and it seems (if I understand correctly) that the zoom factor changes the rendering viewport to adapt to the new pixel density? It does appear to do something right now, but the viewport scales to fit the current window size instead of growing as expected. We might need a way to pass this value to the renderer to adapt it. However in Notan's egui code there is some hackish code for detecting different DPIs across monitors on the same machine that I may need to rethink or redo |
It looks like egui_glow handles zoom by dividing raw_input.screen_rect by the zoom factor and then scaling the viewport by the zoom factor. The following scales the text properly in Notan, but there are issues with text getting cut off: c0b6c7f. |
In Notan, calling egui::Context::set_zoom_factor does not change the size of the UI, only the sharpness of the UI elements. I checked that set_zoom_factor works correctly in eframe.
This is particularly unfortunate because egui's default font size on my system in either WebAssembly or Wine is about 5 points (with either notan or eframe).
The text was updated successfully, but these errors were encountered: