create

abstract fun create(resId: Int, weight: (FontWeights) -> FontWeight, style: (FontStyles) -> FontStyle, loadingStrategy: (FontLoadingStrategies) -> FontLoadingStrategy): Font

通过资源ID创建一个字体。

Return

一个新的 Font 实例。

Parameters

resId

字体文件的资源ID (例如 R.font.myfont)。

weight

一个函数,用于从提供的 FontWeights 实例中选择字体粗细 (例如 { it.getNormal() })。

style

一个函数,用于从提供的 FontStyles 实例中选择字体样式 (例如 { it.getNormal() })。

loadingStrategy

一个函数,用于从提供的 FontLoadingStrategies 实例中选择字体加载策略 (例如 { it.getBlocking() })。