NAME¶
Prima::PS::Fonts - PostScript device fonts metrics
SYNOPSIS¶
use Prima;
use Prima::PS::Fonts;
DESCRIPTION¶
This module primary use is to be invoked from Prima::PS::Drawable module.
Assumed that some common fonts like Times and Courier are supported by PS
interpreter, and it is assumed that typeface is preserved more-less the same,
so typesetting based on font's a-b-c metrics can be valid. 35 font files are
supplied with 11 font families. Font files with metrics located into 'fonts'
subdirectory.
- query_metrics( $fontName)
- Returns font metric hash with requested font data, uses $defaultFontName
if give name is not found. Metric hash is the same as Prima::Types::Font
record, plus 3 extra fields: 'docname' containing font name ( equals
always to 'name'), 'chardata' - hash of named glyphs, 'charheight' - the
height that 'chardata' is rendered to. Every hash entry in 'chardata'
record contains four numbers - suggested character index and a, b and c
glyph dimensions with height equals 'charheight'.
- enum_fonts( $fontFamily)
- Returns font records for given family, or all families perpesented by one
member, if no family name given. If encoding specified, returns only the
fonts with the encoding given. Compliant to Prima::Application::fonts
interface.
- files & enum_families
- Hash with paths to font metric files. File names not necessarily should be
as font names, and it is possible to override font name contained in the
file just by specifying different font key - this case will be recognized
on loading stage and loaded font structure patched correspondingly.
Example:
$Prima::PS::Fonts::files{Standard Symbols} = $Prima::PS::Fonts::files{Symbol};
$Prima::PS::Fonts::files{'Device-specific symbols, set 1'} = 'my/devspec/data.1';
$Prima::PS::Fonts::files{'Device-specific symbols, set 2'} = 'my/devspec/data.2';
$Prima::PS::Fonts::enum_families{DevSpec} = 'Device-specific symbols, set 1';
- font_pick( $src, $dest, %options)
- Merges two font records using Prima::Drawable::font_match, picks the
result and returns new record. $variablePitchName and $fixedPitchName used
on this stage.
Options can include the following fields:
- resolution - vertical resolution. The default value is taken from font
resolution.
- enum_family( $fontFamily)
- Returns font names that are presented in given family