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