You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AccessibilityInfo provides isBoldTextEnabled to determine if the bold font is enabled in accessibility settings. Currently, this option is limited to iOS. But on Android on API level 31 (Android 12) it is possible to determine its value by using fontWeightAdjustment in the Configuration class.
Details
On Pixel 5 device, for example, this option can be changed from "Settings > Accessibility > Text and Display"
Its value can be obtained by the Configuration class:
Configuration config = this.getResources().getConfiguration();
int fontWeight = config.fontWeightAdjustment;
Finding this value has practical applications. First, it allows developers to work around a current bug in text rendering of elements: Text component cuts part of the text if fontWeight bold is used. The issue is closed, but the problem still exists, as indicated by the sheer amount of user reports. Furthermore, the current workaround of adding spaces at the end of the text is no silver bullet because, depending on the text, the number of spaces that should be added to display the text correctly is variable.
Even if this issue gets fixed one day, this option provides a level of precision in text rendering that would not be possible without a way to detect this configuration.
The text was updated successfully, but these errors were encountered:
Introduction
AccessibilityInfo provides
isBoldTextEnabled
to determine if the bold font is enabled in accessibility settings. Currently, this option is limited to iOS. But on Android on API level 31 (Android 12) it is possible to determine its value by using fontWeightAdjustment in the Configuration class.Details
On Pixel 5 device, for example, this option can be changed from "Settings > Accessibility > Text and Display"
Its value can be obtained by the Configuration class:
Finding this value has practical applications. First, it allows developers to work around a current bug in text rendering of elements: Text component cuts part of the text if fontWeight bold is used. The issue is closed, but the problem still exists, as indicated by the sheer amount of user reports. Furthermore, the current workaround of adding spaces at the end of the text is no silver bullet because, depending on the text, the number of spaces that should be added to display the text correctly is variable.
Even if this issue gets fixed one day, this option provides a level of precision in text rendering that would not be possible without a way to detect this configuration.
The text was updated successfully, but these errors were encountered: