Add ui_font_size setting (#3199)

This PR adds a new `ui_font_size` setting that can be used to control
the scale of the entire UI.

We use the value in this setting to set the base rem size of the window.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-11-01 18:11:12 +01:00 committed by GitHub
parent bd61d71018
commit b910bbf002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 58 additions and 50 deletions

View file

@ -541,6 +541,12 @@ impl<'a, 'w> WindowContext<'a, 'w> {
self.window.rem_size
}
/// Sets the size of an em for the base font of the application. Adjusting this value allows the
/// UI to scale, just like zooming a web page.
pub fn set_rem_size(&mut self, rem_size: impl Into<Pixels>) {
self.window.rem_size = rem_size.into();
}
/// The line height associated with the current text style.
pub fn line_height(&self) -> Pixels {
let rem_size = self.rem_size();