phfont
![]() |
![]() |
![]() |
![]() |
phfont
Photon font server
Syntax:
phfont [-A] [-b file] [-D directory]
[-d directory] [-E rule]
[-e file] [-I] [-i file] [-L]
[-l list] [-N number]
[-n name] [-U family]
[-u file] [-X]
Runs on:
Neutrino
Options:
- -A
- Force all text bitmaps to be anti-aliased wherever possible. Only scalable fonts can be anti-aliased.
- -b file
- Save font usage information to the specified file when phfont exits.
- -D directory
- Specify the configuration directory that holds the fontdir, fontext, fontmap, and fontopt files. The default is /usr/photon/font_repository.
- -d directory
- Specify the font directory. All configuration files and font files are assumed to be in this directory. The default is /usr/photon/font_repository.
- -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.
- -I
- Use strict international mapping rules.
- -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. The default file is fontdir.
- -L
- Deny local metrics loading.
- -l list
- Specify a list of fonts to preload and lock into cache.
You can use this to ensure fast access to common
fonts. The list is formatted as a comma-separated list of font names. For example:
helv10,phcursor,cour10b,swissiDefault 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.
- -N number
- Specify the number of times the font manager tries to attach a device before exiting.
Default is 15.
- -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.
- -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.
- -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.
![]() |
You can pass options through the -F option to
io-graphics
when you aren't running an external font server.
The format is slightly different, based on the
getsubopt()
format. For example:
io-graphics -F"-d=/usr/photon/font_repository,-A,-N=10" ... See PfSetOptionsDll() for more information. |
Description:
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. The configuration files used by phfont are described in Files below.
![]() |
This utility needs to have the setuid ("set user ID") bit set in its permissions. If you use mkefs, mketfs, or mkifs on a Windows host to include this utility in an image, use the perms attribute to specify its permissions explicitly, and the uid and gid attributes to set the ownership correctly. |
The phfont utility loads the phfont.so DLL to provide font rendering services. The phfont.so loads DLLs located in /lib/dll/font which provide rendering services for specific font types, such as PHF, TTF, TTC, PFR, Stroke, etc.
If a particular type of rendering is not desired, you can remove the specific dll. To determine which services are provided by each DLL, use the use dll_name command, which displays the usage message for that particular DLL. If an external font server is not started, io-graphics attempts to invoke a font server instance.
![]() |
For optimum performance, it is best to run an external fontserver. Because the graphics driver
still invokes a font library instance, there is no negative performance effect in using the external fontserver.
Since the graphics driver runs at a priority higher than other applications, it processes the draw stream without
being interrupted by outside applications requesting font services.
However, if you are more concerned about memory footprint, don't run an external font server, though there is the potential of some graphic processing slow down. Any increased memory footprint is mostly data, since both instances share common code libraries. |
Examples:
Start the server:
phfont -d /usr/photon/font_repository &
Files:
The rendering DLLs used by the font server are located in /lib/dll/font/*.dll. These files support rendering for at least these font types:
- TrueType
- TrueType collections
- Bitstream TrueDoc PFR
- Photon Bitmap
- Bitstream Stroke
- Bitstream Speedo
- Bitstream T2K
- Adobe Type1
- Adobe Type2
Use the use command to view the font types supported by a DLL.
Other files used by phfont include:
![]() |
You should use the graphical tool fontadmin to configure the phfont files, though you can edit the files by hand if you need to. |
- fontdesc -- font classifications
- font-traplist -- a dynamic list of fonts. These fonts are added to the extension list (see fontext).
- fontdir -- directory of known fonts
- fontdynamic -- A fallback file if font-traplist doesn't exist. This file specifies files that are loaded dynamically, and has the same format as fontdir.
- fontext -- extension rules to handle missing characters
- fontkey -- used to trim specific keywords from the font foundry names.
- fontmap -- font mappling rules
- fontopt -- deprecated, no longer used
- fontopts -- command-line options
- fontorient -- keywords used to identify Asian (Oriental) font foundry names. Used to optimize the extension system.
- fontpreferred -- the preferred Asian font to attempt to use first for Asian (Oriental) extension processing
- mappings -- internal use only
fontdesc
Font classifications -- required. This file lists the font foundries and their types. Each section ([SANSERIF], [SERIF], [DECORATIVE]) contains any number of foundries. Each foundry is on its own line under its appropriate section type.
font-traplist
This file contains a dynamic list of fonts -- optional. The ph script regenerates this file if it does not exist or if the contents of the font_repository have changed. Each entry in the font-traplist 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. The fonts listed in this file are added to the extension list (see fontext).
You may uninstall fonts specified in this file by deleting entries in /etc/system/config/font-traplist.
This file has the same format as fontdir.
fontdir
Directory of known fonts -- required. 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. Entries in this file are static, they can't be loaded dynamically.
Each line in this file contains the following comma-separated fields, in this order, for each known font:
- stem name
- font type/location -- for phf files, this is simply the string to add to the stem name to get the filename containing the font. For others, this is in the form index@filename, where index is the index into the font contained in filename. This value is always 0.
- textual description, i.e. PC Serif
- point size, i.e. 8
- Font style, i.e. B if bold, I if italics, or a combination
- range of characters defined within font, i.e. 0000-00FF
- special (internal) flags
- font bounding size, i.e. 8x8
- font size in K, i.e. 12K
fontdynamic
A fallback file if font-traplist doesn't exist -- optional. This file specifies fonts that are loaded dynamically, and has the same format as fontdir.
fontext
A set of extension rules to handle character dropouts (missing characters) -- required. The format of this file is as follows:
+type = fontname [,fontname...]
Where type is the font type (normal, bold, etc.) and fontname is the font name to search for symbols.
fontkey
Font keys -- required. There are three sections:
- [FOUNDRY] -- lists the foundry names, i.e. BT, MS, Condensed.
- [AFTERFOUNDRYKEYS] -- lists the keys after the foundry, i.e. 'Roman'
- [KEYS] -- lists the style keys, i.e. Plain, Regular,Bold, etc.
fontmap
A set of mapping rules -- required. There are two types:
- Synonym entries, that have the form:
newfont = realfontIn this mapping rule, newfont doesn't exist, but realfont does. If you try to use newfont as a font name, it's mapped to realfont.
The following special-case entry is a default mapping for any unknown font name:
? = realfontFor example, if geneva = helv, then the font geneva12 is translated to helv12.
- Scaling entries, that have the form:
font = {when}scalefontIn 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 are 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) are used directly.
fontopts
Contains the command-line options, one option per line -- optional. Options are located under the appropriate schema section. For example, phfont-specific options are located in the [io-font] section. Options targeted towards a specific rendering DLL are divided into subsections: boolean, numeral, string. They are formatted as follows:
[dll id-subsection-schema]
The font server may run in one of two modes: server mode, or private client DLL mode. In order to differentiate options between the two, by default there is a "dll" schema. If the font server is running in server mode, it searches for options under [dll id-subsection], but if the font server is running in client DLL mode, it searchs for options under [dll id-subsection-dll]. If no options are specified, the default values are used.
fontorient
Keywords used to identify Asian (Oriental) font foundry names -- optional. Used to optimize the extension system.
fontpreferred
The preferred Asian font to attempt to use first for Asian (Oriental) extension processing -- optional.
mappings
For internal use only -- optional. Entries in this file override the descriptive name (e.g. "Helvetica") for a particular font stem ("helv").
Each section ([PHF], [PFR], [TTF]) followed by any number of font mappings for that font type in the form new_font_name = real_font_name.
Environment variables:
- PHFONT
- The default name with which to register the font server.
See also:
bdftophf2, fontadmin, mkfontdir
Using the Photon microGUI and Configuring Your Environment in the Neutrino User's Guide
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)


