# Font

## Summary

| ### Enumerations ||
|---|---|
| `https://developer.android.com/ndk/reference/group/font#group___font_1gaabfcbcb5ac86a1edac4035264bc7d2b8{ https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a3009874d5f8cbced03114160b4ae7fcf = 0, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8adee7247a912dce357709594879211656 = 100, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a8767ad4e65e2399c813d77af5804da7f = 200, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a11c51b026febe7f79c3e0f24394e37a8 = 300, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8aded7f71bf4ef5d75563439c62c0ff2a8 = 400, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8aae26106681af434529b619c7f6c32b23 = 500, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a996586e575dc0015f9ec01b4633626f3 = 600, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a35f66b7759b3c2a9575a45cebfda48f0 = 700, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a3ed2f7472c6e0854cb330e6d55896454 = 800, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8abe9fa04c0107998f3d6457376b365e41 = 900, https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8ad895619247b0e3919053a54894d1ef51 = 1000 }` | enum |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga5d76b81b0ad4c19007a781d4edb8181f{ https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181fa662aafc7016e35d6758da93416fc0833 = 0, https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181fa500d5285d88ad432c2e43e2b87300066 = 1, https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181faaa6ab436d1e4e76dc181cc4ae4d20100 = 2 }` | enum |

| ### Typedefs ||
|---|---|
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72` | typedef `struct https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72` AFont provides information of the single font configuration. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6` | typedef `struct https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6` AFontMatcher performs match operation on given parameters and available font files. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga6f655c007c16228470daa12cd480c2fd` | typedef `struct https://developer.android.com/ndk/reference/group/font#group___font_1ga6f655c007c16228470daa12cd480c2fd` ASystemFontIterator provides access to the system font configuration. |

| ### Functions ||
|---|---|
| `https://developer.android.com/ndk/reference/group/font#group___font_1gaa2616d86cfae751db57c787a987a975d()` | `https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6 *_Nonnull` Select the best font from given parameters. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1gadc4e0a77c04a90a0ba9f845ff6807d29(https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6 *_Nonnull matcher)` | `void` Destroy the matcher object. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga42b26a38bdd9533e6879ebf95b23913e(const https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6 *_Nonnull matcher, const char *_Nonnull familyName, const uint16_t *_Nonnull text, const uint32_t textLength, uint32_t *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d runLengthOut)` | `https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull` Performs the matching from the generic font family for the text and select one font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1gacd248da70e1b4b78a3fd9ac77b90d6a4(https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6 *_Nonnull matcher, uint32_t familyVariant)` | `void` Set family variant to matcher. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga22d5a6268e3854c127bdad1e3c5ddeee(https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6 *_Nonnull matcher, const char *_Nonnull languageTags)` | `void` Set font locales to matcher. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga23cf6d5da2a3ca930cef99190b2b28c9(https://developer.android.com/ndk/reference/group/font#group___font_1ga4bf8b43e5cbe21f82a557076797f1bd6 *_Nonnull matcher, uint16_t weight, bool italic)` | `void` Set font style to matcher. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga3a8aa77f94dfc0f184e3aedff72c3baa(https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d font)` | `void` Close an AFont. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1gad0a212ae4a314109df4a56d9476ec184(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font)` | `size_t` Return a count of font variation settings associated with the current font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga5af33df15a63f02f19c3f5162b8912ed(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font, uint32_t axisIndex)` | `uint32_t` Return an OpenType axis tag associated with the current font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga438cf2d41a11103c761cc6ab9c616bfd(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font, uint32_t axisIndex)` | `float` Return an OpenType axis value associated with the current font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga37c082dcb12d2f76d3929300496dd22c(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font)` | `size_t` Return a font collection index value associated with the current font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1gafe8d3b6738d37ea4d8be4d59737f126d(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font)` | `const char *_Nonnull` Return an absolute path to the current font file. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga584f29ada0a84d86f6dc2986eba5f624(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font)` | `const char *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d` Return a IETF BCP47 compliant language tag associated with the current font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1gafee474ad66edbed674817f9d2be8b904(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font)` | `uint16_t` Return a weight value associated with the current font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga88c1a77c90a3ef31c972cec292f3b792(const https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *_Nonnull font)` | `bool` Return true if the current font is italic, otherwise returns false. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga3b817f00ea4d3373663d3a31f4cca102(https://developer.android.com/ndk/reference/group/font#group___font_1ga6f655c007c16228470daa12cd480c2fd *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d iterator)` | `void` Close an opened system font iterator, freeing any related resources. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1gaf2d7810c2b8306b37d8e55c86fa33536(https://developer.android.com/ndk/reference/group/font#group___font_1ga6f655c007c16228470daa12cd480c2fd *_Nonnull iterator)` | `https://developer.android.com/ndk/reference/group/font#group___font_1ga8e3a4739c2471858cf6f49ce557c5e72 *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d` Move to the next system font. |
| `https://developer.android.com/ndk/reference/group/font#group___font_1ga9b9de86f2d9e3dff1ba3ce267dd04de4()` | `https://developer.android.com/ndk/reference/group/font#group___font_1ga6f655c007c16228470daa12cd480c2fd *https://developer.android.com/ndk/reference/group/ndk-binder#group___ndk_binder_1ga0890a8f74983b96e76f6b8748543032d` Create a system font iterator. |

## Enumerations

### Anonymous Enum 27

Declared in `android/font.h`

```
 Anonymous Enum 27
```

| Properties ||
|---|---|
| `AFONT_WEIGHT_BLACK` | A font weight value for the black weight. |
| `AFONT_WEIGHT_BOLD` | A font weight value for the bold weight. |
| `AFONT_WEIGHT_EXTRA_BOLD` | A font weight value for the extra-bold weight. |
| `AFONT_WEIGHT_EXTRA_LIGHT` | A font weight value for the extra-light weight. |
| `AFONT_WEIGHT_LIGHT` | A font weight value for the light weight. |
| `AFONT_WEIGHT_MAX` | The maximum value for the font weight value. |
| `AFONT_WEIGHT_MEDIUM` | A font weight value for the medium weight. |
| `AFONT_WEIGHT_MIN` | The minimum value fot the font weight value. |
| `AFONT_WEIGHT_NORMAL` | A font weight value for the normal weight. |
| `AFONT_WEIGHT_SEMI_BOLD` | A font weight value for the semi-bold weight. |
| `AFONT_WEIGHT_THIN` | A font weight value for the thin weight. |

### Anonymous Enum 28

Declared in `android/font_matcher.h`

```
 Anonymous Enum 28
```

| Properties ||
|---|---|
| `AFAMILY_VARIANT_COMPACT` | A family variant value for the compact font family variant. The compact font family has Latin-based vertical metrics. |
| `AFAMILY_VARIANT_DEFAULT` | A family variant value for the system default variant. |
| `AFAMILY_VARIANT_ELEGANT` | A family variant value for the elegant font family variant. The elegant font family may have larger vertical metrics than Latin font. |

## Typedefs

### AFont

Declared in `android/font.h`

```
struct AFont AFont
```
AFont provides information of the single font configuration.

### AFontMatcher

Declared in `android/font_matcher.h`

```
struct AFontMatcher AFontMatcher
```
AFontMatcher performs match operation on given parameters and available font files.

This matcher is not a thread-safe object. Do not pass this matcher to other threads.

### ASystemFontIterator

Declared in `android/system_fonts.h`

```
struct ASystemFontIterator ASystemFontIterator
```
ASystemFontIterator provides access to the system font configuration.

ASystemFontIterator is an iterator for all available system font settings. This iterator is not a thread-safe object. Do not pass this iterator to other threads.

## Functions

### AFontMatcher_create

Declared in `android/font_matcher.h`

```
AFontMatcher *_Nonnull AFontMatcher_create()
```
Select the best font from given parameters.

Creates a new AFontMatcher object.

Available since API level 29.

### AFontMatcher_destroy

Declared in `android/font_matcher.h`

```
void AFontMatcher_destroy(
  AFontMatcher *_Nonnull matcher
)
```
Destroy the matcher object.

Available since API level 29.

<br />

Details Parameters `matcher` a matcher object. Passing NULL is not allowed.

### AFontMatcher_match

Declared in `android/font_matcher.h`

```
AFont *_Nonnull AFontMatcher_match(
  const AFontMatcher *_Nonnull matcher,
  const char *_Nonnull familyName,
  const uint16_t *_Nonnull text,
  const uint32_t textLength,
  uint32_t *_Nullable runLengthOut
)
```
Performs the matching from the generic font family for the text and select one font.

For more information about generic font families, read [W3C spec](https://www.w3.org/TR/css-fonts-4/#generic-font-families)

Even if no font can render the given text, this function will return a non-null result for drawing Tofu character.

Available since API level 29.

<br />

Details Parameters `matcher` a matcher object. Passing NULL is not allowed. `familyName` a null character terminated font family name `text` a UTF-16 encoded text buffer to be rendered. Do not pass empty string. `textLength` a length of the given text buffer. This must not be zero. `runLengthOut` if not null, the font run length will be filled. **Returns** a font to be used for given text and params. You need to release the returned font by AFont_close when it is no longer needed.

### AFontMatcher_setFamilyVariant

Declared in `android/font_matcher.h`

```
void AFontMatcher_setFamilyVariant(
  AFontMatcher *_Nonnull matcher,
  uint32_t familyVariant
)
```
Set family variant to matcher.

If this function is not called, the matcher performs with [AFAMILY_VARIANT_DEFAULT](https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181fa662aafc7016e35d6758da93416fc0833).

Available since API level 29.

<br />

Details Parameters `matcher` a matcher object. Passing NULL is not allowed. `familyVariant` Must be one of [AFAMILY_VARIANT_DEFAULT](https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181fa662aafc7016e35d6758da93416fc0833), [AFAMILY_VARIANT_COMPACT](https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181fa500d5285d88ad432c2e43e2b87300066) or [AFAMILY_VARIANT_ELEGANT](https://developer.android.com/ndk/reference/group/font#group___font_1gga5d76b81b0ad4c19007a781d4edb8181faaa6ab436d1e4e76dc181cc4ae4d20100) is valid.

### AFontMatcher_setLocales

Declared in `android/font_matcher.h`

```
void AFontMatcher_setLocales(
  AFontMatcher *_Nonnull matcher,
  const char *_Nonnull languageTags
)
```
Set font locales to matcher.

If this function is not called, the matcher performs with empty locale list.

Available since API level 29.

<br />

Details Parameters `matcher` a matcher object. Passing NULL is not allowed. `languageTags` a null character terminated comma separated IETF BCP47 compliant language tags.

### AFontMatcher_setStyle

Declared in `android/font_matcher.h`

```
void AFontMatcher_setStyle(
  AFontMatcher *_Nonnull matcher,
  uint16_t weight,
  bool italic
)
```
Set font style to matcher.

If this function is not called, the matcher performs with [AFONT_WEIGHT_NORMAL](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8aded7f71bf4ef5d75563439c62c0ff2a8) with non-italic style.

Available since API level 29.

<br />

Details Parameters `matcher` a matcher object. Passing NULL is not allowed. `weight` a font weight value. Only from 0 to 1000 value is valid `italic` true if italic, otherwise false.

### AFont_close

Declared in `android/font.h`

```
void AFont_close(
  AFont *_Nullable font
)
```
Close an AFont.

Available since API level 29.

<br />

Details Parameters `font` a font returned by ASystemFontIterator_next or AFontMatchert_match. Do nothing if NULL is passed.

### AFont_getAxisCount

Declared in `android/font.h`

```
size_t AFont_getAxisCount(
  const AFont *_Nonnull font
)
```
Return a count of font variation settings associated with the current font.

The font variation settings are provided as multiple tag-values pairs.

For example, bold italic font may have following font variation settings: 'wght' 700, 'slnt' -12 In this case, AFont_getAxisCount returns 2 and AFont_getAxisTag and AFont_getAxisValue will return following values.

```
AFont* font = ASystemFontIterator_next(ite);

// Returns the number of axes
AFont_getAxisCount(font);  // Returns 2

// Returns the tag-value pair for the first axis.
AFont_getAxisTag(font, 0);  // Returns 'wght'(0x77676874)
AFont_getAxisValue(font, 0);  // Returns 700.0

// Returns the tag-value pair for the second axis.
AFont_getAxisTag(font, 1);  // Returns 'slnt'(0x736c6e74)
AFont_getAxisValue(font, 1);  // Returns -12.0
```

<br />

For more information about font variation settings, read [Font Variations Table](https://docs.microsoft.com/en-us/typography/opentype/spec/fvar)

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. **Returns** a number of font variation settings.

### AFont_getAxisTag

Declared in `android/font.h`

```
uint32_t AFont_getAxisTag(
  const AFont *_Nonnull font,
  uint32_t axisIndex
)
```
Return an OpenType axis tag associated with the current font.

See AFont_getAxisCount for more details.

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. `axisIndex` an index to the font variation settings. Passing value larger than or equal to [AFont_getAxisCount](https://developer.android.com/ndk/reference/group/font#group___font_1gad0a212ae4a314109df4a56d9476ec184) is not allowed. **Returns** an OpenType axis tag value for the given font variation setting.

### AFont_getAxisValue

Declared in `android/font.h`

```
float AFont_getAxisValue(
  const AFont *_Nonnull font,
  uint32_t axisIndex
)
```
Return an OpenType axis value associated with the current font.

See AFont_getAxisCount for more details.

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. `axisIndex` an index to the font variation settings. Passing value larger than or equal to [AFont_getAxisCount](https://developer.android.com/ndk/reference/group/font#group___font_1gad0a212ae4a314109df4a56d9476ec184) is not allowed. **Returns** a float value for the given font variation setting.

### AFont_getCollectionIndex

Declared in `android/font.h`

```
size_t AFont_getCollectionIndex(
  const AFont *_Nonnull font
)
```
Return a font collection index value associated with the current font.

In case the target font file is a font collection (e.g. .ttc or .otc), this returns a non-negative value as an font offset in the collection. This always returns 0 if the target font file is a regular font.

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. **Returns** a font collection index.

### AFont_getFontFilePath

Declared in `android/font.h`

```
const char *_Nonnull AFont_getFontFilePath(
  const AFont *_Nonnull font
)
```
Return an absolute path to the current font file.

Here is a list of font formats returned by this method:

- OpenType
- OpenType Font Collection
- TrueType
- TrueType Collection

The file extension could be one of \*.otf, \*.ttf, \*.otc or \*.ttc.

<br />

The font file returned is guaranteed to be opend with O_RDONLY. Note that the returned pointer is valid until [AFont_close()](https://developer.android.com/ndk/reference/group/font#group___font_1ga3a8aa77f94dfc0f184e3aedff72c3baa) is called for the given font.

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. **Returns** a string of the font file path.

### AFont_getLocale

Declared in `android/font.h`

```
const char *_Nullable AFont_getLocale(
  const AFont *_Nonnull font
)
```
Return a IETF BCP47 compliant language tag associated with the current font.

For information about IETF BCP47, read [Locale.forLanguageTag(java.lang.String)](https://developer.android.com/reference/java/util/Locale.html#forLanguageTag(java.lang.String))

Note that the returned pointer is valid until [AFont_close()](https://developer.android.com/ndk/reference/group/font#group___font_1ga3a8aa77f94dfc0f184e3aedff72c3baa) is called.

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. **Returns** a IETF BCP47 compliant language tag or nullptr if not available.

### AFont_getWeight

Declared in `android/font.h`

```
uint16_t AFont_getWeight(
  const AFont *_Nonnull font
)
```
Return a weight value associated with the current font.

The weight values are positive and less than or equal to 1000. Here are pairs of the common names and their values.


|---|---|---|
| Value | Name | NDK Definition |
| 100 | Thin | [AFONT_WEIGHT_THIN](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8adee7247a912dce357709594879211656) |
| 200 | Extra Light (Ultra Light) | [AFONT_WEIGHT_EXTRA_LIGHT](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a8767ad4e65e2399c813d77af5804da7f) |
| 300 | Light | [AFONT_WEIGHT_LIGHT](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a11c51b026febe7f79c3e0f24394e37a8) |
| 400 | Normal (Regular) | [AFONT_WEIGHT_NORMAL](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8aded7f71bf4ef5d75563439c62c0ff2a8) |
| 500 | Medium | [AFONT_WEIGHT_MEDIUM](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8aae26106681af434529b619c7f6c32b23) |
| 600 | Semi Bold (Demi Bold) | [AFONT_WEIGHT_SEMI_BOLD](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a996586e575dc0015f9ec01b4633626f3) |
| 700 | Bold | [AFONT_WEIGHT_BOLD](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a35f66b7759b3c2a9575a45cebfda48f0) |
| 800 | Extra Bold (Ultra Bold) | [AFONT_WEIGHT_EXTRA_BOLD](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8a3ed2f7472c6e0854cb330e6d55896454) |
| 900 | Black (Heavy) | [AFONT_WEIGHT_BLACK](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8abe9fa04c0107998f3d6457376b365e41) |

<br />

Note that the weight value may fall in between above values, e.g. 250 weight.

For more information about font weight, read [OpenType usWeightClass](https://docs.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass)

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. **Returns** a positive integer less than or equal to [AFONT_WEIGHT_MAX](https://developer.android.com/ndk/reference/group/font#group___font_1ggaabfcbcb5ac86a1edac4035264bc7d2b8ad895619247b0e3919053a54894d1ef51) is returned.

### AFont_isItalic

Declared in `android/font.h`

```
bool AFont_isItalic(
  const AFont *_Nonnull font
)
```
Return true if the current font is italic, otherwise returns false.

Available since API level 29.

<br />

Details Parameters `font` a font object. Passing NULL is not allowed. **Returns** true if italic, otherwise false.

### ASystemFontIterator_close

Declared in `android/system_fonts.h`

```
void ASystemFontIterator_close(
  ASystemFontIterator *_Nullable iterator
)
```
Close an opened system font iterator, freeing any related resources.

Available since API level 29.

<br />

Details Parameters `iterator` a pointer of an iterator for the system fonts. Do nothing if NULL is passed.

### ASystemFontIterator_next

Declared in `android/system_fonts.h`

```
AFont *_Nullable ASystemFontIterator_next(
  ASystemFontIterator *_Nonnull iterator
)
```
Move to the next system font.

Available since API level 29.

<br />

Details Parameters `iterator` an iterator for the system fonts. Passing NULL is not allowed. **Returns** a font. If no more font is available, returns nullptr. You need to release the returned font with [AFont_close()](https://developer.android.com/ndk/reference/group/font#group___font_1ga3a8aa77f94dfc0f184e3aedff72c3baa) when it is no longer needed.

### ASystemFontIterator_open

Declared in `android/system_fonts.h`

```
ASystemFontIterator *_Nullable ASystemFontIterator_open()
```
Create a system font iterator.

Use [ASystemFontIterator_close()](https://developer.android.com/ndk/reference/group/font#group___font_1ga3b817f00ea4d3373663d3a31f4cca102) to close the iterator.

Available since API level 29.

<br />

| Details ||
|---|---|
| **Returns** | a pointer for a newly allocated iterator, nullptr on failure. |