Add system font size as a device attribute#427
Open
claude[bot] wants to merge 6 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Jake Mor · Slack thread
Before
There was no device attribute exposing the user's system font size, so paywalls couldn't adapt to the device's text-size accessibility setting.
After
Adds two device attributes describing the system font size:
fontScale: the raw system text-scale multiplier as aFloat. The system default is1.0; larger accessibility text scales report proportionally larger values (e.g.1.3).fontSize: a normalized integer in px derived from the same scale, using a 16px reference base so that the system default (scale1.0) reports16. Larger scales report proportionally larger values (e.g. scale1.3→21).Android has no OS-level content-size category, so no category attribute is reported.
How
DeviceHelper.fontScalereturnscontext.resources.configuration.fontScale.DeviceHelper.fontSizecomputes(context.resources.configuration.fontScale * 16).roundToInt().DeviceTemplategainsfontScale: FloatandfontSize: Intfields (JSON keysfontScaleandfontSize), populated ingetTemplateDevice().DeviceTemplateTestand theCHANGELOGare updated accordingly.