Looking further at this, if we decide to use
@font-face {
font-family: 'Exodar';
font-style: normal;
font-weight: 400;
src: url('https://domain.net/assets/customfonts/Exodar.eot');
src: local(''),
url('https://domain.net/assets/customfonts/Exodar.eot?#iefix') format('embedded-opentype'),
url('https://domain.net/assets/customfonts/Exodar.woff2') format('woff2'),
url('https://domain.net/assets/customfonts/Exodar.woff') format('woff'),
url('https://domain.net/assets/customfonts/Exodar.ttf') format('truetype'),
url('https://domain.net/assets/customfonts/Exodar.svg#Exodar') format('svg');
}
Then this will fail because of the CORS policy at the remote end - see below from the console log
xx.xx.xxx.xxx/:1 Access to font at 'https://domain.net/assets/customfonts/Exodar.woff2' from origin 'http://xx.xx.xxx.xxx:32775' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
domain.net/assets/customfonts/Exodar.woff2:1 GET https://domain.net/assets/customfonts/Exodar.woff2 net::ERR_FAILED
xx.xx.xxx.xxx/:1 Access to font at 'https://domain.net/assets/customfonts/Exodar.woff' from origin 'http://xx.xx.xxx.xxx:32775' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
domain.net/assets/customfonts/Exodar.woff:1 GET https://domain.net/assets/customfonts/Exodar.woff net::ERR_FAILED
xx.xx.xxx.xxx/:1 Access to font at 'https://domain.net/assets/customfonts/Exodar.ttf' from origin 'http://xx.xx.xxx.xxx:32775' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
domain.net/assets/customfonts/Exodar.ttf:1 GET https://domain.net/assets/customfonts/Exodar.ttf net::ERR_FAILED
To work around this
- Copy the font files to the local server (they need to be in the
assets
location for the server to be able to see them)
- Modify the CSS block so that it looks like the below
@font-face {
font-family: 'Exodar';
font-style: normal;
font-weight: 400;
src: url('/assets/customfonts/Exodar.eot');
src: local(''),
url('/assets/customfonts/Exodar.eot?#iefix') format('embedded-opentype'),
url('/assets/customfonts/Exodar.woff2') format('woff2'),
url('/assets/customfonts/Exodar.woff') format('woff'),
url('/assets/customfonts/Exodar.ttf') format('truetype'),
url('/assets/customfonts/Exodar.svg#Exodar') format('svg');
}
Then, you should be able to target any CSS class with
font-family: "Exodar";
Just be aware of the capital “e” / “E” when referring to the fonts as Linux is case sensitive, whereas Windows is not.