#font-face works in Chrome, but not IE or Firefox - html

This is quite confusing to me. I am using font-squirrel to download a web kit to show a custom font. here is the link to font: http://www.fontsquirrel.com/fontfacedemo/League-Gothic
If you look at the homepage right now: http://www.simonsayswebsites.com/
the main text in the middle says "Custom Built Websites Designed To Get You More customers". It looks great in chrome, exactly as it should, but if you look at it in either firefox or IE, the custom font face does not work.
Here's the CSS generating the font-face:
#font-face {
font-family: 'LeagueGothicRegular';
src: url('http://simonsayswebsites.com/wp-content/themes/twentytenchild/League_Gothic-webfont.eot');
src: url('http://simonsayswebsites.com/wp-content/themes/twentytenchild/League_Gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('http://simonsayswebsites.com/wp-content/themes/twentytenchild/League_Gothic-webfont.woff') format('woff'),
url('http://simonsayswebsites.com/wp-content/themes/twentytenchild/League_Gothic-webfont.ttf') format('truetype'),
url('http://simonsayswebsites.com/wp-content/themes/twentytenchild/League_Gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
Anyone have any ideas? I looked at many cases on this all ready, but I don't see one that relates to my case as I thought I have included all the different necessary files for each browser and have them uploaded to their respected places.

Poking around I found this interesting tidbit for Firefox:
Same-origin rule: By default, Firefox will only accept relative links. If you want to use absolute links or include fonts from different domains, you need to send these fonts with Access Control Headers.
Try changing those font URLs to relative and see if that helps:
#font-face {
font-family: 'LeagueGothicRegular';
src: url('/wp-content/themes/twentytenchild/League_Gothic-webfont.eot');
src: url('/wp-content/themes/twentytenchild/League_Gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('/wp-content/themes/twentytenchild/League_Gothic-webfont.woff') format('woff'),
url('/wp-content/themes/twentytenchild/League_Gothic-webfont.ttf') format('truetype'),
url('/wp-content/themes/twentytenchild/League_Gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
edit: see Korpela's answer; the problem was the mismatch from the 'www' subdomain. You should probably keep the URLs relative, though.

The reason for the problem is (was) the use of a font across domains. A URL that starts “http://simonsayswebsites.com” is treated as being in a different domain than “http://www.simonsayswebsites.com” even though the two domain names may refer to the same computer.
Switching to a relative URL helped because then the domain is the same. But despite rumors to the contrary, Firefox does not reject absolute URLs in #font-face. I have set up a trivial demo to show this.
Presumably, the rumors have originated from cases like this: if switching to a relative URL helps, it is natural to assume that the type of URL was the issue.

I had your problem too and searched a lot about it but came up with nothing...
so i started experimenting on my CSS for some minutes and finally realized that i had duplicated font family names, I had been declaring below code in both my theme and layout page:
<style type="text/css" media="screen, print">
#font-face
{
font-family: 'foo';
src: url('~/Assets/fonts/foo.woff') format('woff'),
url('~/Assets/fonts/foo.ttf') format('truetype'),
url('~/Assets/fonts/foo.eot') format('eot');
}
</style>
I just needed to remove one of them and my code worked fine in all three browsers!
one more point is that just removing the line containing "font-family: 'foo';" parts will do the trick!

Related

Grails load CSS from custom URL

Using Grails version 2.4.4. and trying to load CSS resource from URL
http://myAppName.com:7777/myApp/assets/style.css
/myApp/assets/style.css
I've set in style.css:
#font-face {
font-family: 'icomoon';
src: url('../fonts/icomoon.eot?t0751g');
src: url('../fonts/icomoon.eot?t0751g#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf?t0751g') format('truetype'),
url('../fonts/icomoon.woff?t0751g') format('woff'),
url('../fonts/icomoon.svg?t0751g#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
Beside this, I added few other options for proper icon load.
Assets structure:
/assets/fonts/icomoon.ttf (and all other icomoon files are here)
/assets/stylesheets/style.css
when I use 2. url it loads my custom icons normally but when I set the 1. url in <style> as shown above, icon loading fails.
Both url-s should point to the same file and I don't understand why this is not working. Anyone knows what I am doing wrong ?
Any help will be appreciated!
So I found out that fonts does not support cross-origin domain, and I used icomoon icons as font to import it from another domain. On the other hand, i found out you can use Fontello which generates embedded JS and automatically fixes this issues, so it is generally better to use.

Why can't I get #font-face to work on custom fonts for wordpress?

I'm using wordpress and find it impossible to get my custom fonts to work on my site. I've looked through several threads with the same problem and none of the solutions worked or I applied them wrong. I use a free theme that I'm modifying as I go along. I'm editing the style.css sheet and can't figure out what I'm doing wrong. Some fonts work that can be found on my computer (and some don't, even if they can be found on my PC), so there seems to be something really weird going on. None of the #font-face things work on other devices.
I used font squirrel to make a set of webfonts and uploaded them to my server, under the theme in a separate font folder. The files should be accessible as the permissions are granted to user, group, world for read and execute. I also now tried using the font squirrel provided code added with complete addresses to implement the fonts. Nothing happens.
Now this is my first day into coding so it might be I'm not seeing what I'm doing wrong here. I inserted this new code after the HEADING-headline (I'm not sure if the positioning in the sheet makes a difference or is it just for the user for organizational purposes, but I've tried several) in the style file and this is a strip as is on the file:
.blog-title {
font-family: "daniel_blackregular";
font-size: 2.25em;
text-align: center;
}
#font-face {
font-family: 'daniel_blackregular';
src: url('/public_html/wp-content/themes/baskerville/Fonts/danielbk.eot');
src: url('/public_html/wp-content/themes/baskerville/Fonts/danielbk.eot?#iefix') format('embedded-opentype'),
url('/public_html/wp-content/themes/baskerville/Fonts/danielbk.woff2') format('woff2'),
url('/public_html/wp-content/themes/baskerville/Fonts/danielbk.woff') format('woff'),
url('danielbk.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Right now I'm thinking what if I'm addressing the font incorrectly, but I've tried everything there too. Please help.
To fix your issue you need to do a few things.
Move your #font-face to the top of your css file.
Update the url path in your #font-face call. Right now they are returning a 404 with the urls of:
#font-face {
font-family: 'daniel_blackregular';
src: url('/fonts/danielbk.eot');
src: url('/fonts/danielbk.eot?#iefix') format('embedded-opentype'),
url('/fonts/danielbk.woff2') format('woff2'),
url('/fonts/danielbk.woff') format('woff'),
url('/fonts/danielbk.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Remember the urls are relative to where the call is coming from. In this case it's gettning called from your css.
When I updated the paths in the css to: src: url('/public_html/wp-content/themes/baskerville/Fonts/danielbk.eot'); the font worked.

Loading web fonts in firefox

I'm recreating an website. That old website uses two different webfont I'd like to take over to the new one.
The first font is one of googles web fonts. It is embedded using googles following suggested code (just a CSS file containing the actual usage):
<link href="//fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type="text/css">
This works on both the old and the new website!
The other font however is causing problems in firefox on the new website, but displaying perfectly fine on the old one. It's embedded using the exact same code, except that I'm using absolute paths on the new website:
#font-face {
font-family: 'bebasneue-webfont';
src: url('http://example.com/fonts/BebasNeue-webfont.eot');
src: url('http://example.com/fonts/BebasNeue-webfont.eot?#iefix') format('embedded-opentype'),
url('http://example.com/fonts/BebasNeue-webfont.woff') format('woff'),
url('http://example.com/fonts/BebasNeue-webfont.ttf') format('truetype'),
url('http://example.com/fonts/BebasNeue-webfont.svg#bebas_neueregular') format('svg');
font-weight: normal;
font-style: normal;
}
Why is the google font displayed correctly while the other one just won't load?

Fonts not showing up #font-face 000webhost

I have set up a website. I was hosting it on webs.com, but they started to place an ad bar on html-only hosting. As it would not look good, I changed it to 000webhost. Since I uploaded everything to 000webhost, I can't make the fonts to load.
webs:
http://bluescreen-ofdeath.webs.com/
000webhost:
http://bsod.comze.com/
I have tried pointing the ttf fonts from my webs account, but it won't load.
As the 000webhost take a day to answer free accounts, I decided to ask you. Is there anything I am missing?
Edit: Here is an example of my #Font-face
#font-face {
font-family: 'fixedsys500c-webfont';
src: url('../font/fixedsys500c-webfont.eot');
src: url('../font/fixedsys500c-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/fixedsys500c-webfont.woff') format('woff'),
url('../font/fixedsys500c-webfont.ttf') format('truetype'),
url('../font/fixedsys500c-webfont.svg#fixedsys500c-webfont') format('svg');
font-weight: normal;
font-style: normal;
}
The font(s) have to be imported before the stylesheet, as Google Web Fonts dictate.
Instructions: To embed your Collection into your web page, copy the
code as the first element in the <head> of your HTML document.
Don't use single quotes. Your fonts will work nicely. It's so easy, look below:
#font-face {
font-family:Arial;
src:url(Arial.ttf)format(.ttf);
}
remind it, internet explorer only works with EOT font files.
As far as I can tell, 000webhost only accepts .woff files.
.ttf and .eot do not work for me

#font-face, firefox and wordpress

I've built a custom wordpress theme that uses font-face for typography. All works fine when running in localhost, but after uploading the theme to a live site, font-face fails in FF. Still works fine in IE9
I've tried hardcoding the CSS link in header.php, moving the font files out of the theme to the site root, using a separate stylesheet for the #font-face declaration, but nothing wants to work.
Any ideas?
Cheers
Nathan
Did you include all the font files necessary? Different browsers support different types. For example, here's one I used on a site recently:
font-face {
font-family: 'GentiumBookBasicRegular';
src: url('_/fonts/GenBkBasR-webfont.eot');
src: url('_/fonts/GenBkBasR-webfont.eot?#iefix') format('embedded-opentype'),
url('_/fonts/GenBkBasR-webfont.woff') format('woff'),
url('_/fonts/GenBkBasR-webfont.ttf') format('truetype'),
url('_/fonts/GenBkBasR-webfont.svg#GentiumBookBasicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
A fantastic resource for this is http://fontsquirrel.com - they'll even let you upload fonts that they don't have and they'll create the package and the css for you.