resolveFont

open override fun resolveFont(fontFamily: String?, fontWeight: Int, fontStyle: String?): Typeface?

Called by renderer to resolve font references in elements.

Parameters

fontFamily

Font family as specified in a font-family attribute of css.

fontWeight

Font weight as specified in a font-weight attribute of css.

fontStyle

Font style as specified in a font-style attribute of css.

As per css stylesheet associated as well as the font files supported by the provider data-set, it supports the following values for font-weight and font-style

font-weight | NORMAL: 400 | BOLD: 700

--------------------------------------

font-style | NORMAL | ITALIC | OBLIQUE

--------------------------------------

Filename should be in the format: $font-family-$font-style$font-weight

For example for the given input:

font-family | font-style | font-weight | fileName

------------------------------------------------------------------

SignText | Normal | Bold | SignText-Bold.ttf SignText | Italic | Normal | SignText-Italic.ttf SignText | Italic | Bold | SignText-ItalicBold.ttf SignText | Normal | Normal | SignText.ttf

Looking above it's understood that whenever style or weight value is normal it's represented by empty string.

In case the font is not found in the assets, it falls back to system font matching the requested attributes.