Skip to main content

current_font_scale

Function current_font_scale 

Source
pub fn current_font_scale() -> f32
Expand description

Returns the system font scale — the multiplier the user chose in the platform’s font-size setting, 1.0 when they left it alone.

This is the setting Sp is defined against, so text follows it while everything measured in Dp does not. A platform that does not report one leaves it at 1.0.

It is the number to report, not the number to multiply by: what a size in Sp comes to is scale_sp, and on Android 14 and up the two are not the same arithmetic. See crate::font_scale.