Expand description
The system’s text scaling (the desktop’s “larger text”), read in the process, to seed egui-pop’s text size setting.
Experimental: may change in any release
(docs/stability.md).
It is not the display’s scale: winit gives that as the pixels per point, and egui-pop already follows it. This is the separate factor a desktop applies to text only.
| Read from | |
|---|---|
| GNOME on Wayland (and desktops using its settings) | the XDG Settings portal, org.gnome.desktop.interface text-scaling-factor |
| KDE Plasma on Wayland | forceFontDPIWayland, else forceFontDPI, in kcmfonts then kdeglobals (group General), read as files, over 96 |
| Linux on X11 | nothing: GNOME and Plasma fold the text scaling into Xft.dpi, which winit already reads as the display’s scale; reading it again would count it twice |
| Windows | “Make text bigger”: HKCU\Software\Microsoft\Accessibility TextScaleFactor (100 to 225), read through the registry API (winreg) |
| macOS, other desktops, the web | nothing: 1 |
The EGUI_POP_TEXT_SCALE variable (1.25 or 125%) stands in for the
system. read reads now (a D-Bus call on GNOME, with a timeout);
give it to AppBuilder::system_text_scale, which makes it the
default of the text size until the user chooses one:
let app = egui_pop_api::App::builder()
.system_text_scale(egui_pop_platform::text_scale::read());read_with takes each source as a function, so a test answers in
place of the system:
use egui_pop_platform::text_scale::{self, Session, Sources};
let kcmfonts = "[General]\nforceFontDPI=120\n";
assert_eq!(text_scale::kde_font_dpi(kcmfonts, true), Some(1.25));
let read = text_scale::read_with(None, &Session::wayland("KDE"), &Sources {
kcmfonts: &|| Some(kcmfonts.into()),
..Sources::NONE
});
if cfg!(all(unix, not(target_os = "macos"))) {
assert_eq!((read.factor, read.from), (1.25, Some("KDE")));
}Structs§
- Session
- The session the application runs in.
- Sources
- Where the system’s answer comes from, each a function giving the raw
answer (none: not there).
Sources::SYSTEMreads the real ones.
Constants§
- ENV
- The variable standing in for the system (
1.25,125%).
Functions§
- kde_
font_ dpi - KDE’s forced font DPI in a configuration file’s
Generalgroup (forceFontDPIWaylandfirst on Wayland), as a factor of 96; 0 or absent: none. - parse_
env - A factor as
EGUI_POP_TEXT_SCALEwrites it:1.25or125%. - read
- The system’s text scaling, read now in-process (see the module).
- read_
with - The system’s text scaling from what
sourcesanswer (see the module);envisEGUI_POP_TEXT_SCALE’s value.