summaryrefslogtreecommitdiff
path: root/libs/androidfw/ResourceUtils.cpp
diff options
context:
space:
mode:
author Tyler Freeman <fuego@google.com> 2022-11-29 12:09:02 -0800
committer Tyler Freeman <fuego@google.com> 2022-11-29 12:09:02 -0800
commit5f7036df71263fbb2602f6f95c0ebe4466709cc7 (patch)
tree427f025d808ebf93dc9132877f8c1283ef2ca893 /libs/androidfw/ResourceUtils.cpp
parenteb803fd53e0222285b5b475c0e120873933c430c (diff)
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
Diffstat (limited to 'libs/androidfw/ResourceUtils.cpp')
0 files changed, 0 insertions, 0 deletions