[Contents] [Prev page]

Dynamic Fonts

Font enhancements in Communicator include the ability to dynamically incorporate fonts into a document and send the font with the document, just like you can send an image with a document.

Dynamic fonts provide the ability to incorporate fonts in Web documents. This is done by allowing authors to define the URL of an appropriate font file. The font itself can be referenced from within a style sheet or by using the <FONT FACE=...> tag. Unless previously cached, the font will be downloaded from a server at the time the page is loaded, much like an image file.

A document utilizing dynamic fonts needs to specify the source for the font definition at the top of the document.

You can specify the source for a font definition either by using a style sheet or using the <LINK> tag. Referencing a style sheet in CSS1 syntax would look like this:

<STYLE TYPE="text/css"><!-- 
    @fontdef url(http://home.netscape.com/fonts/sample.pfr);  

Referencing a style sheet using a link would look like:

<LINK REL=fontdef SRC="http://www.netscape.com/fonts/sample.pfr"> 

where sample.pfr is the font definition file.

The font definition file may contain more than one font.

After specifying the source for a font definition file, you can use fonts in that file for the value of the FACE attribute in the <FONT> tag.

When a user reads a web page that uses linked fonts, the font is automatically downloaded to their system. However, the web browser will only display the font correctly if it can find a displayer for it.If the browser can't find a displayer for a particular font, then it uses the default font.

Installed Fonts

A standard set of fonts are installed with Netscape Communicator. These will become system fonts, accessible by name using the FONT FACE tag or style sheets, and will be identical on all platforms (Windows, Macintosh, and Unix). The standard fonts are:

HTML Tags and Attributes for Specifying Fonts

The <FONT> tag takes new POINT-SIZE and WEIGHT attributes, in addition to the other attributes it already supports.

The POINT-SIZE attribute indicates the point size of the font. For example:

<FONT FACE="Monospace" POINT-SIZE=18> This text appears in 18 pt monspace font.</FONT>

The POINT_SIZE attribute lets you set exact point sizes. It differs from the existing SIZE attribute in that it lets you set the font size relative to the existing size, for example, "+2" or "-2".

The WEIGHT attribute indicates the weight, or "boldness" of the font. The value is from 100 to 900 inclusive (in steps of 100), where 100 indicates the least bold value, and 900 indicates the boldest value.

If you use the <B> tag to indicate a bold weight, the maximum boldness is always used. The WEIGHT attribute allows you to specify degrees of boldness, rather than just "bold" or "not bold,"

For example:

<FONT FACE="MONOSPACE" POINT_SIZE=18 WEIGHT=600> This text appears in 18 
pt monospace font.It is fairly bold, but it could be even bolder if it 
really wanted to be.</FONT>

Linking to Fonts

If you use a system font in your web page, you do not need to link the font definition file into your web page.

However, if you use a non-system font, you need to link the font definition file that defines the font into your web page using the <LINK> tag.

<LINK REL="fontdef" SRC=URL> 

For example, suppose you have font definition files called bootsfont.pfr and nikkifont.pfr, you can link them into your web page as follows:

<LINK REL="fontdef" SRC="http://toplevel/fonts/bootsfont.pfr">
<LINK REL="fontdef" SRC="http://toplevel/fonts/nikkifont.pfr">

The source URL can be any valid URL. A font definition file can contain definitons for multiple font faces.

When an HTML page with a <LINK> tag for a font definition file is displayed in a browser, the source URL for the font definition is automatically downloaded. The font definition file is loaded asynchronously so that the HTML page doesn't have to wait while the fonts are loading. The font definition file resides on the host web server with the HTML document. When the page is accessed by a browser, the font definition files is downloaded with the HTML file in the same way that a GIF or JPEG file would be.

In the body of the page, you can use the <FONT>tag, and specify the FACE attribute as a font definition, for example:

<P><FONT FACE="bootsfont">This paragraph is in Boots Font.</FONT></P>
<P><FONT FACE="nikkifont">This one is in Nikki Font.</FONT></P>

[Contents] [Prev page]

Copyright © 1997, Netscape Communications. All rights reserved.