1Text::Layout::FontConfiUgs(e3r)Contributed Perl DocumentTaetxito:n:Layout::FontConfig(3)
2
3
4
6 Text::Layout::FontConfig - Pango style font description for
7 Text::Layout
8
10 Font descriptors are strings that identify the characteristics of the
11 desired font. For example, "Sans Italic 20".
12
13 The PDF context deals with physical fonts, e.g. built-in fonts like
14 "Times-Bold" and fonts loaded from font files like
15 "/usr/share/fonts/dejavu/DejaVuSans.ttf".
16
17 To map font descriptions to physical fonts, these fonts must be
18 registered. This defines a font family, style, and weight for the font.
19
20 Note that Text::Layout::FontConfig is a singleton. Creating objects
21 with new() will always return the same object.
22
23 METHODS
24 new( [ atts... ] )
25 For convenience only. Text::Layout::FontConfig is a singleton.
26 Creating objects with new() will always return the same object.
27
28 Attributes:
29
30 corefonts
31 If true, a predefined set of font names (the PDF corefonts) is
32 registered.
33
34 register_fonts( $font, $family, $style [ , $weight ] [ , $props ] )
35 Registers a font fmaily, style and weight for the given font.
36
37 $font can be the name of a built-in font, or the name of a TrueType
38 or OpenType font file.
39
40 $family is a font family name such as "normal", "sans", "serif", or
41 "monospace". It is possible to specify multiple family names, e.g.,
42 "times, serif".
43
44 $style is the slant style, one of "normal", "oblique", or "italic".
45
46 $weight is the font weight, like "normal", or "bold".
47
48 For convenience, style combinations like "bolditalic" are allowed.
49
50 A final hash reference can be passed to specify additional
51 properties for this font. Recognized properties are:
52
53 • "shaping" - If set to a true value, this font will require text
54 shaping. This is required for fonts that deal with complex
55 glyph rendering and ligature handling like Devanagari.
56
57 Text shaping requires module HarfBuzz::Shaper.
58
59 • "interline" - If set to a true value, an alternative way to
60 determine glyph height is used. This may improve results for
61 some fonts.
62
63 add_fontdirs( @dirs )
64 Adds one or more file paths to be searched for font files.
65
66 register_aliases( $family, $aliases, ... )
67 Adds aliases for existing font families.
68
69 Multiple aliases can be specified, e.g.
70
71 $layout->register_aliases( "times", "serif, default" );
72
73 or
74
75 $layout->register_aliases( "times", "serif", "default" );
76
77 register_corefonts( $noaliases )
78 This is a convenience method that registers all built-in corefonts.
79
80 Aliases for families "serif", "sans", and "monospace" are added
81 unless $noaliases is specified.
82
83 You do not need to call this method if you provide your own font
84 registrations.
85
86 find_font( $family, $style, $weight )
87 Returns a font descriptor based on the given family, style and
88 weight.
89
90 On Linux, fallback using fontconfig.
91
92 from_string( $description )
93 Returns a font descriptor using a Pango-style font description,
94 e.g. "Sans Italic 14".
95
96 On Linux, fallback using fontconfig.
97
98 parse( $description )
99 Parses a Pango-style font description and returns a hash ref with
100 keys "family", "style", "weight", and "size".
101
102 Unspecified items are returned as empty strings or, in the case of
103 "size", zero.
104
105 from_filename( $filename )
106 Returns a font descriptor from a filename. Tries to infer Pango
107 data from the name.
108
110 Text::Layout, Text::Layout::FontDescriptor.
111
113 Johan Vromans, "<JV at CPAN dot org>"
114
116 This module is part of <Text::Layout>.
117
118 Development takes place on GitHub:
119 <https://github.com/sciurius/perl-Text-Layout>.
120
121 You can find documentation for this module with the perldoc command.
122
123 perldoc Text::Layout::FontConfig
124
125 Please report any bugs or feature requests using the issue tracker for
126 Text::Layout on GitHub.
127
129 See Text::Layout, Text::Layout::FontDescriptor, HarfBuzz::Shaper.
130
131
132
133perl v5.34.0 2021-08-21 Text::Layout::FontConfig(3)