user2084666
user2084666

Reputation: 831

CSS: @font-face import not working

I don't understand how to get this to work, any help would be appreciated;

I'm going off of what I got from this website: http://alistapart.com/article/cssatten

from my style.css

@font-face {
 font-family: "JSL";
 src: url(http://ff.static.1001fonts.net/j/s/jsl-ancient.normal.ttf) format("truetype");
}

font {
 color: #000000;
 font-size: 120%;
 font-family: "JSL";
}

Upvotes: 5

Views: 14669

Answers (5)

Monica Lent
Monica Lent

Reputation: 261

Neither is the plus sign the issue (tested with my renamed fonts), nor do you have to import a separate css file at the top of your main css file.

However, you may need to have more versions of your font than just the true type. Have a look at Bulletproof @font-face Syntax.

You may use FontSquirrel’s generator to achieve this.

Here is an example of a @font-face embed in my application, which is pinned right at the top of my main css stylesheet.

@font-face {
    font-family: 'JustVector';
    src: url('../fonts/justvectorv2+webfont.eot');
    src: url('../fonts/justvectorv2+webfont.eot?') format('eot'),
        url('../fonts/justvectorv2+webfont.woff') format('woff'),
        url('../fonts/justvectorv2+webfont.ttf') format('truetype'),
        url('../fonts/justvectorv2+webfont.svg#webfontkw9J4lGf') format('svg');
    font-weight: normal;
    font-style: normal;
}

Upvotes: 7

Maciej Ogonowski
Maciej Ogonowski

Reputation: 71

Depending on the Font you may need to use:

@font-face {
font-family: 'someFont';
src: url('path/to/font/someFont.eot');
src: url('path/to/font/someFont.eot?#iefix'), format('embedded-opentype'), 
     url('path/to/font/someFont.woff'), format('woff'), 
     url('path/to/font/someFont.ttf'), format('truetype'), 
     url('path/to/font/someFont.svg'), format('svg');
font-weight: normal;
font-style: normal;
}

and in CSS:

BODY 
{
    font-family: 'someFont', Fallback, sans-serif;
    font-size: 12px;
    ... 
}

This worked for me when I had issues wityh embedding a custom font.

Upvotes: 0

John Mersal
John Mersal

Reputation: 187

You do need to download the file and refer to it locally, The link supported there is a download link and requires a Captcha to be downloaded which means it is NOT a direct link to the TTF File.

Upvotes: 0

Ripside
Ripside

Reputation: 153

Is perhaps the "+" sign in the font URL a problem? You might want to URL encode it.

Edit - after hitting the font URL, it looks like you should try to download the ttf file, and refer to it locally, rather than from a remote source. It's prompting me for a Captcha in order to download the file, which is probably why it's not working.

Upvotes: 0

Marek Andrzejak
Marek Andrzejak

Reputation: 15

no

@font-face

Try get inport it:

@import_your_new_cssfile.css

whre you put:

font-face {
 font-family: "JSL";
 src: url(http://www.fontyukle.net/en/DownLoad-JSL+Ancient.ttf) format("truetype");
}

font {
 color: #000000;
 font-size: 120%;
 font-family: "JSL";
}

Upvotes: 0

Related Questions