Custom Font doesn't work

Hi, I have a problem with a custom font, Bad Signal. I changed its extention from .otf to .woff and woff2 using this website https://transfonter.org/ . I imported the new fonts in all html pages and in the css file and I uploaded the font files along with everything else in the File Manager folder from CPanel. I can't see the custom font when I visit the website from my phone. I only see it when I visit the site from my laptop. Here is my code and thank you very much for your help: HTML links <link rel="stylesheet" href="styles.css"> <link rel="preload" href="BadSignal.woff2" as="font" type="font/woff2" crossorigin> <link rel="preload" href="BadSignal.woff" as="font" type="font/woff" crossorigin> CSS code @font-face { font-family: 'Bad Signal'; src: url('BadSignal.woff2') format('woff2'), url('BadSignal.woff') format('woff'); font-weight: normal; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bad Signal'; src: url('BadSignal.woff2') format('woff2'), url('BadSignal.woff') format('woff'); font-weight: normal; font-style: normal; font-display: swap; } :root { /* FONTS */ --FF: "Nunito", sans-serif; --FF-HEADINGS: "Bad Signal","Jersey", sans-serif; --FS: clamp(1.5rem, 2.5vh, 2rem); --FS-XL: 6rem; --FS-600: 1.5rem; --FS-500: 1.25rem; --FS-400: clamp(0.8rem, 1.5vh, 1.125rem); }
17 Replies
b1mind
b1mind5w ago
If I had to guess, you have the wrong file path(url). Reason you see it on PC it's you have it installed locally.
Viviana
Viviana5w ago
Can you please tell me where I should look for the correct url? I copied it from the font file. Thank you for your response
b1mind
b1mind5w ago
Viviana
Viviana5w ago
Thank you The font is in the same folder as the files, I uploaded the files again and it still won't work. Please give me more suggestions
MarkBoots
MarkBoots5w ago
can you see the font being loaded in the devtools network tab?
Viviana
Viviana5w ago
menu.html:1 The resource file:///D:/clatite/second_repo-main/second_repo-main/clatite/BadSignal.woff2 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally. This is what I see in devtools Thank you so much for your help I don't understand where I should write the as value
MarkBoots
MarkBoots5w ago
just to test, can you comment out the preload (css @font should be enough)
Viviana
Viviana5w ago
.h1, .menu__h1 { font-family: 'Bad Signal'; font-weight: normal; font-style: normal; }
@font-face { font-family: 'Bad Signal'; src: url('BadSignal.woff2') format('woff2'), url('BadSignal.woff') format('woff'); font-weight: normal; font-style: normal; font-display: swap; } <link rel="preload" href="BadSignal.woff2" as="font" type="font/woff2" crossorigin>
MarkBoots
MarkBoots5w ago
i mean, remove the preloading from the html, and see what happens
Viviana
Viviana5w ago
ok, I try this now Failed to decode downloaded font: file:///D:/clatite/second_repo-main/second_repo-main/clatite/BadSignal.woff ; now I get this error
MarkBoots
MarkBoots5w ago
Create Your Own @font-face Kits » Font Squirrel
Create Your Own @font-face Kits by uploading the fonts you want to use.
Viviana
Viviana5w ago
I tried it and it didn't work, I guess I'll give it another try, thanks a lot
Lamer of Sweden
I am a bit confused. Why using both <link> and @font-face to load the fonts?
Viviana
Viviana5w ago
it didn't work with @font-face so I put the link as well
stillmorris
stillmorris5w ago
Hi mate. You can also try with another font or maybe you've missed the font-family asignment to body/html tag? Do you only have that css defined? @Viviana I've tried the Ubuntu font example btw from here: https://transfonter.org/examples and it works even in local environment without a node/apache server.
Viviana
Viviana5w ago
I have a google font that works, but the customer wants that specific one because it resembles his logo. I'm glad the code is correct so I think the problem is I imported the font twice and I fix the problem now. Thank you for your help
stillmorris
stillmorris5w ago
👏 👏
Want results from more Discord servers?
Add your server
More Posts