KyleAMathews / typography.js

A powerful toolkit for building websites with beautiful design
http://kyleamathews.github.io/typography.js/
MIT License
3.82k stars 181 forks source link

Fonts only seem to work if I have them installed locally #273

Closed adbarnes closed 3 years ago

adbarnes commented 3 years ago

Hi,

I have been trying to customise typography.js in a gatsby site.

const typography = new Typography({
  baseFontSize: "18px",
  baseLineHeight: 1.666,
  headerFontFamily: [
    "Open Sans",
    "Avenir Next",
    "Helvetica Neue",
    "Segoe UI",
    "Helvetica",
    "Arial",
    "sans-serif",
  ],
  bodyFontFamily: ['roboto', 'sans-serif'],
})

export default typography

I've been trying to change the bodyFontFamily to Nunito but Chrome always seems to fall-back to Arial. I have tested other fonts that I have installed locally such as open sans and roboto and it works. I don't have Nunito installed locally and it doesn't work.

Is this the correct behaviour as I assumed it was pulling the fonts from Google Web fonts?

I should say that this is in local dev, not live.

Thanks

adbarnes commented 3 years ago

managed to fix by adding googleFonts array as explained in the API config docs.