GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

FontData: family property

Local Font Access API

Local Font Access API

The **`family`** read-only property of the FontData interface returns the family of the font face.

This is the name used when referring to the font family from code, for example, in the font-family property or in places within the @font-face at-rule such as the `local()` function.

Examples include:

- Apple SD Gothic Neo
- Arial Black
- Avenir Next
- Katari
- YuMincho +36p Kana

## Value

A string.

## Examples

The following snippet will query for all available fonts, and log metadata. This could be used, for example, to populate a font-picker control.

```js
async function logFontData() {
try {
const availableFonts = await window.queryLocalFonts();
for (const fontData of availableFonts) {
console.log(fontData.postscriptName);
console.log(fontData.fullName);
console.log(fontData.family);
console.log(fontData.style);
}
} catch (err) {
console.error(err.name, err.message);
}
}
```

## Specifications

## Browser compatibility

## See also

- [Use advanced typography with local fonts](https://developer.chrome.com/docs/capabilities/web-apis/local-fonts)
- @font-face

source: MDN Web Docs mirror · page

Cite this

"FontData: family property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/FontData/family

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·