#font face only displaying in demo html - css

Ok so I downloaded a #font-face kit from fontsquirell, it works fine in the demo html file included in the download, but fails to render when I put it in any other file or sub folder.
I have checked the file structure and linked accordingly, i am still having this problem. Any suggestions on what I should do?
#font-face {
font-family: 'BreeSerifRegular';
src: url('..assets/fonts/BreeSerif-Regular-webfont.eot');
src: local("☺")
url('..assets/fonts/BreeSerif-Regular-webfont.eot?#iefix') format('embedded- opentype'),
url('..assets/fonts/BreeSerif-Regular-webfont.woff') format('woff'),
url('..assets/fonts/BreeSerif-Regular-webfont.ttf') format('truetype'),
url('..assets/fonts/BreeSerif-Regular-webfont.svg#BreeSerifRegular') format('svg');
font-weight: normal;
font-style: normal;
}
The same format works for other fonts, dunno why its not working for this.

Its the basic problem with paths
Copy the fonts you receive and into a folder at the root lets say a font.
Then point your css to read the file in a relative pattern like
#font-face {
font-family: 'BreeSerifRegular';
src: url('fonts/BreeSerif-Regular-webfont.eot');
src: local("☺")
url('fonts/BreeSerif-Regular-webfont.eot?#iefix') format('embedded- opentype'),
url('fonts/BreeSerif-Regular-webfont.woff') format('woff'),
url('fonts/BreeSerif-Regular-webfont.ttf') format('truetype'),
url('fonts/BreeSerif-Regular-webfont.svg#BreeSerifRegular') format('svg');
font-weight: normal;
font-style: normal;
}
UPDATE
The way you are defining relative path is wrong
Change ..assets to ../assets

Related

Can't get the Bebas Neue Custom Font to work

I'm trying to get the Bebas Neue font to work, I've managed to convert my fonts into their respective types but whenever I load the font in the browser I get errors.
Firebug throws:
downloadable font: download failed
Chrome throws a 404 not found.
I initially had these in their own font folder, but I then decided to move the fonts to the same directory as the stylesheet I was using to try and rule out location problems.
This particular file is a SASS partial called _typography that lives in a folder called global this is the same folder I've directly placed all the fonts into as is.
#font-face {
font-family: 'BebasNeueRegular';
src: url(BebasNeueRegular.eot);
src: url(BebasNeueRegular.eot?#iefix) format('embedded-opentype'),
url(BebasNeueRegular.woff) format('woff'),
url(BebasNeueRegular.ttf) format('truetype'),
url(BebasNeueRegular.svg) format('svg');
font-weight: normal;
font-style: normal;
}
With a 404 Error - it's 98% going to be because of the path being wrong.
Just a thought - you mentioned that you moved them into a SASS partial? Can this folder be accessed from the site? From my experience, your SASS is going to compile into some sort of public directory.
In order to troubleshoot... theoretically, you should just be able to add www.yourdomaincom/path-to-font/font.eot and come up with a download file.
If you're not, then it really is an issue of the path being where the error lies. As far as why other fonts are working, I wouldn't be able to say without taking a better look at how you have your project set up.
Just my two cents worth to help you troubleshoot!
Make sure your #font-face matches your font-family use on CSS, either:
font-family: 'Bebas Neue'; on everything or:
font-family: 'BebasNeueRegular'; on everything.
Like:
#font-face {
font-family: 'BebasNeueRegular';
src: url(BebasNeueRegular.eot);
src: url(BebasNeueRegular.eot?#iefix) format('embedded-opentype'),
url(BebasNeueRegular.woff) format('woff'),
url(BebasNeueRegular.ttf) format('truetype'),
url(BebasNeueRegular.svg) format('svg');
font-weight: normal;
font-style: normal;
}
Matches css use:
.selector {
font-family: 'BebasNeueRegular', sans-serif;
}
Or:
#font-face {
font-family: 'Bebas Neue';
src: url(BebasNeueRegular.eot);
src: url(BebasNeueRegular.eot?#iefix) format('embedded-opentype'),
url(BebasNeueRegular.woff) format('woff'),
url(BebasNeueRegular.ttf) format('truetype'),
url(BebasNeueRegular.svg) format('svg');
font-weight: normal;
font-style: normal;
}
Matches:
.selector {
font-family: 'Bebas Neue', sans-serif;
}

Css relative url images not appearing

I have a problem with my icons "not showing up" on a web page, These icons are stored in the fonts folder respectively.
Below contains the snippet of my styles.css
styles.css
#font-face {
font-family: 'FontAwesome';
src: url('../../fonts/fontawesome-webfont.eot?v=4.1.0');
src: url('../../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'), url('../../fonts/fontawesome-webfont.woff?v=4.1.0') format('woff'), url('../../fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype'), url('../../fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
My file structure
How do I reference my files to ensure that my icons show up properly?
According to the example here, http://css-tricks.com/quick-reminder-about-file-paths/
I use "../../" as this will go to resources/fonts.
Am I wrong?
Any help please?
Thanks!
each ../ is used to go up one directory. You are currently in the css/ directory.
If you want to get to resources/fonts, you only need one ../ to get to resources, then you can enter fonts/
Your CSS should be:
#font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.1.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.1.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}

CSS: Font is not displayed correctly in Firefox

I integrated a font into my web project. Here comes the CSS code:
#font-face {
font-family: 'vladimirscriptefregular';
src: url('fonts/vladimirscriptef-webfont.eot');
src: url('fonts/vladimirscriptef-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/vladimirscriptef-webfont.woff') format('woff'),
url('fonts/vladimirscriptef-webfont.ttf') format('truetype'),
url('fonts/vladimirscriptef-webfont.svg#vladimirscriptefregular') format('svg');
font-weight: normal;
font-style: normal;
}
My problem is that the font is not displayed in Firefox - instead, Times New Roman is displayed. In all other browsers the font is displayed correctly.
Does anyone see what's missing in my code?
Try the code below:
#font-face {
font-family: 'vladimirscriptefregular';
-moz-font-family:'vladimirscriptefregular';
src: url('fonts/vladimirscriptef-webfont.eot');
src: url('fonts/vladimirscriptef-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/vladimirscriptef-webfont.woff') format('woff'),
url('fonts/vladimirscriptef-webfont.ttf') format('truetype'),
url('fonts/vladimirscriptef-webfont.svg#vladimirscriptefregular') format('svg');
font-weight: normal;
-moz-font-weight:normal
font-style: normal;
-moz-font-style:normal
}
Firefox has a list of fonts which can be used in its whitelist.
It can be accessed by typing "about:config" in the address bar.
Then search for "font.system.whitelist".
Here add your font name which must be present in the Font folder.
For windows the default location is "C:\Windows\Fonts"

Custom font is not working in Firefox.

I have searched for its solution, and I think, I'm doing everything like the suggestions, but it is still not working. Custom font works on Chrome, IE, but not in Firefox. I have used font face generator to generate fonts and the code. I have placed the #font-face code in header, custom.css file (in theme_root/css/) and also in style.css, but it is not working.
Placed this in header.php:
<style>
#font-face {
font-family: 'Bebas Neue';
src: url('fonts/bebasneue.eot');
src: url('fonts/bebasneue.eot?#iefix') format('embedded-opentype'),
url('fonts/bebasneue.svg#Bebas Neue') format('svg'),
url('fonts/bebasneue.woff') format('woff'),
url('fonts/bebasneue.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
</style>
Placed this in style.css:
#font-face {
font-family: 'Bebas Neue';
src: url('fonts/bebasneue.eot');
src: url('fonts/bebasneue.eot?#iefix') format('embedded-opentype'),
url('fonts/bebasneue.svg#Bebas Neue') format('svg'),
url('fonts/bebasneue.woff') format('woff'),
url('fonts/bebasneue.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Placed this in custom.css:
#font-face {
font-family: 'Bebas Neue';
src: url('../fonts/bebasneue.eot');
src: url('../fonts/bebasneue.eot?#iefix') format('embedded-opentype'),
url('../fonts/bebasneue.svg#Bebas Neue') format('svg'),
url('../fonts/bebasneue.woff') format('woff'),
url('../fonts/bebasneue.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Working everywhere, except Firefox. I'm confused
http://tour.khujbo.com
Also, this font works in html pages in Firefox fine. I have used this font in this template and it works on Firefox: http://khujbo.com. Seems to me, that the problem with Firefox and WordPress combination.
What should I do?
I don't think you need to define this font-face everywhere. You can place the CSS only in custom.css. And, you have defined the "Bebas Neue" font-face in your header.php with wrong URL. CSS is trying to get the font (woff, ttf, etc) from http://tour.khujbo.com/fonts/. Please correct your CSS with the right location.
BTW, my suggestion would be, you just place and load the CSS only from custom.css and remove all other definitions.
Hope this will solve your problem.
you must always be sure that the font is legal to use on your site.
However Firefox and Chrome should both support TTF.
get more info from here.
be sure u converted font to all format try this site to do http://everythingfonts.com/font-face and the path should be right !
#font-face {
font-family: 'GE SS Unique';
src: url('../../fonts/GE_SS_Unique_Light.eot');
src: url('../../fonts/GE_SS_Unique_Light.eot?#iefix') format('embedded-opentype'),
url('../../fonts/GE_SS_Unique_Light.woff') format('woff'),
url('../../fonts/GE_SS_Unique_Light.ttf') format('truetype'),
url('../../fonts/GE_SS_Unique_Light.svg#GE_SS_Unique_Light') format('svg');
font-weight: normal;
font-style: normal;}
h1,h2,h3,h4,h5,h6{
font-family: 'GE SS Unique';
}

Can't wrap my head around accessing fonts on server (getting 404 errors in console)

So I downloaded a new font called "Alef". It's in hebrew, but that's irrelevant as I'm unable to activate it. I'm pretty sure I'm doing something really stupid but I've been trying for hours to apply it but with no avail.
What I got:
8 files:
4 x normal eot, svg, ttf, woff
4 x bold eot, svg, ttf, woff
And a stylsheet file called stylesheet.css, which now contains the following code:
#font-face {
font-family: 'Alef';
src: url("/wp-content/themes/duet/Alef-bold.eot");
src: url("/wp-content/themes/duet/Alef-bold.eot?#iefix") format('embedded-opentype'),
url("/wp-content/themes/duet/Alef-bold.woff") format('woff'),
url("/wp-content/themes/duet/Alef-bold.ttf") format('truetype'),
url("/wp-content/themes/duet/Alef-bold.svg#alefbold") format('svg');
font-weight: bold;
font-style: normal;
}
#font-face {
font-family: 'Alef';
src: url("/wp-content/themes/duet/Alef-regular.eot");
src: url("/wp-content/themes/duet/Alef-regular.eot?#iefix") format('embedded-opentype'),
url("/wp-content/themes/duet/Alef-regular.woff") format('woff'),
url("/wp-content/themes/duet/Alef-regular.ttf") format('truetype'),
url("/wp-content/themes/duet/Alef-regular.svg#alefregular") format('svg');
font-weight: normal;
font-style: normal;
I have uploaded all files to my theme directory: /wp-content/themes/duet/
My main CSS file is called style.css, which is also in the same directory, I added this code to the file:
#font-face{
font-family: 'Alef';
src: url('Alef.eot');
src: url('Alef.eot?#iefix')
format('embedded-opentype'),
url('Alef.woff') format('woff'),
url('Alef.ttf') format('truetype'),
url('Alef.svg#webfont') format('svg');
}
Then what I did, was add this line to my header.php:
<link rel="stylesheet" href="/wp-content/themes/duet/stylesheet.css" type="text/css" charset="utf-8" />
And of course I set my p {font-family: Alef;)
What am I doing wrong? I'm getting 404 errors for the files in Chrome's console. It shows the CORRECT URL in the right side of the error console though.
I use this tool almost obsessively. Saves me the time of working out bugs just like this one.
http://www.fontsquirrel.com/tools/webfont-generator
Best tool ever.
Two main issues:
You are referencing 12 different files but you only have 8 (Alef.eot,
etc.; Alef-regular.eot, etc.; Alef-bold.eot, etc.)
I think your 2 'src' statements per declaration is messing things up. Should only be one with url's separated by commas.
Here is what I would do:
Remove the font-face declaration in style.css. Move the font-face declarations out of stylesheet.css and into style.css.
Only use one 'src' declaration with all url's separated by commas.
Here is the code I would use: (your file paths substituted):
`#font-face {
font-family: 'Alef';
src: url('/wp-content/themes/duet/Alef-regular.eot?#iefix') format('embedded-opentype'),
url('/wp-content/themes/duet/Alef-regular.woff') format('woff'),
url('/wp-content/themes/duet/Alef-regular.ttf') format('truetype'),
url('/wp-content/themes/duet/Alef-regular.svg#Alef') format('svg');
font-weight: normal;
font-style: normal;
}
ADDITION: Of course, here is bold version...
`#font-face {
font-family: 'Alef';
src: url('/wp-content/themes/duet/Alef-bold.eot?#iefix') format('embedded-opentype'),
url('/wp-content/themes/duet/Alef-bold.woff') format('woff'),
url('/wp-content/themes/duet/Alef-bold.ttf') format('truetype'),
url('/wp-content/themes/duet/Alef-bold.svg#Alef') format('svg');
font-weight: bold;
font-style: normal;
}

Resources