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

phfont

Start Photon font server

Syntax:

phfont [-A|-a] [-B nblks] [-b size] [-c size] [-D directory] 
       [-d directory] [-E rule] [-e file] [-G file] [-H]
       [-i file] [-L] [-l list] [-M] [-m list] [-n name]
       [-P depth] [-R res] [-T size] [-t size] [-U family]
       [-u file] [-w size] [-X] [-Z radius] [-z]

Options:

-A
Force all text bitmaps to be anti-aliased wherever possible. Only scalable fonts in a Portable Font Resource (PFR) file can be anti-aliased.
-a
Disable all anti-aliased output of text bitmaps. By default anti-aliasing is controlled by the "a" suffix of a font name (e.g. swiss24a).
-B nblks
Set the number of blocks in the PFR disk buffer cache. This improves performance when (re)loading font details or when the size of the workspace area (-w size) has been restricted. The default is 32 blocks.
-b size
Set the size of the bitmap cache for PFR fonts. This is a Least Recently Used (LRU) cache of rasterized scaled characters. Anti-aliased characters require four times more storage than a normal bitmap character (eight times more storage if -P8 is specified). The default is 50K.
-c size
Set the size of the metric/bitmap cache for PHF fonts. This is an LRU cache of font metric and character bitmap data. This value should be tuned based on the number/size of PHF fonts. Default is 200K.
-D directory
Specify the configuration directory that holds the fontdir, fontext, fontmap, and fontopt files. The default is /usr/photon/font.
-d directory
Specify the font directory. All configuration files and font files (*.phf and *.pfr) are assumed to be in this directory. The default is /usr/photon/font.
-E rule
Specify the extension/dropout rule to use. The fontext file may contain a number of different extension rules (e.g. language rules that search the Chinese, Japanese, or Korean character set) of which only one is active. By default, the first "+" rule in the fontext file is used.
-e file
Specify the font extension/dropout file. This file contains rules that extend a base output character set to include multiple font files (e.g. to add special symbols or languages other than English). The default file is fontext.
-G file
Use gamma-correction table for anti-aliased output (file in cfg directory).
-H
Enable hints for all output (default is on for non-anti-aliased, off for anti-aliased).
-i file
Specify the font index file. This file contains header information of every known/usable font in the system and allows the font server to quickly perform font mappings and character dropouts without accessing the disk. Only fonts entered in this file are used (copying a file to fontdir doesn't make the font known/usable to the system). The default file is fontdir.
-L
Deny local metrics loading (for accurate sub-pixel extenting).
-l list
Specify a list of fonts to preload and lock into cache. This can be used to ensure fast access to common fonts. PHF fonts are loaded into the cache area specified by -c, and are loaded into private storage separate from the workspace (-w) area. (The size of the private storage isn't configurable.) The list is formatted as a comma-separated list of font names. For example:
    helv10,phcursor,cour10b,swissi
    

Default is none.

-M
Disable the display of missing-character symbols. By default, whenever a character is rendered for which no definition can be found, the font server displays an empty rectangle.
-m list
By default, whenever a font name can't be resolved by the mapping rules, or the extension rules can't replace character dropouts, the character is displayed as a missing symbol no larger than the base font. With this option, you specify the list of missing symbol sizes to synthesize in the form of cell dimensions (widthxheight) separated by commas. For example:
    1x1,5x8,9x14,12x30
    

The missing symbol that matches or is smaller than the size of the base font is used. The default list of sizes is sufficient for most configurations, but if your system uses a large number of very small or very large fonts, you may wish to provide more missing symbols.

This list applies only to rendering PHF fonts. Missing symbols from a PFR font can be scaled to the exact size. The default is 2x2,5x8,6x12,14x24.

-n name
Specify the name to register the font server with. By default the value of the PHFONT environment variable is used; if this isn't set, the prefix /dev/phfont is used.
-P depth
Pixel depth for anti-aliased output (valid values: 4 or 8; default is 4).
-R res
Screen resolution for scalable font rasterization (default is 96 DPI).
-T size
Set the maximum number of concurrent dynamic PFR font instances. Each instantiation of a scalable font at a particular size/style requires a dynamic font entry. Once all slots have been used, old entries are discarded on an LRU basis. Default is 50.
-t size
Set the maximum number of separate PFR (scalable) files to handle. Up to this number of files specified in the directory will be loaded. A PFR file may hold more than one font face. The default is 8. A value of 0 will ignore all PFR entries and also not allocate any of the caches controlled by the -B, -b, -T, and -w options.
-U family
Specify the font family to use for unknown fonts. Whenever a named font doesn't exist and can't be resolved by explicit mapping entries, this default font family is used. By default the ? entry in the fontmap file is used.
-u file
Specify the unknown font-mapping table file. This file creates font synonyms (or virtual fonts) and configuration rules for augmenting bitmap fonts with scalable fonts. The default file is fontmap.
-w size
Set the size of the workspace area for PFR fonts. This is used to store character index tables and shape information. Any preloaded PFR fonts (via the -l option) won't need storage in this workspace area. The size variable may also be specified as min or max to indicate the level of memory permitted. The default value is calculated at run time based on the number of PFR files in the directory.
-X
Prevent the font server from terminating after the last client disconnects. The default is for the font server to exit once all clients have terminated.
-Z radius
Anti-aliased filter window radius (default is 0). Range is 0 (disabled) to 2 (highest degree of font smoothing).
-z
Enable sub-pixel granularity for anti-aliased output (default is disabled).

All options that expect a memory size (i.e. -b, -c, -w) assume the input value is in bytes; a trailing "k" may be used to specify kilobytes, "m" to specify megabytes.

Description:

Photon has two font servers: phfontpfr and phfontphf. The phfontpfr server is used for files containing bitmap and scalable fonts, while the phfontphf server is used for files containing bitmap fonts only. The phfont utility determines the correct server to run.

The phfont utility provides all font services to Photon applications and drivers. This includes the calculation of text extents and metrics and the generation of bitmaps representing character strings. It also maintains a central cache of font metric and bitmap data.

Two font file formats are supported:

*.phf files
Each contains one instance of a font face/size/style in bitmap format (e.g. helv12b.phf for Helvetica bold 12-point).
Note: The size of a .phf bitmap font file is limited to 64K because of the 16-bit offset used for indexing characters within the font file. So if your resultant .phf file is greater than 64K (for example, when you use Asain fonts), you'll have to create a .phf family. A .phf family is a collection of several individual .phf files. For information on creating .phf families, see Creating a .phf family in bdf_2_phf.

*.pfr TrueDoc files
May contain multiple fonts/faces/styles in a scalable definition format (e.g. latin.pfr, which contains Swiss, Dutch, and Courier). Fonts from a PFR file may be scaled to any point size and may be anti-aliased (16-shades) for improved output quality (or 256-shades if the pixel depth is 8).

Examples:

Start the server in an environment using solely PHF files:

phfont -c256k -t0 &

Start the server in an environment using mainly PFR files with forced anti-aliasing; the PHF cache has been reduced and the PFR caches increased:

phfont -A -b120k -c32k -T80 &

Note: Normally the font server is started from the ph script.

Files:


WARNING: Don't edit these files by hand! Use the graphical tool fontcfg to configure the phfont files.

*.phf
Bitmapped font files. Each file contains information for a single size and style of the font.
*.pfr
Bitstream TrueDoc PFR (Portable Font Resource) files containing hinted scalable definitions of fonts. Each file may contain multiple fonts and multiple styles.
fontdir
Directory of known fonts. Each entry in this file contains information such as the name and type of the font, its size and style, a textual description of the font family, and the range of characters defined within the font. To be available to an application, at least one font must be defined in this configuration file.
fontext
A set of extension rules to handle character dropouts (missing characters). Each rule is of the form:
+rule = font1 [sizes], font2 [sizes], ....

where each font entry is the name of a font to be searched for a dropout character, plus a specification of point sizes for which that entry is to be used.

Whenever a dropout character is noted, a search is made in order through the fonts listed. For example, the following rules define a search order through an appropriate pcchar font file based on the point size followed by phcursor:

+rule = pcchar12 <14, pcchar14>=14 <20, pcchar20 >=20, \
        phcursor 
    

The range of characters defined in each font is obtained from the fontdir file. If the character isn't found in this search, the missing symbol is substituted. The file also allows for $ entries as a form of macro expansion to create logical fonts where a face has been split into multiple files for memory considerations (e.g. the uj*.phf Japanese characters).

fontmap
This file is a set of mapping rules. There are two types of rules:

Synonym entries

Synonym entries have the form:

newfont = realfont

In this mapping rule, newfont doesn't exist, but realfont does. If you try to use newfont as a font name, it will be mapped to realfont.

The following special-case entry is a default mapping for any unknown font name:

? = realfont

For example, if geneva = helv, then the font geneva12 is translated to helv12.

Scaling entries

Scaling entries have the form:

font = {when}scalefont

In this mapping rule, both font and scalefont must exist. When there isn't an exact PHF file for font, then a scaled version of scalefont is made according to the when character used:

*
always scale when no exact PHF file exists for font
+
scale only when above the largest size PHF defined for font
-
scale only when below the smallest size PHF defined for font
#
scale when outside the range of sizes of PHF files for font

For example, if the files helv08.phf, helv10.phf, and helv12.phf are present and swiss is a scalable font, the following translations would be made:

Rule Input font Translated font
helv = *swiss helv06 swiss06
helv11 swiss11
helv23 swiss23
helv = -swiss helv06 swiss06
helv11 helv10
helv23 helv12
helv = +swiss helv06 missing-symbol box
helv11 helv10
helv23 swiss23
helv = #swiss helv06 swiss06
helv11 helv10
helv23 swiss23

In all cases, the fonts helv08, helv10, and helv12 (known valid fonts) would be used directly.

fontopt
This file is processed by phfont. It contains the command-line options, one option per line, for invoking the appropriate font server (phfontphf or phfontpfr) for your configuration.
mappings
This file is for internal use only. It maps font stem names (e.g. "helv") into textual names (e.g. "Helvetica") that are displayed in the Fonts tab of fontcfg, the font configuration utility. It's also used for Bitstream fonts to construct font stem names from the full font name in the file. For example "swiss" is constructed from "Swis721 BT".

Caveats:

A .phf file can't be larger than 64K.

See also:

bdf_2_phf


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