Skip to content

Package-level declarations

Types

Name

Summary

ExperimentalFontIconsApi

Common

kotlin
annotation class ExperimentalFontIconsApi

Marks APIs that are experimental and may be changed.

FontConstructor

Android

kotlin
typealias FontConstructor = (weight: FontWeight, variationSettings: FontVariation.Settings) -> Font

A function returning a Font object, taking as parameters the weight (FontWeight) and the other variation settings (FontVariation.Settings)

FontIconDrawable

Android

A drawable that draws an icon using a icon font. This effectively just calls Canvas.drawFontIcon on the Drawable canvas.

IconFont

Common

kotlin
sealed class IconFont

An icon font used to draw icons. Subclasses, methods and properties are internal to the library.

StaticIconFont

Common

kotlin
class StaticIconFont : IconFont

Fixed icon font, for non-variable fonts. Multiple fonts might be provided to support multiple weights.

VariableIconFont

Common

kotlin
abstract class VariableIconFont : IconFont

Variable icon font, for variable fonts. The optical size (opsz) and weight (wght) axes will be automatically set.

Properties

Name

Summary

LocalIconFont

Common

The default IconFont used when none is provided as a parameter of one of the FontIcon composables.

LocalIconSize

Common

The default icon size (in Dp) used when none is provided in the composable Modifier.

LocalIconTint

Common

The default icon tint (a Color) used when none is provided as a parameter of one of the FontIcon composables.

LocalIconTintProvider

Common

The default icon tint provider (a CompositionLocal for a Color) used when none is provided as a parameter of one of the FontIcon composables. If null, the value of LocalIconTint will be used instead. When using Material3, should be most likely set to LocalContentColor.

LocalIconWeight

Common

The default icon weight (a FontWeight) used when none is provided as a parameter of one of the FontIcon composables.

Functions

Name

Summary

createStaticIconFont

Android

kotlin
actual suspend fun createStaticIconFont(fontResource: FontResource, fontFeatureSettings: String?, resourceEnvironment: ResourceEnvironment): StaticIconFont

Common

kotlin
fun createStaticIconFont(vararg fonts: Font, fontFeatureSettings: String? = null): StaticIconFont

Creates a static IconFont using a list of Font objects. Multiple fonts might be provided to support multiple weights.

kotlin
expect suspend fun createStaticIconFont(fontResource: FontResource, fontFeatureSettings: String? = null, resourceEnvironment: ResourceEnvironment = getSystemResourceEnvironment()): StaticIconFont

Creates a static IconFont using a Compose Multiplatform FontResource.


Skiko (Desktop & Web)

kotlin
actual suspend fun createStaticIconFont(fontResource: FontResource, fontFeatureSettings: String?, resourceEnvironment: ResourceEnvironment): StaticIconFont

createVariableIconFont

Android

kotlin
fun createVariableIconFont(fontConstructor: FontConstructor, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont using a FontConstructor.

kotlin
actual suspend fun createVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings, fontFeatureSettings: String?, resourceEnvironment: ResourceEnvironment, density: Density?): VariableIconFont

Common

kotlin
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.


Skiko (Desktop & Web)

kotlin
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.

kotlin
actual suspend fun createVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings, fontFeatureSettings: String?, resourceEnvironment: ResourceEnvironment, density: Density?): VariableIconFont

drawFontIcon

Android

kotlin
fun Canvas.drawFontIcon(icon: Char, typeface: Typeface, fontFeatureSettings: String?, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp)

An extension function that draws the icon using the typeface into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(iconName: String, typeface: Typeface, fontFeatureSettings: String?, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp)

An extension function that draws the icon iconName using the typeface into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(icon: Char, iconFont: StaticIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT))

An extension function that draws the icon using the iconFont into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(icon: Char, iconFont: VariableIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT))

An extension function that draws the icon using the variable iconFont into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(iconName: String, iconFont: StaticIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT))

An extension function that draws the icon iconName using the iconFont into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(iconName: String, iconFont: VariableIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT))

An extension function that draws the icon iconName using the variable iconFont into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(icon: Char, typeface: Typeface, fontFeatureSettings: String?, fontVariationSettings: FontVariation.Settings, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT))

An extension function that draws the icon using the variable typeface into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun Canvas.drawFontIcon(iconName: String, typeface: Typeface, fontFeatureSettings: String?, fontVariationSettings: FontVariation.Settings, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT))

An extension function that draws the icon iconName using the variable typeface into the receiver Canvas. The icon will be size × size dp, and will be tinted with tint.

FontIcon

Common

kotlin
@Composable
fun FontIcon(icon: Char, contentDescription: String?, modifier: Modifier = Modifier, tint: Color = LocalIconTintProvider.current?.current ?: LocalIconTint.current, weight: FontWeight = LocalIconWeight.current, iconFont: IconFont = LocalIconFont.current)

A component that draws the icon icon using iconFont (with a default value of LocalIconFont. The icon will be size × size dp, and will be tinted with tint. If iconFont is a variable font, weight will applied as a variation setting, or else the font with the nearest weight will be picked.

kotlin
@Composable
fun FontIcon(iconName: String, contentDescription: String?, modifier: Modifier = Modifier, tint: Color = LocalIconTintProvider.current?.current ?: LocalIconTint.current, weight: FontWeight = LocalIconWeight.current, iconFont: IconFont = LocalIconFont.current)

A component that draws the icon iconName using iconFont (with a default value of LocalIconFont. The icon will be size × size dp, and will be tinted with tint. If iconFont is a variable font, weight will applied as a variation setting, or else the font with the nearest weight will be picked.

FontIconBitmap

Android

kotlin
fun FontIconBitmap(icon: Char, typeface: Typeface, fontFeatureSettings: String?, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp): Bitmap

A function that draws the icon using the typeface into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(iconName: String, typeface: Typeface, fontFeatureSettings: String?, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp): Bitmap

A function that draws the icon iconName using the typeface into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(icon: Char, iconFont: StaticIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT)): Bitmap

A function that draws the icon using the iconFont into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(icon: Char, iconFont: VariableIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT)): Bitmap

A function that draws the icon using the variable iconFont into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(iconName: String, iconFont: StaticIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT)): Bitmap

A function that draws the icon iconName using the iconFont into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(iconName: String, iconFont: VariableIconFont, tint: Color, context: Context, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT)): Bitmap

A function that draws the icon iconName using the variable iconFont into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(icon: Char, typeface: Typeface, fontFeatureSettings: String?, fontVariationSettings: FontVariation.Settings, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT)): Bitmap

A function that draws the icon using the variable typeface into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

kotlin
fun FontIconBitmap(iconName: String, typeface: Typeface, fontFeatureSettings: String?, fontVariationSettings: FontVariation.Settings, tint: Color, density: Density, size: Dp = DEFAULT_ICON_SIZE_DP.dp, weight: FontWeight = FontWeight(DEFAULT_ICON_WEIGHT)): Bitmap

A function that draws the icon iconName using the variable typeface into a new Bitmap. The icon will be size × size dp, and will be tinted with tint.

ProvideIconParameters

Common

kotlin
@Composable
fun ProvideIconParameters(iconFont: IconFont = LocalIconFont.current, size: Dp = LocalIconSize.current, tintProvider: CompositionLocal<Color>? = LocalIconTintProvider.current, weight: FontWeight = LocalIconWeight.current, content: @Composable () -> Unit)

A shortcut method to set default values for FontIcon composables. Might be better to use CompositionLocalProvider if it's for setting only one of the default values.

kotlin
@Composable
fun ProvideIconParameters(iconFont: IconFont = LocalIconFont.current, size: Dp = LocalIconSize.current, tint: Color = LocalIconTint.current, weight: FontWeight = LocalIconWeight.current, content: @Composable () -> Unit)

A shortcut method to set default values for FontIcon composables. Might be better to use CompositionLocalProvider if it's for setting only one of the default values.

rememberStaticIconFont

Android

kotlin
@Composable
actual fun rememberStaticIconFont(fontResource: FontResource, fontFeatureSettings: String?): StaticIconFont

Common

kotlin
@Composable
fun rememberStaticIconFont(font: Font, fontFeatureSettings: String? = null): StaticIconFont

Creates a static IconFont using a Font.

kotlin
@Composable
fun rememberStaticIconFont(vararg fonts: Font, fontFeatureSettings: String? = null): StaticIconFont

Creates a static IconFont using a list of Font objects. Multiple fonts might be provided to support multiple weights.

kotlin
@Composable
expect fun rememberStaticIconFont(fontResource: FontResource, fontFeatureSettings: String? = null): StaticIconFont

Creates a static IconFont using a Compose Multiplatform FontResource.


Skiko (Desktop & Web)

kotlin
@Composable
actual fun rememberStaticIconFont(fontResource: FontResource, fontFeatureSettings: String?): StaticIconFont

rememberVariableIconFont

Android

kotlin
@RequiresApi(value = 26)
@Composable
fun rememberVariableIconFont(fileDescriptor: ParcelFileDescriptor, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont using a ParcelFileDescriptor. Requires Android Oreo or higher.

kotlin
@Composable
fun rememberVariableIconFont(file: File, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont from a file.

kotlin
@Composable
fun rememberVariableIconFont(fontConstructor: FontConstructor, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont using a FontConstructor.

kotlin
@Composable
fun rememberVariableIconFont(@FontRes resId: Int, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont using a resource id.

kotlin
@Composable
actual fun rememberVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings, fontFeatureSettings: String?): VariableIconFont
kotlin
@Composable
fun rememberVariableIconFont(path: String, weights: Array<FontWeight>, assetManager: AssetManager = rememberLocalContext().current.resources.assets, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont from a file in the assets directory.


Common

kotlin
@Composable
expect fun rememberVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null): VariableIconFont

Creates a variable IconFont using a Compose Multiplatform FontResource.


Desktop (JVM)

kotlin
@Composable
fun rememberVariableIconFont(file: File, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, density: Density = LocalDensity.current): VariableIconFont

Creates a variable IconFont from a file.

kotlin
@Composable
fun rememberVariableIconFont(resource: String, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, density: Density = LocalDensity.current): VariableIconFont

Creates a variable IconFont using a resource name.


Skiko (Desktop & Web)

kotlin
@Composable
actual fun rememberVariableIconFont(fontResource: FontResource, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings, fontFeatureSettings: String?): VariableIconFont
kotlin
@Composable
fun rememberVariableIconFont(alias: String, data: ByteArray, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, density: Density = LocalDensity.current): VariableIconFont

Creates a variable IconFont using a byte array with loaded font data.

kotlin
@Composable
fun rememberVariableIconFont(alias: String, baseTypeface: Typeface, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, density: Density = LocalDensity.current): VariableIconFont

Creates a variable IconFont using a Skia Typeface.


Web (JS & WASM)

kotlin
@Composable
fun rememberVariableIconFont(resource: Any?, weights: Array<FontWeight>, fontVariationSettings: FontVariation.Settings = FontVariation.Settings(), fontFeatureSettings: String? = null, density: Density = LocalDensity.current): VariableIconFont

Creates a variable IconFont using the path of a font.