[Previous] [Contents] [Index] [Next]

Font Support

This chapter covers the following topics:

Scalable fonts

In addition to full support of bitmap fonts, Photon also provides scalable fonts. These fonts can be scaled to virtually any point size as well as anti-aliased (16 shades) for crisp, clean output on screen at practically any resolution.

Photon's scalable fonts are achieved by means of a high-speed font server that retrieves highly compressed font data from Portable Font Resource (PFR) files (*.pfr), and then renders the font character shapes at any point size and resolution. Note that PFRs provide better than 2-to-1 compression over PostScript fonts.

Font sets

Core Latin set

The Photon Core Latin set (latin.pfr), which comprises the Unicode Basic Latin (U+0000 - U+007F) and the Latin-1 Supplement (U+0080 - U+00FF) character sets, includes the following scalable fonts:

Dutch
Dutch Bold
Dutch Italic
Dutch Bold Italic
Swiss
Swiss Bold
Swiss Italic
Swiss Bold Italic
Wingbats

It also contains the Euro symbol.

Mono-space fonts

A mono-space font set (courier.pfr) includes the following scalable fonts:

Extended Latin set

The Photon Extended Latin set (latinx.pfr) comprises the Unicode Latin Extended-A (U+0100 - U+017F) and Latin Extended-B (U+0180 - U+0217) sets. The Extended Latin set includes these fonts:

Dutch
Dutch Bold
Dutch Italic
Dutch Bold Italic
Swiss
Swiss Bold
Swiss Italic
Swiss Bold Italic


Note: The following fonts are algorithmically generated: Dutch Italic, Dutch Bold Italic, Swiss Italic, and Swiss Bold Italic.

Languages supported

Armed with the Photon Core Latin set, the developer can support a host of languages, including:

Danish
Dutch
English
Finnish
Flemish
French
German
Hawaiian
Icelandic
Indonesian
Irish
Italian
Norwegian
Portuguese
Spanish
Swahili
Swedish

By adding the Photon Extended Latin set (latinx.pfr), the developer can support several additional languages, including:

Afrikaans
Basque
Catalan
Croatian
Czech
Esperanto
Estonian
Greenlandic
Hungarian
Latvian
Lithuanian
Maltese
Polish
Romanian
Slovak
Turkish
Welsh


Note: Apart from the standard character sets shipped with Photon, developers may wish to order specific PFRs to support certain languages and alphabets (e.g. Cyrillic, Korean, etc.)

Japanese language support

An optional Photon product, the Japanese Language Supplement, offers developers full support for Japanese characters.

Besides a complete set of PFRs (Hon Mincho Kanji set), the package also includes a front-end processor that allows users to provide input using either an English or a Japanese keyboard.

Photon has a simple editor that allows the entry of stylized UTF-8 encoded text. For more information, see the ped utility in the Applications and Utilities chapter.

Photon font configuration

Global vs local

By default, Photon uses a global configuration based on configuration files located in the /usr/photon/font directory. Each individual user may have their own specific set of configurations located in the $HOME/.photon/font directory. This allows, for example, some users to have access to a set of (memory-intensive) Japanese fonts, whereas other users may not require these. Once you've created your own font configuration, it's used by subsequent Photon sessions.

The superuser (root) doesn't have a private configuration - any modifications made will apply to the global default. In this case, the -G option must be specified to prevent accidental modification of the global configuration.

User configuration files

The following files hold a user's configuration:

These files are located in the $HOME/.photon/font directory. Although these files may be edited directly, you should use the graphical fontcfg utility, because an error in the configuration may prevent the Photon font subsystem from functioning.

Configuration utility

To start the configuration utility:

The utility opens with a dialog showing four tab sections, a status bar, a Save button, and an Exit button.

Photon Font Installer

Each section configures a different aspect of the font system. Click on the tab (or use the appropriate hotkey) to switch to a specific section.

When you're finished, you can save or discard your changes:

Fonts tab

Before a font can be used by an application, it must be made available to Photon. You use the Fonts tab to install the fonts you want to use.

Photon Font Configuration

The fonts tab shows two lists of fonts:

The font type is indicated by the icon beside the name. For example: Photon bitmap files are shown with a blue Pf symbol, and Bitstream scalable fonts are shown with a gold Bf symbol. These fonts must reside in the /usr/photon/font directory and have a file extension of *.phf or *.pfr.

Initially, the font tree shows only the descriptive name of the font - click the expand button (+) by the name and the entry expands to show all the sizes and styles for that font. The Helvetica entry represents the set of helv*.pfr bitmap files. Expanding this entry reveals branches with names such as 8pt Regular and 8pt Bold Italic, each corresponding to a specific instance of the font. An expanded font tree will look similar to this:

Times subtree

Installing fonts

To install a new font:

  1. Click the desired font(s) from the uninstalled fonts list.


    Note: When you select a font by the descriptive name, all the sizes and styles of that font are selected. To install only a subset of a font, expand the tree and select the individual font size(s) and type(s) desired.

  2. Click the Install button.
  3. The selected fonts are removed from the "uninstalled" tree and placed in the "installed" tree.

Removing fonts

To remove an existing font:

  1. Select the font from the Installed Fonts pane on the left side.
  2. Click Uninstall.

Displaying font types

You can display just the Bitmap (*.phf) or Scalable (*.pfr) fonts by toggling the appropriate check boxes in the center of the window.

Mappings tab

You use this tab to configure Font name mappings and scalable font substitution rules.

Photon Font Configuration

You use font mappings to provide aliases for font names defined in other systems (such as Arial or Geneva) or for "virtual fonts." For instance, when you create a font mapping for term and use it in all of your applications, you modify the definition of this pseudo-font in one place, and the change is propagated throughout.

Creating, modifying, and deleting aliases

The Font Name Mappings panel on the left side contains all the current settings for font name mappings. To create an alias:

  1. Type the virtual font name in the Replace field.
  2. In the With field, select the substitute font from the combobox selections.
  3. Click Add.

To modify an existing alias:

  1. Select an item from the list in the Font Name Mappings field.
  2. In the With field, select a substitute font from the combobox selections.
  3. Click Modify.

To delete an existing alias:

  1. Select an item from the list in the Font Name Mappings field.
  2. Click Delete.

Unknown fonts

To specify which font to use when a font name can't be resolved by any of the mapping rules:

=>> In the Unknown Font field, select a font from the combobox.

Creating, modifying, and deleting substitution rules

The font system uses scalable font substitution rules when you request a font size that isn't available. Bitmap fonts are augmented with a scaled version of a similar font according to your specifications. The list of scalable font substitution rules appears in the scalable font substitutions panel.

To create a new substitution rule:

  1. Select a bitmap font from the Supplement combobox.
  2. Select a scalable substitute font from the With combobox.
  3. Specify when to make the substitution by choosing one of the required conditions:
  4. Click Add.

To modify an existing rule:

  1. Select an item from the Scalable Font Substitutions field list.
  2. Select the substitute font from the selections in the Supplement field combobox, if required.
  3. Select the substitute font from the selections in the With field combobox, if required.
  4. Specify when to make the substitution by choosing one of the required conditions, if required.
  5. Click Modify.

To delete an existing rule:

  1. Select an item from the list in the Scalable Font Substitutions field.
  2. Click Delete.

Bitstream scalable fonts

The Bitstream scalable fonts shipped since Photon 1.12 include:

If you use scalable fonts, these mappings may be appropriate. You can control the point size limits at which these rules take effect by uninstalling the smaller or larger bitmap fonts from your system.

Extensions tab

You use this tab to configure a set of rules to locate the appropriate fonts for the rendering of international characters.

Extensions configuration dialog

Whenever a character isn't contained within the base font specified by an application, the font server searches an internal list of fonts to find a definition of that character. The first font located that can render the required character is used.

Although multiple search rules may be defined, only one rule is used by the font server at a time. From the Extension Rule combobox, you can:

Creating, modifying, and deleting extension rules

The Sizes/Styles and Font Name lists contains the fonts to be searched, in order from top to bottom, when looking for a character definition. To add a new entry:

  1. Select the font and style from the Extension Font comboboxes.
  2. Enter the point size range for the font (or select the All Sizes toggle button).
  3. Select the font style (or select the All Styles toggle button).
  4. Add the entry to the search list in the appropriate position.

    You can add a new entry before the first entry using the Insert Before button, or after the last entry using the Insert After button. If no items are selected in the list, the new entry becomes the first or last item, depending on the selected button.

To delete or shuffle the order of the items in the search order list:

  1. Select an item (or items) in the search list.
  2. Click the appropriate button: Remove, Shuffle Up, or Shuffle Down.

Note that the Bitstream scalable fonts of the same base name are automatically merged together to provide an enlarged character set. For example, when the latinx.pfr (Photon Extended Latin set) file is installed, the new characters are immediately available to applications using "Swiss" and "Dutch" without any change to the Extensions rules.

Options tab

In this section, you configure the runtime options (such as memory caching) of the font server.

Options configuration dialog

The options include:

Scalable Font Support
If you check this option, the font server loads support for Bitstream scalable fonts (an extra 70K of code). It also enables the following set of options:
PHF Bitmap Cache
Selects the size of the cache used to hold bitmap (*.phf) font metrics and images. This memory is used as an LRU cache for these fonts. This also enables the following set of options:
Anti-aliasing
This allows the anti-aliasing of bitmaps to be forced on (Always) or off (Never) as required. By default, each text string controls this attribute individually. However, there's a performance penalty in switching between the two modes (the bitmap cache must be flushed), so forcing a consistent anti-alias usage is more efficient.
Display Missing Symbols
If you check this option, the font server renders a rectangular box for those characters for which it has no defined bitmap. While this is useful during development, it's sometimes desirable to simply ignore (with no display feedback) any undefined character.

This pane also contains a list of synthesized missing symbol sizes (used in conjunction with PHF fonts) and lets you add, delete, and change these sizes. Missing symbols for PFR fonts are scaled to an exact size.

The bar graph on the right of the Options pane shows the relative disk space occupied by the various types of font (Bitmap *.phf or Scalable *.pfr). Use this to determine the space allocation of the various caches.

Script Files

The fontcfg utility may also run in an automatic batch mode, where it reads commands from a script file (given on the command line) and executes the font configuration commands contained in that script file. This facility is used, for example, by the Photon installation script when the Japanese language package is installed to add the new fonts and extensions rules.


[Previous] [Contents] [Index] [Next]