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 canhave your app display its text larger. However, it is 2023, and support for font scalingis far from universal. Developer nudges remain fine, but it is important to recognizethat 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, havingan Android app is typical, especially for major brands. Those apps are not just tossed togetherby some developers ��� rather, they are professionally designed and have scope/featuresapproved by executives.

In other words, developers are no longer ���calling the shots��� on whether or not font scalingwill be honored.

Instead, developers need to follow the designers��� directives and executive mandates. If thosedirectives 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 needto be followed, or the developers will be replaced by other developers, ones who followinstructions.

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 designdepartment so they have the time to devote to having designs that can adapt to fontscale values

Google (and other app distribution channels) could try to enforce font scaling. Googleis doing that in 2023 for Wear OS.If they enforce it, some Wear OS apps will no longer be published, because the designerssimply 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 beento 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 aboutwhat the overall ecosystem limits are ��� and my guess is that Google has never compiledthis information. As a result, AFAICT nobody knows what the overall maximum font scale mightbe. Even on Wear OS there are font scaling differences between models, and there are a handful of watchmodels, compared to tens of thousands of phone models.

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

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

Dewey Defeats Truman!

For a very long time, Google���s belief was that this newspaper headlinewould need to scale based upon the device font scale. While the article text ideallywould scale, the headline does not need to scale, because the headline is alreadyhuge.

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

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

However, it will be 2028 before Android 14 dominates. In the meantime, we need todeal 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 codeto assist in dealing with font scaling. Or, perhaps that goes in some existinglibrary (e.g., androidx.compose.ui:ui-unit).

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

Ideally, Google���s utility code would also offer constrained scaling support. Manydesigns 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 preciselysupport the system font scale, rather than using that font scale as guidance for whatthe user wants. If we had easy-to-apply options to say that a particular bit of textcan 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 instructionsfor how far the font could scale in spots, rather than having to redo designs to accommodatearbitrary 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 thescale based on those supplied parameters.

In the end, pretty much everybody wants to be adaptive to the needs of the visuallyimpaired. However, that is one objective out of many, and not all objectives haveequal 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 scalingon an incremental or progressive basis

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

 •  0 comments  •  flag
Share on Twitter
Published on July 08, 2023 05:45
No comments have been added yet.