Resolve styles by font table if not specified.

android:fontStyle and android:fontWeight is an optional attribute.
If they are missing, we are using non-italic 400 weight, but this is
not good idea. We should resolve these style value from font metadata.

Bug: 37988154
Test: am instrument -w -e class android.content.res.cts.ResourcesTest
      android.content.cts/android.support.test.runner.AndroidJUnitRunner

Change-Id: I80a436cd3632d8c58fa3d8bdaedac73b95f61a8c
This commit is contained in:
Seigo Nonaka
2017-05-04 16:39:28 -07:00
parent abfa176b45
commit a5fa9e8a63
3 changed files with 14 additions and 14 deletions

View File

@@ -233,8 +233,7 @@ public class Typeface {
// TODO: Add ttc and variation font support. (b/37853920)
if (!fontFamily.addFontFromAssetManager(mgr, fontFile.getFileName(),
0 /* resourceCookie */, false /* isAsset */, 0 /* ttcIndex */,
fontFile.getWeight(), fontFile.isItalic() ? STYLE_ITALIC : STYLE_NORMAL,
null /* axes */)) {
fontFile.getWeight(), fontFile.getItalic(), null /* axes */)) {
return null;
}
}