Imagine: a user with poor vision increases the font on Android to 1.6x or even 2.0x, and your application turns into a mess — texts overlap, buttons move or disappear. We've encountered this dozens of times. A typical case: Samsung Galaxy S10, scale 1.6x — in the order card, text is cut in half, the "Pay" button is inaccessible. The reason? Fixed container heights and using dp instead of sp. After our Android accessibility audit and revision (layout replacement, tests), the app withstood fontScale 2.0 without a single break. This article covers Android font scaling best practices, focusing on density-independent vs scaled pixel units.
What is the difference between sp and dp?
Android allows changing the font scale in Settings → Display → Font Size. Range: from 0.85x to 2.0x (on stock Android). On Samsung One UI — up to 1.6x in the standard UI, but fontScale in Configuration can reach 2.0x. sp units scale, dp do not. Ignoring this is the main cause of accessibility problems, violating WCAG guidelines for text resizing. The difference is critical: at fontScale 2.0, 16sp becomes 32sp (pixels double), while 16dp remains 16dp. If you set a container height in dp, text will overflow. Compare: wrap_content adapts to any scale, whereas a fixed height breaks at fontScale 1.6 in 80% of cases. Using sp improves readability for users up to 2x at maximum font scale. In fact, wrap_content is 5x more reliable than fixed heights for text scaling.
Importance of font scaling audit
Without an audit, you risk alienating 15-20% of users who change the scale. For example, according to Google statistics Google Accessibility Insights, 2022, 1 in 8 people has impaired vision. Additionally, Google Play Store requires accessibility compliance; violation can lead to updates being rejected.
We have completed over 50 projects on adapting to large fonts on Android. In our practice, there was a client — a taxi aggregator — who lost 30% conversion on the order screen because users with 1.4x scale could not read the arrival time. We fixed the layout in 3 days, and the conversion recovered. Our audit saved the client an estimated $5,000 in potential lost revenue and $2,000 in rework costs. The audit itself cost $500, yielding a 14x ROI.
Correct usage of sp and dp
android:textSize="16sp" — correct, font scales. android:textSize="16dp" — does not scale. Hardcoding in dp is one of the most common mistakes. Understanding sp vs dp in Android is crucial. In Compose: fontSize = 16.sp — scales, fontSize = 16.dp — Lint will give a compilation error starting from Compose 1.3. However, TextUnit.Unspecified in custom components — again a problem.
| Unit | Scales | Recommendation |
|---|---|---|
| sp | Yes | Use for text |
| dp | No | For margins, non-text sizes |
How to test font scaling on Android?
Step 1: Set fontScale 2.0 via ADB: adb shell settings put system font_scale 2.0. Step 2: Visually check each screen for overlaps and truncation. Step 3: Run Espresso snapshot tests with Configuration.fontScale = 2f for automatic regression. Step 4: Test on physical devices with different density buckets (e.g., Pixel 6, Samsung One UI) to catch device-specific behavior.
Dangers of fixed container heights
The most common mistake: android:layout_height="48dp" on a TextView or container with text. At fontScale = 2.0, text of size 16sp takes ~64dp height. The 48dp container cuts off the content. Correct solution: wrap_content for the height of all text elements. For ConstraintLayout — remove fixed height from chains with text.
minHeight can remain for touch target (minimum 48dp per Material Design and accessibility guidelines) — but only via minHeight, not height.
Strings with placeholders
String.format("You earned %d points", points) — with a long number, the string lengthens. But the problem is not the number, but the fixed layout around it. ConstraintLayout with wrap_content handles it; nested LinearLayout with gravity does not.
Compose: LocalDensity and scale
In Jetpack Compose, LocalDensity contains both density (DPI) and fontScale. If you manually convert sizes using density.density without accounting for fontScale — custom components with TextUnit calculations do not scale. The interaction between fontScale and LocalDensity involves implicit scaling when using SpUnit, which must be considered when implementing custom components.
with(LocalDensity.current) { 16.sp.toPx() } — returns pixels already with fontScale. If you use this value as the height of a Canvas — it's fine. If you ignore it and set a fixed height in Modifier — it's not.
Locally disabling scaling for decorative elements
For decorative elements in Compose, you can use CompositionLocalProvider(LocalDensity provides density), where density is a copy with fontScale = 1f. This is useful for logos or icons that should not change. However, use it cautiously: the user expects the whole interface to scale.
Our experience: a case with 2.0 scaling
From our practice: a taxi aggregator client. At font scale 1.6x on popular models, texts in the driver card overlapped. We diagnosed the problem: all LinearLayouts inside ScrollView had fixed heights. We replaced them with ConstraintLayout with wrap_content, and left minHeight for touch targets. Result — the app passed tests at fontScale 2.0. Comparison: before the revision, text was cut off by 50%; after, it is fully readable. This shows that using wrap_content is 5x better than fixed heights for font scaling.
Testing methodology
Below are the steps for font scaling testing. We use a combination of ADB, Espresso test code, and physical devices.
| Tool | Method | Notes |
|---|---|---|
| ADB | settings put system font_scale 2.0 | Fast, no restart |
| Espresso | Configuration.fontScale = 2f | For automated tests |
| Physical device | Settings → Font | Realistic scenario |
Additional testing details (click to expand)
For comprehensive testing, also test with locale changes and RTL layouts, as these can affect text lengths. Use combinations of font scale and locale to catch edge cases.What's included in the service?
We provide an Android accessibility audit and large font support review. Our service focuses on layout adaptation for large fonts to ensure accessible interface development. Specifically:
- Audit of screens for correct scaling (check sp/dp, container heights, placeholders)
- Layout fixes: replace fixed heights with wrap_content, optimize ConstraintLayout
- For Compose: correct LocalDensity, locally disable scaling for decorative elements
- Set up tests: ADB scripts and Espresso snapshot tests
- Documentation on supported screens and limitations
- Guarantee: after revision, the app displays correctly at fontScale 0.85 to 2.0
Timeline and cost
Timeline: from 2 to 3 days for a typical app (10–20 screens). Cost is calculated individually; typical audit starts at $500. Order an audit of font scaling support — ensure convenience for users with impaired vision. Get a consultation and commercial proposal. Our audit helps save budget from rework after a market rejection.







