---
title: "FontFaceManager | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class FontFaceManager

Keeps the font files a style declares in its [`font-faces`](https://maplibre.org/maplibre-style-spec/root/#font-faces) property, and hands the [GlyphManager](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.GlyphManager/) the CSS family to draw a given codepoint with.

The files go to the browser's CSS Font Loading API, so any format it can render text with works. Each is registered under a family name of our own making, so that a style cannot restyle the surrounding page and a codepoint can be pinned to one file rather than to whatever font matching picks.

Rasterizing happens a grapheme cluster at a time, so a letter reaches the browser's text engine with its marks. Shaping across cluster boundaries still needs the RTL text plugin.

##### Index

### Constructors

[constructor](#constructor)

### Properties

[requestManager](#requestmanager)

### Methods

[destroy](#destroy) [getFontFamily](#getfontfamily) [hasFontFaces](#hasfontfaces) [setFontFaces](#setfontfaces)

## Constructors

### constructor[](#constructor)

-   new FontFaceManager(requestManager: [RequestManager](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.RequestManager/)): FontFaceManager[](#constructorfontfacemanager)
    
    #### Parameters
    
    -   requestManager: [RequestManager](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.RequestManager/)
    
    #### Returns FontFaceManager
    

## Properties

### requestManager[](#requestmanager)

requestManager: [RequestManager](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.RequestManager/)

## Methods

### destroy[](#destroy)

-   destroy(): void[](#destroy-1)
    
    #### Returns void
    

### getFontFamily[](#getfontfamily)

-   getFontFamily(fontStack: string, codePoint: number): Promise<string | null\>[](#getfontfamily-1)
    
    Finds the font file to draw a codepoint with: each name of the `text-font` stack in turn, and within a name each declared file, until one covers it. A file that fails to load is skipped, the specification asking for unsupported fonts to be ignored.
    
    #### Parameters
    
    -   fontStack: string
    -   codePoint: number
    
    #### Returns Promise<string | null\>
    
    the CSS family to draw with, or `null` to leave the codepoint to the `glyphs` URL
    

### hasFontFaces[](#hasfontfaces)

-   hasFontFaces(): boolean[](#hasfontfaces-1)
    
    Whether the style declared any font face at all, so that the common case of a style without `font-faces` costs nothing.
    
    #### Returns boolean
    

### setFontFaces[](#setfontfaces)

-   setFontFaces(fontFaces?: [FontFacesSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/FontFacesSpecification/) | null): void[](#setfontfaces-1)
    
    Replaces the declared font faces. Nothing is downloaded here: each file waits until a codepoint it covers is actually drawn.
    
    #### Parameters
    
    -   `Optional`fontFaces: [FontFacesSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/FontFacesSpecification/) | null
    
    #### Returns void
