> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# lynx: addFont() static method

APISummary
Used for dynamically adding fonts.

## Syntax

```ts
export interface FontFace {
  'font-family': string;
  'src': string;
}

addFont(fontFace: FontFace, callback?: () => void): void;
```

### Parameter

#### fontFace

The font to be added.

#### callback

The callback after adding the font.

## Example

```ts
lynx.addFont(
  {
    'font-family': 'CustomFont',
    src: 'url("xxx")',
  },
  () => {
    console.log('load font');
  },
);
```

## Compatibility

**Compatibility Table**

**Query:** `lynx-api.lynx.addFont`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/lynx/addFont.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| addFont | Yes (2.12) | Yes (3.4) | Yes (2.12) | Yes (3.5) | Yes (3.5) | No |

**`addFont`**

Used for dynamically adding fonts.

**Specifications:**

