What is the easiest way to add a font size slider without using egui.settings? #1478
-
I'm a beginner to Rust - as in maybe a week into things now. Every existing issue/discussion I've found points to long out-of-date examples that have since changed. I've tried following the breadcrumbs and ended up short. I don't want to add my own fonts and I can't figure out how to persist the I'm sure I've passed over the documentation to do exactly what I want to do several dozen times now but at this point my brain has shut off. I've currently resorted to scaling the entire UI with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There's three things to remember.
to set custom size for all text styles: for (_text_style, font_id) in style.text_styles.iter_mut() {
font_id.size = 24 // whatever size you want here
} you can remember user preferences for all default text styles
, and just set the sizes for those text styles with to instead just set a single font for everything, style also has a once you are done setting font size either way, you just need to tell egui to use that style with I can't really test that code at the moment, but that is the rough sketch. you can also just use |
Beta Was this translation helpful? Give feedback.
-
There is an example for this coming in a PR: https://github.com/emilk/egui/pull/1476/files |
Beta Was this translation helpful? Give feedback.
There is an example for this coming in a PR: https://github.com/emilk/egui/pull/1476/files