Skip to main content

Module font_settings

Module font_settings 

Source
Expand description

System-wide font / text rendering settings.

Mirrors the theme::current_visuals / theme::set_visuals pattern and the scrollbar-style globals (current_scroll_style / set_scroll_style). Widgets that care about rendering style (Label, Button, TextField, …) should consult these at layout/paint time so changes made by the System window propagate without a widget-tree rebuild.

§Convention

Each setting has:

Widgets pick between the global override and their own per-instance value — analogous to how a ScrollView takes the global scroll style unless the caller wired an explicit one.

Functions§

clear_lcd_enabled_override
Drop any explicit override and return to device-scale-derived auto. Counterpart to set_lcd_enabled; used by tests and by System- window “reset to default” affordances.
current_faux_italic
current_faux_weight
current_font_size_scale
Current font size multiplier. Widgets reading a self.font_size should consult this (via e.g. Label::active_font_size) so a single slider in the System window can grow or shrink all text uniformly.
current_gamma
current_interval
current_primary_weight
current_system_font
Current system font override, if set. Widgets should prefer this over their own self.font when the override is Some(_) so user changes in the System window propagate live.
current_typography_epoch
Current typography epoch. Widget render paths read this each frame.
current_width
hinting_enabled
lcd_enabled
Whether widgets should rasterise text through the LCD subpixel path.
set_faux_italic
set_faux_weight
set_font_size_scale
Set the system font-size multiplier. Clamped to a sensible range so typos or edge-case inputs can’t hide every label or fry the layout.
set_gamma
set_hinting_enabled
set_interval
set_lcd_enabled
Pin LCD subpixel rendering to a specific value, overriding the device-scale-derived default. System-window toggles use this; apps that just want sensible default behaviour should not call it.
set_primary_weight
set_system_font
Replace the system font override. Pass None to clear and fall back to per-widget fonts.
set_width