-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Invalidate font atlas on any change to pixels_per_point
, not matter how small
#3698
Conversation
This seems to be fixing a symptom rather than the problem. Have you investigated why the float difference happen at all? I don't hit this assert. |
I don't know if i want to dig into the details of winit & x11, but this value is reported by winit, and it's definitely changing by this small amount. But besides that, if for whatever reason the DPI changes by a very small amount, what does egui do to handle it? the mentioned code snipset in my comment shows that it ignores small differences. the warning that I i fixed in this pr does not. So these two code segments behave different on the same logic, or not? |
But where does the change come from? Are you storing a If you create the galley in one frame, and then tesslleate, then I can't see how the Have you tried latest |
Well the egui/crates/epaint/src/text/fonts.rs Lines 563 to 567 in 327f599
I honestly dunno how exactly to debug if these I have to say I don't have the insight into egui, the docs for the Galley also only say: (https://docs.rs/egui/latest/egui/struct.Galley.html) I am not manually recreating my fonts if Then bcs of: egui/crates/epaint/src/text/fonts.rs Lines 381 to 382 in 8d4de86
The but the line in this pr compares it again egui/crates/epaint/src/text/fonts.rs Lines 381 to 382 in 8d4de86
but the warning is still displayed I'm indeed not using latest master, if you say |
Ah sorry, I finally follow… |
Does - let pixels_per_point_changed =
- (fonts_and_cache.fonts.pixels_per_point - pixels_per_point).abs() > 1e-3;
+ let pixels_per_point_changed = fonts_and_cache.fonts.pixels_per_point != pixels_per_point; solve your problem? I really don't see the point of the |
Yes that works just as good 👍 |
pixels_per_point
, not matter how small
Apparently the font implementation uses a distance check to decide if the font(or whatever) need recalculations, after dpi changed:
egui/crates/epaint/src/text/fonts.rs
Lines 381 to 382 in 8d4de86
This leads to warnings when the pixel_per_point diff is very low and spams the log. (<- this happens for me if i resize my window on kwin, e.g. maximize it)
(I don't want to debate if the float difference generally makes sense, so if you want to rework that instead just close this pr)