How do we add support for fonts in Frontity project?
For example, I have generated Icomoon font that has:
fonts folder → the actual font, ttf, eot, woff, svg
style.css → the css that is referencing these fonts
Now, where do I put my fonts and how to reference them so they load properly?
Usually, I add fonts to public/assets/fonts and then in the main css file I copy the content of styles.css that Icomoon generates and it works.
I am not sure what is the proper way to add them on Frontity project.
We have a demo here that uses the webfontloader library to load Google fonts, but you can also use it to load fonts from other sources including locally installed fonts. Take a look at the custom section of their docs.
Hi,
I have tried to load Adobe Fonts instead of Google fonts. But not getting it to work. Could you please add some more detailed information on how to load Adobe fonts or other font files included in the project files instead?
Thanks.
Create a fonts directory within your theme’s src folder: src/fonts .
Place your font files (TTF, EOT, WOFF, SVG) inside this directory.
Import Fonts in a Global Component:
Create a Global component within your theme’s src folder: src/Global.js .
Import the css function from frontity .
Use the @font-face rule to define your font families within the css function