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

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?

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)

2 Likes

@kerrishotts, any update regarding this topic?
Further, will API support access to system fonts folder in the near future?

We’ve decided to put this feature in the “future” column, which means the request will be addressed next year

1 Like

Is there any update on this? I started building a plugin for better font picking and want to do it the proper way i.e. if the API provides a list of installed fonts. For now there is the hacky way @kerrishotts mentioned and making the user select their ‘Fonts’ folder which I’m using for now.

2 Likes

Has this feature ever been added to the API?

@demianborba FYI ^^^ – I don’t think this ever happened, but might be worth adding an API here.

2 Likes