API to list which fonts are available / detect if text has missing font

#1

Fonts are notoriously tricky.
Being able to add character styles in the assets is very cool but…

I’ve deliberately added a missing font and this is what I got in the assets panel:

missing-font

The new style has been correctly added and, obviously, it shows the warning icon.
So, XD knows that the font is not installed.
Is there a way to retrieve such information to be sure that fonts are available before adding them?

0 Likes

#2

This is something we will be adding to the API surface in the future, but currently there’s no way to know if the font is or isn’t available.

… unless you get in to some really hacky text measurement stuff…, which funnily enough is how you’d do it with JavaScript in a browser, too. (Excluding fallbacks)

1 Like