Text Will Not Always Scale

Text Will Not Always Scale

I have long been a fan of Android’s nudges towards using sp as units for text.
This unit takes into account the font scale setting, so the visually impaired can
have your app display its text larger. However, it is 2023, and support for font scaling
is far from universal. Developer nudges remain fine, but it is important to recognize
that text will not always scale based on font scale.

Pointy-Haired Bosses

It has been a decade since Android was predominantly a hobbyist OS. Nowadays, having
an Android app is typical, especially for major brands. Those apps are not just tossed together
by some developers — rather, they are professionally designed and have scope/features
approved by executives.

In other words, developers are no longer “calling the shots” on whether or not font scaling
will be honored.

Instead, developers need to follow the designers’ directives and executive mandates. If those
directives and mandates include support for font scaling, great! If they do not,
developers can advocate for font scaling. But, in the end, the directives and mandates need
to be followed, or the developers will be replaced by other developers, ones who follow
instructions.

Today, if advocates want font scaling, badgering developers about it is counter-productive.
Advocates need to:

  • Convince designers to take font scaling into account

  • Convince executives to take font scaling into account and to adequate fund the design
    department so they have the time to devote to having designs that can adapt to font
    scale values

Google (and other app distribution channels) could try to enforce font scaling. Google
is doing that in 2023 for Wear OS.
If they enforce it, some Wear OS apps will no longer be published, because the designers
simply are not in position to support it.

And Google is partly to blame for that.

Consistently Inconsistent

One thing that Google could have done to reduce the burden on designers would have been
to enforce consistent font scaling across Google Play ecosystem devices:

  • How small can the font scale?

  • How large can the font scale?

  • What is the granularity in font scale change?

Google elected not to enforce this. As a result, it is up to device manufacturers,
and they have varied significantly. AFAICT, Google has never published information about
what the overall ecosystem limits are — and my guess is that Google has never compiled
this information. As a result, AFAICT nobody knows what the overall maximum font scale might
be. Even on Wear OS there are font scaling differences between models, and there are a handful of watch
models, compared to tens of thousands of phone models.

No designer is going to sign up to support arbitrary font scaling. At best, designers
might be willing to support font scaling using a couple of reference devices and hope
for the best for manufacturers who go beyond what those reference devices do. Other
designers will use the lack of guidance as a rationale for just ignoring font scaling
entirely.

And, in some cases, designers aren’t wrong.

Dewey Defeats Truman!

For a very long time, Google’s belief was that this newspaper headline
would need to scale based upon the device font scale. While the article text ideally
would scale, the headline does not need to scale, because the headline is already
huge.

The reality is that not all text needs to scale, because the text may already be
big enough, even for visually impaired readers.

Google did eventually catch on to this… a few months ago. Android 14 supports
non-linear font scaling,
so larger text will not scale the same as smaller text. Google even claims now
to cap scaling to 200%, though it remains to be seen if they will enforce that
limit or let manufacturers do whatever they want.

However, it will be 2028 before Android 14 dominates. In the meantime, we need to
deal with devices that lack this non-linear font scaling support.

How Google Could Help

Google could create a new Jetpack library (e.g., androidx.text) with utility code
to assist in dealing with font scaling. Or, perhaps that goes in some existing
library (e.g., androidx.compose.ui:ui-unit).

Partly, this would provide a backwards-compatible way to get the non-linear
font scaling support. For example, in Compose UI, perhaps we could have a .nlsp extension
property for Int and Float that matches the .sp extension property but applies
the non-linear font scaling algorithm.

Ideally, Google’s utility code would also offer constrained scaling support. Many
designs for text UI elements can support some amount of font scaling, just not
“to infinity and beyond”. Google’s attitude to date has been that apps need to precisely
support the system font scale, rather than using that font scale as guidance for what
the user wants. If we had easy-to-apply options to say that a particular bit of text
can scale from X to Y, but not all the way to 200%, developers will have an easier time
“sneaking in” font scaling support. Similarly, designers can focus on providing instructions
for how far the font could scale in spots, rather than having to redo designs to accommodate
arbitrary font scales (200% or higher).

For example, in addition to a .nlsp extension property, there could be a .nlsp()
extension function for Int and Float that takes minScale and maxScale parameters.
In addition to applying the non-linear font scaling support, .nlsp() would clamp the
scale based on those supplied parameters.


In the end, pretty much everybody wants to be adaptive to the needs of the visually
impaired. However, that is one objective out of many, and not all objectives have
equal weight. If Google wants font scaling support to be more widespread, it needs to:

  • Work on convincing executives and designers to increase the weight of that objective, and

  • Provide more and better options for designers and developers to support font scaling
    on an incremental or progressive basis

The latter seems like a more realistic approach — it just recognizes that one size
does not fit all, both in terms of text and how we scale that text.