Status Update
Comments
fu...@google.com <fu...@google.com> #2
Backporting to Views will be extremely complex; I'm not even sure we'll be able to do it robustly and consistently. Since all Views convert their SP -> PX font sizes via the TypedValue class, we'd somehow have to make sure that all Views and all Resources and other areas use the TypedValueCompat class with backported tables instead.
Since the TypedValue static methods are littered all over the View framework codebase, this seems difficult. The only way I can think of is by using some classloader trick to swap out the TypedValue calls to TypedValueCompat calls, but I'm not familiar enough with the classloader trick to know if that will work in all cases (e.g. are there any areas in system server that do the conversion themselves... RemoteViews for widgets and notifications, for instance?)
Description
Non-linear font scaling was introduced in the platform in Android 14:https://developer.android.com/about/versions/14/features#non-linear-font-scaling
It maybe be possible to backport this to older versions of Android by backporting the lookup tables. This is currently the approach that Compose uses to implement non-linear font scaling, across all API versions:https://android-review.git.corp.google.com/c/platform/frameworks/support/+/2692669