Manage font files
Learn how to add font files to your Specify repositories once you've synced text styles.
Last updated
Learn how to add font files to your Specify repositories once you've synced text styles.
Last updated
Sources like Figma and Tokens Studio manages textStyle
and font
token types as parameters applied to the fonts available on the host machine.
For both technical and legal reasons, Specify cannot extract font files from those sources, even though the SDTF is able to manage font files natively.
To bridge that gap, we'll share with you some techniques you can leverage to keep your font files in sync with your font and text styles tokens.
Before we start you need:
A Specify account with a repository
One or more font files in the following formats: ttf
, woff
, woff2
, otf
, eot
.
You are free to host your font files anywhere you can grab a public link to give Specify the ability to fetch the binaries.
We recommend using a company cloud storage like Amazon S3.
To register your font files to Specify, you need to create a SDTF JSON file containing your font tokens with the URLs from your cloud provider.
Note that you want to make the family
property to match the font family used by your TextStyle or Font tokens.
To let Specify synchronize the font tokens into your repository, the SDTF JSON file must be hosted either privately or publicly.
Create a new public or private repository on github.com.
Add your SDTF JSON file containing the font tokens
Grab the raw file URL by accessing the raw file over your browser
Create a new private or public bin on https://jsonbin.io.
Place the content of your SDTF JSON file within it
Grab the URL
You can now navigate to your Specify repository and head to "Sources" -> "Create source"
Select the "Remote URL - Tokens Studio"
Provide the URL to the font tokens file you created at step 3.
(Optional) Provide authentication credentials for your provider. Read more about managing URL providers authentication.
Select the "Specify Design Tokens Format" option
Create the source. The sync is executed on the source creation and should take few seconds.
Once your new font tokens are synced into your Specify repository, you can start pulling the font-files to your codebase.
Let's have a look to one of the parser rule that can be used into any configuration file:
Once executed, the font files are available within the ./public/fonts
directory.