Thread View: comp.mobile.android
2 messages
2 total messages
Started by Jakub
Tue, 24 Nov 2026 12:20
How to get default font size at device programaticly?
Author: Jakub
Date: Tue, 24 Nov 2026 12:20
Date: Tue, 24 Nov 2026 12:20
2 lines
914 bytes
914 bytes
How to get default font size at device programaticly?
Re: How to get default font size at device programaticly?
Author: Maria Sophia
Date: Tue, 24 Nov 2026 17:57
Date: Tue, 24 Nov 2026 17:57
39 lines
2790 bytes
2790 bytes
Jakub wrote:
> How to get default font size at device programaticly?
I don't know how but I looked it up for you.
How to do it depends on what you mean by default font size...
Android doesn't have a single "default font size in pixels/sp" for the
whole OS because text scales dynamically based on the device's font scale
factor (font_scale, where 1.0 is standard/default) combined with screen
density and sp dimensions.
Hence, how we read it programmatically depends on whether we're querying
from a host/shell via ADB or inside app code.
On my system, I just ran these two adb commands (Android 13, Galaxy).
adb shell settings get system font_scale
1.0
adb shell settings list system | grep font
font_scale=1.0
Where a null or 1.0 value means standard default scaling (1.0f).
Don't trust me on this, but I think in an app, in Kotlin, use
val fontScale: Float = context.resources.configuration.fontScale
Or, from the system:
val fontScale = Settings.System.getFloat(
context.contentResolver,
Settings.System.FONT_SCALE,
1.0f
)
PSA: Starting in Android 14, font scaling above 1.0 (specifically when
non-linear scaling kicks in, such as up to 200%) is non-linear. Rather than
multiplying every sp value by a single fontScale factor, Android uses a
non-linear curve so large headings don't blow up disproportionately while
body text scales up.
--
Every thread should strive to add unique value that wasn't there before.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads