Article View: comp.mobile.android
Article #911Re: How to get default font size at device programaticly?
From: 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.
Technical Details
Message-ID:
<11e4j6b$2dp0$1@nnrp.usenet.blueworldhosting.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED.public-nat-02.vpngate.v4.open.ad.jp!not-for-mailReferences:
<11e3veg$dkbh$1@paganini.bofh.team>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED.public-nat-02.vpngate.v4.open.ad.jp!not-for-mail From: Maria Sophia <mariasophia@comprehension.com> Newsgroups: comp.mobile.android Subject: Re: How to get default font size at device programaticly? Date: Tue, 24 Nov 2026 13:57:31 -0400 Organization: BWH Usenet Archive (https://usenet.blueworldhosting.com) Message-ID: <11e4j6b$2dp0$1@nnrp.usenet.blueworldhosting.com> References: <11e3veg$dkbh$1@paganini.bofh.team> Reply-To: pusvul@getTjewytR4so+mqe2.invalid Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 24 Nov 2026 17:57:32 -0000 (UTC) Injection-Info: nnrp.usenet.blueworldhosting.com; posting-account="l//KxG3Ge2LojWvwJg0Igv8F0ChK8RUC9RtOxMPUo3U"; posting-host="IfCZz72xNNlHXBkfV9B6WJEa9xVhaehMJfhAC6fCwnM"; logging-data="79648"; mail-complaints-to="usenet@blueworldhosting.com" User-Agent: Mojibake v24p7 Cancel-Lock: sha1:EEhndmjkDLe7bGlPHSEwaFVkgEo= sha256:7zPD+XW4vwcaz4waLZ2hcCWj3LqFn6eO2tVY5MlmTFI= sha1:sK9DUJZaC2NAAN+jShYp5znhrxE= sha256:ndEVQrGRowmaJUksefXYENmZe+SEnm+dVlzsdbmEOc8= Content-Language: en-GB