---
title: "AndroidFont"
description: "Font for use on Android.

All [AndroidFont] produce an [android.graphics.Typeface] which may be used to draw text on
Android. This is the main low-level API for introducing a new Font description to Compose on
Android for both blocking and async load.

You may subclass this to add new types of font descriptions that may be used in
[FontListFontFamily]. For example, you can add a [FontLoadingStrategy.Blocking] font that returns
a Typeface from a local resource not supported by an existing [Font]. Or, you can create an
[FontLoadingStrategy.Async] font that loads a font file from your server.

When introducing new font descriptors, it is recommended to follow the patterns of providing a
public Font constructor and a private implementation class:
1. Declare an internal or private subclass of AndroidFont
2. Expose a public Font(...) constructor that returns your new type.

Font constructors are
1. Regular functions named `Font` that return type `Font`
2. The first argument is the font name, or similar object that describes the font uniquely
3. If the font has a provider, loader, or similar argument, put it after the font name.
4. The last two arguments are FontWeight and FontStyle.

Examples of Font constructors:
```
fun Font(\"myIdentifier\", MyFontLoader, FontWeight, FontStyle): Font
fun Font(CustomFontDescription(...), MyFontLoader, FontWeight, FontStyle): Font
fun Font(CustomFontDescription(...), FontWeight, FontStyle): Font
```"
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
abstract class AndroidFont
constructor(
    final override val loadingStrategy: FontLoadingStrategy,
    val typefaceLoader: TypefaceLoader,
    variationSettings: FontVariation.Settings,
) : Font
```


Font for use on Android.

All `AndroidFont` produce an `android.graphics.Typeface` which may be used to draw text on
Android. This is the main low-level API for introducing a new Font description to Compose on
Android for both blocking and async load.

You may subclass this to add new types of font descriptions that may be used in
`FontListFontFamily`. For example, you can add a `FontLoadingStrategy.Blocking` font that returns
a Typeface from a local resource not supported by an existing `Font`. Or, you can create an
`FontLoadingStrategy.Async` font that loads a font file from your server.

When introducing new font descriptors, it is recommended to follow the patterns of providing a
public Font constructor and a private implementation class:
1. Declare an internal or private subclass of AndroidFont
2. Expose a public Font(...) constructor that returns your new type.

Font constructors are
1. Regular functions named `Font` that return type `Font`
2. The first argument is the font name, or similar object that describes the font uniquely
3. If the font has a provider, loader, or similar argument, put it after the font name.
4. The last two arguments are FontWeight and FontStyle.

Examples of Font constructors:
```
fun Font("myIdentifier", MyFontLoader, FontWeight, FontStyle): Font
fun Font(CustomFontDescription(...), MyFontLoader, FontWeight, FontStyle): Font
fun Font(CustomFontDescription(...), FontWeight, FontStyle): Font
```

#### Parameters

| | |
| --- | --- |
| loadingStrategy | loadingStrategy this font will provide in fallback chains |
| typefaceLoader | a loader that knows how to load this `AndroidFont`, may be shared between several fonts |
| variationSettings | the settings that will be applied to this font, if supported by the font |



## Secondary Constructors

```kotlin
constructor(
    loadingStrategy: FontLoadingStrategy,
    typefaceLoader: TypefaceLoader,
) : this(loadingStrategy, typefaceLoader, FontVariation.Settings())
```

## Properties

<div class='sourceset sourceset-android'>Android</div>


```kotlin
val : FontVariation.Settings
```


The settings that will be applied to this font, if supported by the font.

If the font does not support a `FontVariation.Setting`, it has no effect.

Subclasses are required to apply these variation settings during font loading path on
appropriate API levels, for example by using `Typeface.Builder.setFontVariationSettings`.

Subclasses may safely apply all variation settings without querying the font file. Android
will ignore any unsupported axis.




