Technical
Managing System Font Scaling in Android TWAs
September 16, 2026 · 6 min read
When developers transition a Progressive Web App into an Android application using a Trusted Web Activity, they often expect the layout to render identically to a standard mobile browser. However, Android provides unique OS-level accessibility features that can alter this behaviour. One of the most common design disruptors is the system-wide font size control found in Android accessibility settings.
When a user increases the system font size to improve readability, Android applies a scaling factor to the display. Because a Trusted Web Activity is powered directly by the device's default system browser (usually Google Chrome), these accessibility settings are inherited by your web application. If your application's layout is not designed to accommodate dynamic text scaling, your user interface can break, resulting in overlapping elements, clipped text, and broken layouts.
Understanding How Android Font Scaling Affects TWAs
In a standard WebView wrapper, developers have native control over text zoom settings using the WebSettings.setTextZoom API. This allows developers to hard-code the text scale to 100% or modify it manually regardless of user preferences. Trusted Web Activities operate differently. Because a TWA runs within the secure, sandbox-isolated container of Chrome Custom Tabs, you do not have direct access to the web engine's internal settings via Java or Kotlin code.
This architectural choice is intentional. It ensures security and performance parity with Chrome, but it means that the TWA respects the user's browser-level settings. Chrome on Android features an option called Text Scaling under accessibility settings. When the Android system font size is modified, Chrome automatically adjusts its text scaling factor. This scaling factor is applied directly to the font sizes defined in your CSS, which can stretch containers, break absolute positioning, and push interactive buttons off the screen.
Managing Text Scale on the Web Side
The first line of defence against layout breakage caused by font scaling is your CSS. The CSS Mobile Text Size Adjust specification provides developers with a tool to control how mobile browsers handle auto-scaling of text elements. By default, mobile browsers may boost font sizes on elements they deem hard to read.
To prevent the browser from applying automatic adjustments, you can use the text-size-adjust property. Setting this property to 100% prevents the browser from scaling text automatically, though it behaves differently across rendering engines when system-wide settings are applied.
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
However, relying solely on disabling text scaling can create accessibility barriers. If a visually impaired user relies on larger text to navigate, disabling scaling entirely can make your app unusable. A better approach is to design an elastic layout that scales gracefully using relative units such as EM and REM, combined with fluid grid systems.
Comparing Font Scaling Mitigation Approaches
When deciding how to handle system font scaling, you must choose between locking the layout to protect the design and accommodating the user's scaling preferences. The table below compares the standard methods used by developers when managing text sizes in a Trusted Web Activity.
| Approach | Implementation Method | Pros | Cons |
|---|---|---|---|
| CSS Text-Size-Adjust | Using text-size-adjust property | Simple to implement across the entire web app | May not override all browser accessibility zooms |
| Relative CSS Units (REM/EM) | Designing layouts with scalable text and containers | Accessible, highly robust, follows best practices | Requires comprehensive design planning and refactoring |
| Viewport-relative Units (VW/VH) | Using vw or vh units for font sizes | Text scales relative to screen size, bypassing text zoom | Can make text unreadably small on very compact screens |
| Native WebSettings Override | Only available if using a WebView fallback | Absolute control over text rendering scales | Requires dropping TWA in favour of a legacy WebView shell |
Designing Layouts for High-DPI and Scaled Text
To ensure your TWA looks perfect even when text scaling is set to maximum, your CSS must be built with flexibility in mind. Avoid hardcoded heights on elements that contain text. For example, setting height: 50px on a button will guarantee that scaled text overflows and clips when the text size exceeds the container bounds. Instead, use min-height combined with padding to allow the container to grow dynamically as the text size increases.
You should also implement CSS Flexbox or Grid layouts. Flex layouts handle wrapping and dynamic spacing far better than absolute positioning or floats. Ensure you use the flex-wrap property on containers that house text blocks, navigation tabs, or buttons, allowing them to shift to the next line rather than overlapping adjacent elements.
Example of a Flexible Button Layout
Using padding and relative units guarantees that the button remains readable and tap targets remain larger than the minimum 48dp target required by Google Play design guidelines:
.custom-button { min-height: 3rem; padding: 0.5rem 1.5rem; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; word-break: break-word; }
Testing Your TWA Against System Font Scale Variations
Testing is a critical stage before compiling your production AAB file. To verify how your web application behaves under various scale configurations, you should perform local testing on both a physical Android device and an emulator.
- Open the system settings on your Android device and navigate to Settings, then Accessibility, and select Font size or Display size.
- Adjust the slider to the maximum setting (often called Largest or Extra Large).
- Launch your Trusted Web Activity and navigate through key operational flows such as registration, forms, shopping carts, and settings panels.
- Check for any text that overlaps buttons, falls outside borders, or runs off the viewport bounds.
- Use Chrome DevTools remote debugging to inspect elements that fail to scale correctly and adjust your CSS rules in real-time.
By implementing elastic layout principles and applying the appropriate CSS adjustments, you can deliver an application that is both beautifully designed and accessible to all users on the Google Play Store.
Ready to ship your Android app?
Paste your PWA URL, get a signed APK and a Google Play ready AAB in minutes.
Build my app