home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Netscape’s Downloadable Fonts

Netscape Dynamic HTML’s downloadable fonts capability enables you to use any font in your HTML documents. You do this by creating a font definition file that would be placed on your Web server along with your other documents and content. When a user accesses a page that uses one of these fonts, the font definition file downloads with the HTML document the same as images, sounds, and other content displayed on the page. These downloaded fonts remain on the user’s system only while the page is in their cache. Thus, users cannot make use of the fonts for their own purposes.

To make use of Netscape’s downloadable fonts, you need to follow these steps:

1.  Identify the font(s) that you want to use and make sure they are installed on your local system.


CAUTION:  

Remember that fonts, like all information on the Internet and the Web, are subject to copyright laws. Make sure you have a right to use any font that you plan to use as a downloadable font in any of your documents.


2.  Create a font definition file. The easiest way to do this is with an authoring tool for font definition files, such as Typograph from HexMac Web sites (http://www.hexmac.com) or Netscape’s Font Composer Plug-in for Communicator.
The specific steps necessary to produce the file will depend on the tool used, but the output of the operation will be the font definition.


NOTE:  Netscape’s font definition files enable you to specify the domain from which they may be served. This enables you to make sure that other people don’t “hijack” fonts from your server to be used in their documents.
3.  You must link the font definition file to your HTML document. You can do this either by using style sheets or with the <LINK> tag. Using style sheets, for example, to refer to a font definition file named myfont.pfr looks like this:
<STYLE TYPE=“text/css”>
<!-- Hide from incompatible browsers! -->
@fontdef url(http://www.rpi.edu/fonts/myfont.pfr);
<!-- Hide from incompatible browsers! -->
</STYLE>

Linking the same font definition file by using the <LINK> tag looks like this:
<LINK REL=FONTDEF SRC=<“http://www.rpi.edu/fonts/myfont.pfr”>>
4.  Add a new MIME type to your Web server for the font definition file. The MIME type is application/font, with file type .pfr.
5.  Specify the font in your HTML documents. The name of the font will be specified within the font definition file, so you can use the font with <FONT FACE> or style sheets the same as you would use any other font.

Figure 24.5 shows an example of Netscape’s downloadable fonts at work—a sample file located on the DevEdge Online Web site at

http://developer.netscape.com/library/documentation/communicator/dynhtml/fontdef1.htm

If you watch this file load into your Web browser, you will notice that the text first renders in the default font. Then, as the desired fonts download, the text re-renders.


FIGURE 24.5  Netscape’s downloadable fonts enable you to specify any font face, size, and weight that you have access to.

Microsoft Web Embedding Fonts

If you look through Microsoft’s Dynamic HTML documentation, you won’t find any mention of a capability to download fonts to be used with your HTML documents. Microsoft has, in fact, developed technology to perform this function—they just don’t call it part of Dynamic HTML. You can find this technology, dubbed the Web Embedding Fonts Tool (WEFT), on Microsoft’s Typography Web site at

http://www.microsoft.com/typography/

In practice, using the WEFT is similar to using Netscape’s downloadable fonts technology. As with Netscape, you can use a special tool to produce what Microsoft calls the font object to be linked to and downloaded with an HTML document. These font object files differ from regular fonts files in that they are prepared especially to be downloaded over the Web—they are compressed and made up of the subset of font characters actually used. These techniques can result in a savings of at least half the time otherwise required—far more if only a small number of characters is used.

After the WEFT is used to create the font object file, it is linked into the HTML document. The syntax Microsoft uses to define an embedded font, included within a style sheet, is the following:

@font-face {
   font-family: MyFont;
   font-style:  normal;
   font-weight: normal;
   src: url(MYFONT0.eot);
}

In this case, the src attribute defines the actual location of the font object file.

Although the tools used to define the font file and the format of the file itself differ between Microsoft’s and Netscape’s systems—as well as the way that the fonts are linked into an HTML document—the other features of the two systems are very similar. Both systems enable you to determine the domain from which the fonts can be served, and both allow the font to remain on the user’s system only as long as the user is viewing your pages.

Figures 24.6 and 24.7 show an example of pages created using Microsoft’s font-embedding technology. The second figure shows what can happen to your carefully constructed Web page if, for some reason, the fonts it uses cannot be downloaded (or are otherwise unavailable).


FIGURE 24.6  Downloading small subsets of fonts makes it easy to create neat effects and special displays without having to create large graphics.


FIGURE 24.7  If the font to be downloaded can’t be found, or some other problem occurs, your Web page won’t have the desired effect.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.