Text::Layout::FontConfig - Pango style font description for Text::Layout
Font descriptors are strings that identify the characteristics of the desired font. For example, Sans Italic 20.
Sans Italic 20
The PDF context deals with physical fonts, e.g. built-in fonts like Times-Bold and fonts loaded from font files like /usr/share/fonts/dejavu/DejaVuSans.ttf.
Times-Bold
/usr/share/fonts/dejavu/DejaVuSans.ttf
To map font descriptions to physical fonts, these fonts must be registered. This defines a font family, style, and weight for the font.
Note that Text::Layout::FontConfig is a singleton. Creating objects with new() will always return the same object.
For convenience only. Text::Layout::FontConfig is a singleton. Creating objects with new() will always return the same object.
Attributes:
If true, a predefined set of font names (the PDF corefonts) is registered.
Registers a font fmaily, style and weight for the given font.
$font can be the name of a built-in font, or the name of a TrueType or OpenType font file.
$family is a font family name such as normal, sans, serif, or monospace. It is possible to specify multiple family names, e.g., times, serif.
normal
sans
serif
monospace
times, serif
$style is the slant style, one of normal, oblique, or italic.
oblique
italic
$weight is the font weight, like normal, or bold.
bold
For convenience, style combinations like "bolditalic" are allowed.
A final hash reference can be passed to specify additional properties for this font. Recognized properties are:
shaping - If set to a true value, this font will require text shaping. This is required for fonts that deal with complex glyph rendering and ligature handling like Devanagari.
shaping
Text shaping requires module HarfBuzz::Shaper.
interline - If set to a true value, an alternative way to determine glyph height is used. This may improve results for some fonts.
interline
underline_thickness, underline_position - Overrides the font specified or calculated values for underline thickness and/or position. This may improve results for some fonts.
underline_thickness
underline_position
strikeline_thickness, strikeline_position - Overrides the font specified or calculated values for strikeline thickness and/or position. This may improve results for some fonts.
strikeline_thickness
strikeline_position
Note that strikeline thickness will default to underline thickness, if set.
overline_thickness, overline_position - Overrides the font specified or calculated values for overline thickness and/or position.
overline_thickness
overline_position
This may improve results for some fonts.
Note that overline thickness will default to underline thickness, if set.
Adds one or more file paths to be searched for font files.
Adds aliases for existing font families.
Multiple aliases can be specified, e.g.
$layout->register_aliases( "times", "serif, default" );
or
$layout->register_aliases( "times", "serif", "default" );
This is a convenience method that registers all built-in corefonts.
Aliases for families serif, sans, and monospace are added unless $noaliases is specified.
You do not need to call this method if you provide your own font registrations.
Returns a font descriptor based on the given family, style and weight.
On Linux, fallback using fontconfig.
Returns a font descriptor using a Pango-style font description, e.g. Sans Italic 14.
Sans Italic 14
Parses a Pango-style font description and returns a hash ref with keys family, style, weight, and size.
family
style
weight
size
Unspecified items are returned as empty strings or, in the case of size, zero.
Returns a font descriptor from a filename. Tries to infer Pango data from the name.
Text::Layout, Text::Layout::FontDescriptor.
Johan Vromans, <JV at CPAN dot org>
<JV at CPAN dot org>
This module is part of <Text::Layout>.
Development takes place on GitHub: https://github.com/sciurius/perl-Text-Layout.
You can find documentation for this module with the perldoc command.
perldoc Text::Layout::FontConfig
Please report any bugs or feature requests using the issue tracker for Text::Layout on GitHub.
See Text::Layout, Text::Layout::FontDescriptor, HarfBuzz::Shaper.
To install Text::Layout, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Layout
CPAN shell
perl -MCPAN -e shell install Text::Layout
For more information on module installation, please visit the detailed CPAN module installation guide.