error 404 using a local google font on laravel - laravel

I'm working with laravel in a project and I downloaded a google font using the google-webfonts-helper app to use the font offline, but i'm getting this error in my browser:
GET http://127.0.0.1:8000/css/public/fonts/nunito-v14-latin-800.woff2 net::ERR_ABORTED 404 (Not Found)
this is the css call
<link href="{{asset('css/fonts.css')}}" rel="stylesheet">
and this is a part of fonts.css file (i didn't put all the code because it's basically the same just different font weights)
#font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 200;
src: url('public/fonts/nunito-v14-latin-200.eot');
/* IE9 Compat Modes */
src: local('Nunito ExtraLight'), local('Nunito-ExtraLight'), url('public/fonts/nunito-v14-latin-200.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('public/fonts/nunito-v14-latin-200.woff2') format('woff2'), /* Super Modern Browsers */
url('public/fonts/nunito-v14-latin-200.woff') format('woff'), /* Modern Browsers */
url('public/fonts/nunito-v14-latin-200.ttf') format('truetype'), /* Safari, Android, iOS */
url('public/fonts/nunito-v14-latin-200.svg#Nunito') format('svg');
/* Legacy iOS */
}
I pasted the fonts files in public/fonts, the browser actually recongizes the css file but I dont know what i'm doing wrong

in laravel the url function is rooted in the public folder. So if you paste your font file into public/font/file.ttf please use url('font/file.ttf') instead of url('public/font/file.tff'). Because it will point to the public/public/font/file.ttf file

Related

How to load custom fonts instantly next js and prevent FOUT

I have a next JS application and my custom fonts are in my public folder.
My task is to prevent FOUT (flash of unstyled text) on site load and so I have settled for using font-display:block;
#font-face {
font-family: 'Proxima Nova';
src: url('/fonts/ProximaNova-Regular.woff2') format('woff2'),
url('/fonts/ProximaNova-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display:block;
}
in document.tsx I am preloading the fonts in the Head component as such :
<link
rel="preload"
href="/fonts/ProximaNova-Bold.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>
in _app.tsx I am importing global styles as such import './styles.css';
When i check load time for my fonts in the nextwork tab, it is roughly 3 seconds (please refer to screenshot).
Any suggestions on making my font load faster?

Firefox completelly refuses font load due to EOT

I noticed Firefox refuses to load custom fonts on one of my web pages. I'm 90% sure it worked one month ago. Now I use Firefox 43.04 (Windows). The error in the console is:
downloadable font: rejected by sanitizer (font-family: "PT Serif" style:normal weight:bold stretch:normal src index:0) source: https://localhost:8443/project/fonts/2/pt-serif-v8-latin_latin-ext-700.eot
and the html text is rendered with a system font (Times New Roman) instead.
The relevant CSS is:
#font-face {
font-family: 'PT Serif';
font-style: normal;
font-weight: 700;
src: url('../fonts//pt-serif-v8-latin_latin-ext-700.eot'); /* IE9 Compat Modes */
src: local('PT Serif Bold'), local('PTSerif-Bold'),
url('../fonts//pt-serif-v8-latin_latin-ext-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts//pt-serif-v8-latin_latin-ext-700.woff') format('woff'), /* Modern Browsers */
url('../fonts//pt-serif-v8-latin_latin-ext-700.ttf') format('truetype'), /* Safari, Android, iOS */
}
If I remove both lines with eot, then it works correctly (web font is used).
The question is, why does it reject the entire font family when the problem is just with one format?
I need eot for IE (strange, caniuse claims IE supports WOFF since v9, but it does not seem to work with my IE11).
I downloaded the font files thru https://google-webfonts-helper.herokuapp.com/fonts
The CSS line (the one with "Safari, Android, iOS") ends with a comma instead of semicolon. (blush)
The correct (tested to work) version is:
#font-face {
font-family: 'PT Serif';
font-style: normal;
font-weight: 700;
src: url('../fonts//pt-serif-v8-latin_latin-ext-700.eot'); /* IE9 Compat Modes */
src: local('PT Serif Bold'), local('PTSerif-Bold'),
url('../fonts//pt-serif-v8-latin_latin-ext-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts//pt-serif-v8-latin_latin-ext-700.woff') format('woff'), /* Modern Browsers */
url('../fonts//pt-serif-v8-latin_latin-ext-700.ttf') format('truetype'); /* Safari, Android, iOS */
}

Buttons not showing correctly (Videojs font not working on subdomain)

I'm having problems with video.js. On the main domain everthings works fine. But on the www. subdomain the buttons are not showing correctly (It's just showing ).
It looks like the font doesn't work on the subdomain. Any ideas to fix this?
VideoJS uses a custom font, defined using the #font-face directive in video-js.css. The paths defined inside are relative. When FireFox goes to load the fonts, it uses the root URL of the CSS file and concatenates the font paths.
The custom fonts are thus being loaded from your main domain when viewing the subdomain. Doesn't sound like a problem, right? But Firefox does not allow cross-domain fonts without access control headers for security.
In other words, FireFox normally requires every custom font to be loaded from the domain of the page that's showing. If you're viewing www.example.com, your fonts have to come from www.example.com, not example.com.
You can either
Use the solution linked above to add the appropriate headers to your server (if you have control) to allow the "cross-domain" fonts (www.example.com is considered a different domain from example.com)
Load the VideoJS CSS file dynamically from whichever domain is active.
If you want to go the latter route, when the user's viewing www.example.com, load http://*www.*example.com/path/to/video-js/video-js.min.css. When viewing example.com, load http://example.com/path/to/video-js/video-js.min.css.
Note that Webkit doesn't care -- seems to just be a Firefox problem.
Apply this css and get output
#font-face {
font-family: 'VideoJS';
src: url('https://vjs.zencdn.net/f/1/vjs.eot');
src: url('https://vjs.zencdn.net/f/1/vjs.eot?#iefix') format('embedded-opentype'),
url('https://vjs.zencdn.net/f/1/vjs.woff') format('woff'),
url('https://vjs.zencdn.net/f/1/vjs.ttf') format('truetype');
}
.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before, .vjs-icon-pause:before {
content: "\f103";
font-family: 'VideoJS';
}
.video-js .vjs-mute-control .vjs-icon-placeholder:before, .vjs-icon-volume-high:before {
content: "\f107";
font-family: 'VideoJS';
}
.video-js .vjs-big-play-button .vjs-icon-placeholder:before, .video-js .vjs-play-control .vjs-icon-placeholder:before, .vjs-icon-play:before {
content: "\f101";
font-family: 'VideoJS';
}
.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before, .vjs-icon-picture-in-picture-enter:before {
content: "\f121";
font-family: 'VideoJS';
}
.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before, .vjs-icon-fullscreen-enter:before {
content: "\f108";
font-family: 'VideoJS';
}
This solution worked for me when the icons were rendering blank:
#font-face {
font-family: VideoJS;
src: url(data:application/font-woff;charset=utf-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BJTzriT95lipz+TN1fmAAAAeJxtkMl2wjAMRfOAhABlKm2h80C3+ajgCKKDY6cegP59TYBzukAL+z1Zsq8ctaJTTKPrsUQLbXQQI0EXKXroY4AbDDHCGBNMcYsZ7nCPB8yxwCOe8IwXvOIN7/jAJ76wxHfUqWX+OzgumWAjJMV17i0Ndlr6irLKO+qftdT7i6y4uFSUvCknay+lFYZIZaQcmfH/xIFdYn98bqhra1aKTM/6lWMnyaYirx1rFUQZFBkb2zJUtoXeJCeg0WnLtHeSFc3OtrnozNwqi0TkSpBMDB1nSde5oJXW23hTS2/T0LilglXX7dmFVxLnq5U0vYATHFk3zX3BOisoQHNDFDeZnqKDy9hRNawN7Vh727hFzcJ5c8TILrKZfH7tIPxAFP0BpLeJPA==) format("woff");
font-weight: normal;
font-style: normal;
}

Issues with #font-face

I am using the #font-face. I had to break it up into two section because firefox continued to use the first font and it showed up crappy. Actually it still displays blurry/pixelated in firefox. Any solutions for that? Anyways it all seems to work fine now, but I can't get any of the bold functions to work. Doesn't seem to matter where I add it in the code whether it is in the CSS or directly in the html it work make the font bolder. Is this normal?
#font-face {
font-family: TektonPro-BoldExt;
src:url('../fonts/TektonPro-BoldExt.eot') format('embedded-opentype'), /* For IE */
url('../fonts/TektonPro-BoldExt.eot?#iefix') format('embedded-opentype'), /* For fix-IE */
url('../fonts/TektonPro-BoldExt.woff') format('woff'), /* For new-IE */
url('../fonts/TektonPro-BoldExt.otf') format('opentype'), /* For non-IE */
url('../fonts/TektonPro-BoldExt.ttf') format('truetype'), /* For non-IE */
url('../fonts/TektonPro-BoldExt.svg') format('svg'); /* For non-IE */
font-weight: bolder;
font-style: normal;
}
#font-face {
font-family: TektonPro-BoldExt-FF;
src:url('../fonts/TektonPro-BoldExt.otf') format('opentype'); /* For Firefox */
font-weight: bolder;
font-style: normal;
}
Not all fonts have a bold spite that can render as bold. You can try adjusting the font-weight in increments of 100 to see if that makes any difference.
Regarding Firefox using the first font, do you mean it was caching another font you used before?

Font-Face not working in Firefox 18.0.1 (code and URL included)

Hello and thanks a ton for any help with my problem. Here are the facts:
The URL is www.thecloudz.net, regarding the navigation links at the very top, the font is called brooklyn. The font on the URL appears correctly in Safari and Chrome, but not in Firefox. I was told I may have a plugin installed that's interfering with font-face.
The font-face settings for the URL are below, 'rock salt' is the default font showing up in FF, but according to the code below it should first show brooklyn. Why is it working on every browser except Firefox? Please help if you can, thank you!
`/* CHANGES FONT FOR NAVIGATION */
#font-face {
font-family: brooklyn;
src: url('http://thecloudz.net/files/BROOKLYN.eot');
src: url('http://thecloudz.net/files/BROOKLYN.eot?#iefix') format('embedded- opentype'),
url('http://thecloudz.net/files/brooklyn.woff') format('woff'),
url('http://thecloudz.net/files/BROOKLYN.TTF') format('truetype');
}
#navigation ul li a {
font-family: brooklyn, 'rock salt', serif;
font-size: 1.3em;
padding-top: 7px;
height: 50px;
}`
Firefox enforces a same origin policy.
http://thecloudz.net/ and http://www.thecloudz.net/ are not the same.

Resources