Skip to main content

Module text_scale_control

Module text_scale_control 

Source
Expand description

TextScaleControl — the settings control that grows all text in the app.

Drop this into a preferences/settings window to let low-vision users scale every piece of text uniformly (the framework multiplies the active theme’s typography by the chosen factor — see WidgetTree::set_user_text_scale). It is a thin specialization of SpinBox that displays a percent (80 %–200 %, step 10 %) and, on each edit, both persists the value and applies it app-wide — so the developer only has to place the widget.

Bind it to the persisted factor signal, typically the settings-backed teksilo_settings::TEXT_SCALE_KEY:

use teksilo::prelude::*;
use teksilo::widgets::TextScaleControl;

// inside build():
let scale = ctx.settings().signal_for(&teksilo_settings::TEXT_SCALE_KEY);
ctx.add(TextScaleControl::new(scale).label(tr!(text_size())));

Writing the bound signal triggers the SettingsStore’s debounced auto-save (persistence), and the widget’s on_value_changed calls EventContext::set_text_scale (immediate app-wide application). At startup teksilo-app reads the saved key and seeds every window, so the chosen size is restored automatically.

Structs§

TextScaleControl
A specialized SpinBox for the global user text-scale setting.