Forum Moderators: not2easy

Message Too Old, No Replies

If font not exist => switch to image

         

tuuni

7:22 am on Jun 29, 2010 (gmt 0)

10+ Year Member



I have site witch uses font: "Impact" for it's logo. So is it a very good idea to use it like that, or there's many operation systems witch don't have it on board.

Major_Payne

2:10 pm on Jun 29, 2010 (gmt 0)



Just embed the font and upload it to your server for use by anyone. Set CSS to use "@font-face". See:

Expand Your Font Palette Using CSS3 [randsco.com]
CSS @ Ten: The Next Big Thing [alistapart.com]
CSS3 Embedding @font-face [zenelements.com]


Other alternatives:

Embed Fonts:

1) Use a text image in the font you want.

2) Use sIFR:

[mikeindustries.com...]
[sitepoint.com...]
[alistapart.com...]

3) Use WEFT (supported by IE only): [microsoft.com...]

Google Font API:

You don't need to do any programming; all you have to do is add a special stylesheet link to your HTML document, then refer to the font in a CSS style.
[code.google.com...]
Google Font Directory: [code.google.com...]

SuzyUK

3:32 pm on Jun 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



as a follow up to your references MP,

I recently brought @font-face into use on a site.
I tried the Code Generator at Font-Squirrel [fontsquirrel.com] to produce the code, as in my reading I discovered IE support issue (suprise!) and that different browsers support different formats (though hopefully all going the way of SVG..hehe)

If you want to know to actually know more about why so much files types and the MS workaround, you could try reading Bulletproof @font-face syntax by Paul Irish [paulirish.com] but as he helpfully points out the generator does all this for you ;)

You need to make sure that the font you are uploading to the generator is Open Source which of course you can get via google too.. but the added bonus of using the generator is that it gives you the CSS code (including the MS workaround), AND it converts your font file into the other formats required AND then it gives you it all back in a nice zip file ready to extract and use - Then just need to upload the various font files to a directory on your server (they're like images and called in relation to the CSS files so possibly put them in the same directory as you CSS file?) and put the CSS snippet they give you at the top of your CSS File.

The included CSS and font files enable you to get the widest range of support from browsers as is possible at the minute which is not too bad - and the CSS includes a little MS Workaround to allow it to go forward.

tuuni, if you do decide to use this route then you would then list your preferred font at the start of your options, but then offer generic fonts in your font-family rule, just like you normally do, that way Browsers that can't support any of the given file types (@font-face) will degrade to the next font in the list like always..

here's the example CSS I have at the top of my file:
** Don't copy this the numbers will be different depending on which font you upload **

@font-face {
font-family: anivers;
src: url('anivers_31-webfont.eot');
src: local('☺'),
url('anivers_31-webfont.woff') format('woff'),
url('anivers_31-webfont.ttf') format('truetype'),
url('anivers_31-webfont.svg#webfontA1B23CFh') format('svg');
font-weight: normal;
font-style: normal;
}

then for my headings (where I want to use it)

h1, h2, h3, h4, h5, h6 {
font-family: anivers, "trebuchet ms", georgia, helvetica, sans-serif;
}


hope that helps

mihai2u

9:03 am on Jul 2, 2010 (gmt 0)

10+ Year Member



If this is inside the logo, don't bother putting this as text, simply use an image.
It is not worth it to use @font-face embedding (or ANY kind of custom-font embedding) since you're only using this in one place.

Save yourself some headaches and take the easy path - show an image logo to everyone :)