I'm developing a web app that requires a certain type of font used by my company. Since I'm using Google Apps Script, I uploaded the font files to a google drive folder. But it's not working. In the script, the https://drive.google.com/file/d/XXX is the shareable link. I tried to use https://drive.google.com/uc?export=view&id= but it didn't work too.
I'll be very grateful if anyone can help. Thanks!
@font-face {
font-family: 'specials';
src: url('https://drive.google.com/file/d/XXX/specials.eot');
src: url('https://drive.google.com/file/d/XXX/specials.eot') format("embedded-opentype"),
url("https://drive.google.com/file/d/XXX/specials.otf") format("opentype"),
url('https://drive.google.com/file/d/XXX/specials.woff') format("woff"),
url('https://drive.google.com/file/d/XXX/specials.woff2') format("woff2"),
url('https://drive.google.com/file/d/XXX/specials.ttf') format("truetype"),
url('https://drive.google.com/file/d/XXX/specials.svg') format("svg");
font-weight: normal;
font-style: normal;
}
h1{
font-family: 'specials', Georgia,'Times New Roman', Times, serif;
}
Update
It is as @Tanaike suggested, the right way to do it is to use this link https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key### for all the different formats of the font files. It appeared to not be working at first because I missed out two.
Here's the corrected CSS:
@font-face {
font-family: 'specials';
src: url('https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###');
src: url('https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###') format("embedded-opentype"),
url("https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###") format("opentype"),
url('https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###') format("woff"),
url('https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###') format("woff2"),
url('https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###') format("truetype"),
url('https://www.googleapis.com/drive/v3/files/###fileId###?alt=media&key=###your API key###') format("svg");
font-weight: normal;
font-style: normal;
}