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


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


> **Deprecated** This API is deprecated with the introduction of async fonts which cannot resolve in this context. To preload fonts, use FontFamily.Resolver.



<h2 id="typeface-context-fontfamily-styles">Typeface</h2>

```kotlin
fun Typeface(
    context: Context,
    fontFamily: FontFamily,
    styles: List<Pair<FontWeight, FontStyle>>? = null,
): androidx.compose.ui.text.font.Typeface
```


Build an Android specific Typeface from FontFamily.

You can pass `styles` for loading only specific styles.

This function caches the internal native Typeface but always create the new Typeface object.
Caller should cache if necessary.

#### Parameters

| | |
| --- | --- |
| context | the context to be used for loading Typeface. |
| fontFamily | the font family to be loaded |
| styles | optional style filter for loading subset of fontFamily. null means load all fonts in fontFamily. |


#### Returns

| | |
| --- | --- |
|  | `androidx.compose.ui.text.font.Typeface` instance |






<hr class="docs-overload-divider">


<h2 id="typeface-typeface">Typeface</h2>

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


```kotlin
fun Typeface(typeface: Typeface): androidx.compose.ui.text.font.Typeface
```


Returns a Compose `androidx.compose.ui.text.font.Typeface` from Android `Typeface`.

#### Parameters

| | |
| --- | --- |
| typeface | Android Typeface instance |