4. Typeface.Builder
● Replacement for createFromAsset,
createFromFile.
● Variable Font Support (later)
● Font Collection Support
textView1.typeface =
Typeface.Builder(assets, "NotoSansCJK-Regular.ttc")
.setTtcIndex(0).build()
textView2.typeface =
Typeface.Builder(assets, "NotoSansCJK-Regular.ttc")
.setTtcIndex(1).build()
textView3.typeface =
Typeface.Builder(assets, "NotoSansCJK-Regular.ttc")
.setTtcIndex(2).build()
textView4.typeface =
Typeface.Builder(assets, "NotoSansCJK-Regular.ttc")
.setTtcIndex(3).build()
5. Variable Font
● OpenType Variable Font
● Either string representation or
FontVariationAxis class can be
used.
textView1.typeface =
Typeface.Builder(assets, "AdobeVFPrototype.ttf")
.setFontVariationSettings("'wght' 200").build()
textView2.typeface =
Typeface.Builder(assets, "AdobeVFPrototype.ttf")
.setFontVariationSettings("'wght' 400").build()
textView3.typeface =
Typeface.Builder(assets, "AdobeVFPrototype.ttf")
.setFontVariationSettings("'wght' 700").build()
textView4.typeface =
Typeface.Builder(assets, "AdobeVFPrototype.ttf")
.setFontVariationSettings("'wght' 900").build()
6. Locale List Fallback
● Font selector is now aware of locale list
● By default, system locale settings is
used.
textView1.textLocales =
LocaleList.forLanguageTags("en-US,ja-JP")
textView2.textLocales =
LocaleList.forLanguageTags("en-US,zh-CN")
textView3.textLocales =
LocaleList.forLanguageTags("en-US,zh-TW")
textView4.textLocales =
LocaleList.forLanguageTags("ja-JP,zh-TW")
7. Serif Fallback
● System font is now aware of serif font.
● Use serif font if fonFamily=”serif” is
specified.
9. Line Spacing
Improvement
● Avoid glyph overlap for the taller glyph
languages.
● Enabled by default API 28+
● You can move back to old impl by
specifying fallbackLineSpacing=”false”