1. findfont
Obtain font dictionary by name.
1.3. Description
findfont obtains a font dictionary identified by the specified key and pushes it on the operand stack. The key may be a key previously passed to definefont, in which case the font dictionary associated with key (in the font directory) is returned.
If key is not registered as a font in VM, findfont takes an action that varies according to the environment in which the PostScript interpreter is operating. In some environments, findfont may attempt to read a font definition from an external source, such as a file. In other environments, findfont substitutes a default font or executes the error invalidfont.
findfont is a special case of findresource applied to the Font category.
findfont, like findresource, normally looks first for fonts defined in local VM, then for fonts defined in global VM. However, if the current VM allocation mode is global, findfont considers only fonts defined in global VM. If findfont needs to load a font into VM, it may use either local or global VM, depending on the font. Generally, Type 1 fonts are loaded into global VM; fonts of other types are loaded into local VM.
findfont is not an operator, but rather a built-in procedure. It may be redefined by a PostScript language program that requires different strategies for finding fonts.
1.4. Parameters
key (name or string)
: The name of the font to find (e.g., /Helvetica, /Times-Roman)
1.6. Examples
1.7. Errors
invalidfont : If the font name is not valid or the font dictionary is malformed
stackunderflow : If the operand stack is empty
typecheck
: If key is not a name or string
1.8. Font Discovery
The font discovery mechanism varies by implementation:
-
Local VM fonts - Defined by
definefontin local VM -
Global VM fonts - Defined by
definefontin global VM -
External fonts - Loaded from font files or other external sources
-
Substitution fonts - Default fonts substituted when requested font not found
1.9. VM Allocation
When loading fonts from external sources:
-
Type 1 fonts are typically loaded into global VM
-
Other font types are typically loaded into local VM
-
The current VM allocation mode affects which fonts are visible
1.10. See Also
-
scalefont- Scale font by uniform factor -
makefont- Transform font by matrix -
setfont- Establish current font -
definefont- Register font in font directory -
currentfont- Get current font dictionary