Home › Forums › Trusted › No more Google Fonts to make theme faster and more DSGVO-compatible › Reply To: No more Google Fonts to make theme faster and more DSGVO-compatible
September 9, 2018 at 10:10 am
#5665
Andy
Keymaster
To load your own font that is located on your website, you would load the font in the child theme’s style.css.
This is an example using the Roboto font from Google (Google fonts can also be downloaded for offline or ‘local’ usage)
@font-face {
font-family: 'Roboto';
src: url('../fonts/roboto.eot');
src: url('../fonts/roboto.woff2') format('woff2'), url('../fonts/roboto.woff') format('woff'), url('../fonts/roboto.ttf') format('truetype');
}
In the example above, we’ll assume the font comes in 4 different file formats (.eot, .woff2, .woff and .ttf) and you have uploaded the font files to a folder named ‘fonts’ on your website.
Next you need to specify which elements are to use this font. Again in the style.css an example would be something like this:
body,
button,
input,
select,
textarea {
font-family: 'Roboto';
}
or this:
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Roboto';
}