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 • "underline_thickness", "underline_position" - Overrides the
64 font specified or calculated values for underline thickness
65 and/or position. This may improve results for some fonts.
66
67 • "strikeline_thickness", "strikeline_position" - Overrides the
68 font specified or calculated values for strikeline thickness
69 and/or position. This may improve results for some fonts.
70
71 Note that strikeline thickness will default to underline
72 thickness, if set.
73
74 • "overline_thickness", "overline_position" - Overrides the font
75 specified or calculated values for overline thickness and/or
76 position.
77
78 This may improve results for some fonts.
79
80 Note that overline thickness will default to underline
81 thickness, if set.
82
83 add_fontdirs( @dirs )
84 Adds one or more file paths to be searched for font files.
85
86 register_aliases( $family, $aliases, ... )
87 Adds aliases for existing font families.
88
89 Multiple aliases can be specified, e.g.
90
91 $layout->register_aliases( "times", "serif, default" );
92
93 or
94
95 $layout->register_aliases( "times", "serif", "default" );
96
97 register_corefonts( $noaliases )
98 This is a convenience method that registers all built-in corefonts.
99
100 Aliases for families "serif", "sans", and "monospace" are added
101 unless $noaliases is specified.
102
103 You do not need to call this method if you provide your own font
104 registrations.
105
106 find_font( $family, $style, $weight )
107 Returns a font descriptor based on the given family, style and
108 weight.
109
110 On Linux, fallback using fontconfig.
111
112 from_string( $description )
113 Returns a font descriptor using a Pango-style font description,
114 e.g. "Sans Italic 14".
115
116 On Linux, fallback using fontconfig.
117
118 parse( $description )
119 Parses a Pango-style font description and returns a hash ref with
120 keys "family", "style", "weight", and "size".
121
122 Unspecified items are returned as empty strings or, in the case of
123 "size", zero.
124
125 from_filename( $filename )
126 Returns a font descriptor from a filename. Tries to infer Pango
127 data from the name.
128
130 Text::Layout, Text::Layout::FontDescriptor.
131
133 Johan Vromans, "<JV at CPAN dot org>"
134
136 This module is part of <Text::Layout>.
137
138 Development takes place on GitHub:
139 <https://github.com/sciurius/perl-Text-Layout>.
140
141 You can find documentation for this module with the perldoc command.
142
143 perldoc Text::Layout::FontConfig
144
145 Please report any bugs or feature requests using the issue tracker for
146 Text::Layout on GitHub.
147
149 See Text::Layout, Text::Layout::FontDescriptor, HarfBuzz::Shaper.
150
151
152
153perl v5.34.0 2022-02-04 Text::Layout::FontConfig(3)