janislejins Posted November 24, 2022 Share Posted November 24, 2022 Hi, We can't get our custom fonts to work beyond the local machine! We have tried everything incl preloading them as well as having the woff2/woff on the css and nothing seems to work. See the current approach below! anything you can do to help would be great. https://domainewolf.squarespace.com font-face{ font-family: 'Adelon Serial'; src: url(https://static1.squarespace.com/static/633312b161044b5abdf7c2ce/t/637fc52921a66323e56ff0b9/1669317929824/AdelonSerial.woff2) format('woff2'); } font-face{ font-family:'Material Symbols Outlined'; src: url(https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,100,0,200); } font-face { font-family: 'Panama'; src: url(https://static1.squarespace.com/static/633312b161044b5abdf7c2ce/t/633314edb2de5c788ee26bcc/1664292077908/panama-webfont.woff2) format('woff2'); } font-face { font-family: 'YoungBaroqueStd'; src: url(https://static1.squarespace.com/static/633312b161044b5abdf7c2ce/t/6333150ec7dd864453b78aab/1664292110803/YoungBaroqueStd.woff2) format('woff2'); } p{ font-family:'Panama'; } .cart-row-desc a{ font-family: 'Adelon Serial' !important; } .current-language{font-family:'Panama';} h1, h2, h3 { font-family: 'Adelon Serial' !important; } Link to comment
janislejins Posted November 26, 2022 Author Share Posted November 26, 2022 to anyone who needs help with something like this. We came up with a little hack which sorts it out. Inject in the header code: // A FUNCTION TO RELOAD ALL THE CSS... LABOUR INTENSIVE BUT HEY... function reloadCss() { var links = document.getElementsByTagName("link"); for (var cl in links) { var link = links[cl]; if (link.rel === "stylesheet") link.href += ""; } } var FONTABC = new FontFace('Font Face', 'url(https://static1.squarespace.com/static/your font URL)'); FONTABC.load().then(function(loaded_face) { document.fonts.add(loaded_face); // WHEN THE JS LOADS THE FONT RELOAD THE CSS. reloadCss(); console.log('Font Is In'); }).catch(function(error) { // error occurred console.log('a SOMETHING F***ked UP'); }); Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment