Fixed
Status Update
Comments
ow...@google.com <ow...@google.com>
se...@google.com <se...@google.com> #3
Amended the behavior slightly to find the best match from the requested style.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 6e7a1ffacde6ead3acbff09514503e896d3c8bf3
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Mar 29 11:04:25 2022
TypefaceCompatApi29 finds best from requested style
This causes fonts closer to the desired style to be chosen on
resolution.
Test: ./gradlew :core:core:cAT
Bug: b/194553426
Relnote: "TypefaceCompat will now respect both requested and loaded
style information on API 29+. This is a behavior change when the loaded
fonts are not FontWeight.Normal or FontWeight.Bold, as the actual loaded
weight and style will be used. For more information see b/194553426 "
Change-Id: I1f90279afa68afa450bb98eb7c5237464c5f57d8
M core/core/src/androidTest/java/androidx/core/graphics/TypefaceCompatTest.java
M core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
A core/core/src/androidTest/res/font/samplexmlfont_medium.xml
M core/core/src/main/java/androidx/core/graphics/TypefaceCompatApi29Impl.java
https://android-review.googlesource.com/2047984
Branch: androidx-main
commit 6e7a1ffacde6ead3acbff09514503e896d3c8bf3
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Mar 29 11:04:25 2022
TypefaceCompatApi29 finds best from requested style
This causes fonts closer to the desired style to be chosen on
resolution.
Test: ./gradlew :core:core:cAT
Bug:
Relnote: "TypefaceCompat will now respect both requested and loaded
style information on API 29+. This is a behavior change when the loaded
fonts are not FontWeight.Normal or FontWeight.Bold, as the actual loaded
weight and style will be used. For more information see
Change-Id: I1f90279afa68afa450bb98eb7c5237464c5f57d8
M core/core/src/androidTest/java/androidx/core/graphics/TypefaceCompatTest.java
M core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
A core/core/src/androidTest/res/font/samplexmlfont_medium.xml
M core/core/src/main/java/androidx/core/graphics/TypefaceCompatApi29Impl.java
se...@google.com <se...@google.com> #6
Since it's not listed here, repeating:
This was solved by github contribution
Description
Artifact used: androidx.core:core:1.6.0 Version used: 1.6.0 Theme used: (Not related) Devices/Android versions reproduced on: Pixel 5 Android 11
This part will make the final Typeface lost the correct font-weight from the FontInfo. For example, request for a font with 500 weight, but the final Typeface has 400 weight. This will make the fallback font incorrectly displayed.
The fix is to use the style from the best-matched font, just like the platform,https://cs.android.com/android/platform/superproject/+/android-11.0.0_r1:frameworks/base/graphics/java/android/graphics/Typeface.java;l=276-285 .