SourceSets
createVariableIconFont
Android
fun createVariableIconFont(fontConstructor: FontConstructor, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont
Creates a variable IconFont using a FontConstructor.
This function is not composable, use rememberVariableIconFont when in a composition.
Parameters
fontConstructor | a function returning a Font object, taking as parameters the weight (FontWeight) and the variation settings (FontVariation.Settings) |
weights | the supported weights for the font |
fontVariationSettings | the font variation settings, should not include the optical size ('opsz') and must not include the weight ('wght') |
fontFeatureSettings | the font feature settings, written in a CSS syntax |
actual suspend fun createVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings, fontFeatureSettings: String?, resourceEnvironment: ResourceEnvironment, density: Density?): VariableIconFont
Common
expect suspend fun createVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, resourceEnvironment: ResourceEnvironment = getSystemResourceEnvironment(), density: Density? = null): VariableIconFont
Creates a variable IconFont using a Compose Multiplatform FontResource.
This function is marked as experimental because its Android implementation is using experimental workarounds:
On Android 11 and higher this will shortly create an in-memory file descriptor.
On Android 8 and higher this will create a temporary file (this file will be deleted after the font is loaded).
On Android 7 and lower this will also create a temporary file, but the variation settings will be ignored.
This function is not composable, use rememberVariableIconFont when in a composition.
Parameters
fontResource | the Compose Multiplatform resource ID |
weights | the supported weights for the font |
fontVariationSettings | the font variation settings, should not include the optical size ('opsz') and must not include the weight ('wght') |
fontFeatureSettings | the font feature settings, written in a CSS syntax |
resourceEnvironment | the resource environment to use to load the font |
density | the density of the screen, optionally used to convert density-dependent variation settings to pixels |
Skiko (Desktop & Web)
fun createVariableIconFont(alias: String, baseTypeface: Typeface, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, density: Density? = null): VariableIconFont
Creates a variable IconFont using a Skia Typeface.
This function is not composable, use rememberVariableIconFont when in a composition
Parameters
alias | the internal name to differentiate the typeface |
baseTypeface | the base Skia SkTypeface that will be cloned for each required variation settings |
weights | the supported weights for the font |
fontVariationSettings | the font variation settings, should not include the optical size ('opsz') and must not include the weight ('wght') |
fontFeatureSettings | the font feature settings, written in a CSS syntax |
density | the density of the screen, optionally used to convert density-dependent variation settings to pixels |
actual suspend fun createVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings, fontFeatureSettings: String?, resourceEnvironment: ResourceEnvironment, density: Density?): VariableIconFont