feat(non linear font scaling)!: add FontScaleConverter for non-linear font scaling.
Non-linear font scaling is meant to improve readability at larger font scales: larger fonts will scale up more slowly than smaller fonts, so we don't get ridiculously huge fonts that don't fit on the screen. The thinking here is that large fonts are already big enough to read, but we still want to scale them slightly to preserve the visual hierarchy when compared to smaller fonts. The FontScaleConverter converts SP dimensions to DP, to be used in TypedValue.applyDimension() which will affect most TextViews and font sizes automatically. For now, all the lookup tables are hardcoded. A follow-up CL will make them configurable via XML. The hardcoded arrays also default to a linear curve, as to not break any tests. The non-linear curve will come in a follow-up CL, to make it easier to roll-back if requested. Also included is some Javascript to generate the hardcoded arrays, which can later be manually tweaked and optimized. Test: unit, CTS, and manual: 1. Run `adb shell settings put system font_scale 2.0` 2. Check different apps to see if they are readable. Bug: b/237558231 Change-Id: I17d67252bf31f55e57e1f3e8a0f638770e6d2cfd
Loading
Please register or sign in to comment