iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 11, 2008
Improving accessibility for motor impaired users
WebDevTips UK
 
May 11, 2008
10 ways to orientate users on your site
WebDevTips UK
 
May 11, 2008
Web Design Clinic - Rros restoration camp 2006
About
 
May 10, 2008
The Moods of Facebook
About
 
May 9, 2008
CSS 1 properties are a great start
About
 
May 9, 2008
Reader Question: How do you get fancy fonts?
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /HTML

Any font on your site! 

  Views:    17208
  Votes:    7
by Ahmad Permessur 4/29/04 Rating: 

Synopsis:

This technique is called font embedding. As you surely know, the font you define for your site might not always show up on your visitor's computer if it isn't installed there.
Pages: 
The Article

But now there is a little code, which you can use to embed your fonts, so you can be sure your visitor will get to see them. But there is one downside to this technique: only IE4 is capable of parsing this code - other browsers will ignore it.

Before we start, you need to get the following things:

- At least IE 4 (if you don't have it already)
- A Software called MS WEFT
- Some really cheeky fonts you want to use.

Now a little something about the components you downloaded.

First, MS WEFT:

In order to successfully embed the font on your site, you need to create an "Embeddablen Open Type" (.eot) file. That's where WEFT (Web Embedding Fonts Tool) jumps in. It creates those for you!

Last, the cheeky fonts:

This is so you have something to test on. Install the font on your system, then build the site and then delete the font from your PC. Now go over to your site to see if it works - that easy! :-)

Over to business! Once you created the .eot file, we can go over to the CODE!

<STYLE type="text/css">
@font-face {
font-family: MyEmbedFont;
font-style: normal;
font-weight: normal;
src: url(embedfont1.eot);
}
</STYLE>


You would now use your font like so:

<FONT face=" MyEmbedFont">Welcome to DEVpapers.com</FONT>  

Now some explanation on the code above (obviously only on the CSS code!)

The "font-family" property is where to type in the font you would like to use. You could also change that value to "Superman" (instead of " MyEmbedFont "), but you would have to change your HTML tags accordingly!
In the "font-style" property you define whether the font is to be "italic", "oblique" or "normal". I chose the latter!

If you want your font to be especially bold or especially light, you can use "bold", "bolder" or "lighter". I again chose normal, 'cause I'm just a normal guy :-)

And now zooming on the most important part! The SRC tells the browser where to find the .eot file you created earlier on with WEFT. Remember to replace the path inside the url()...

One more thing before you go: You need one @font-face for each font you embed!

Pages: 



 
  Sponsors