.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::Layout::FontConfig 3pm" .TH Text::Layout::FontConfig 3pm 2024-04-23 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Text::Layout::FontConfig \- Pango style font description for Text::Layout .SH SYNOPSIS .IX Header "SYNOPSIS" Font descriptors are strings that identify the characteristics of the desired font. For example, \f(CW\*(C`Sans Italic 20\*(C'\fR. .PP The PDF context deals with physical fonts, e.g. built-in fonts like \&\f(CW\*(C`Times\-Bold\*(C'\fR and fonts loaded from font files like \&\f(CW\*(C`/usr/share/fonts/dejavu/DejaVuSans.ttf\*(C'\fR. .PP To map font descriptions to physical fonts, these fonts must be registered. This defines a font family, style, and weight for the font. .PP Note that Text::Layout::FontConfig is a singleton. Creating objects with \fBnew()\fR will always return the same object. .SS METHODS .IX Subsection "METHODS" .IP "new( [ atts... ] )" 4 .IX Item "new( [ atts... ] )" For convenience only. Text::Layout::FontConfig is a singleton. Creating objects with \fBnew()\fR will always return the same object. .Sp Attributes: .RS 4 .IP corefonts 4 .IX Item "corefonts" If true, a predefined set of font names (the PDF corefonts) is registered. .RE .RS 4 .RE .ie n .IP "register_fonts( $font, $family, $style [ , $weight ] [ , $props ] )" 4 .el .IP "register_fonts( \f(CW$font\fR, \f(CW$family\fR, \f(CW$style\fR [ , \f(CW$weight\fR ] [ , \f(CW$props\fR ] )" 4 .IX Item "register_fonts( $font, $family, $style [ , $weight ] [ , $props ] )" Registers a font fmaily, style and weight for the given font. .Sp \&\f(CW$font\fR can be the name of a built-in font, or the name of a TrueType or OpenType font file. .Sp \&\f(CW$family\fR is a font family name such as \f(CW\*(C`normal\*(C'\fR, \f(CW\*(C`sans\*(C'\fR, \f(CW\*(C`serif\*(C'\fR, or \&\f(CW\*(C`monospace\*(C'\fR. It is possible to specify multiple family names, e.g., \&\f(CW\*(C`times, serif\*(C'\fR. .Sp \&\f(CW$style\fR is the slant style, one of \f(CW\*(C`normal\*(C'\fR, \f(CW\*(C`oblique\*(C'\fR, or \f(CW\*(C`italic\*(C'\fR. .Sp \&\f(CW$weight\fR is the font weight, like \f(CW\*(C`normal\*(C'\fR, or \f(CW\*(C`bold\*(C'\fR. .Sp For convenience, style combinations like "bolditalic" are allowed. .Sp A final hash reference can be passed to specify additional properties for this font. Recognized properties are: .RS 4 .IP \(bu 4 \&\f(CW\*(C`shaping\*(C'\fR \- 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. .Sp Text shaping requires module HarfBuzz::Shaper. .IP \(bu 4 \&\f(CW\*(C`ascender\*(C'\fR \- If set overrides the font ascender. This may be necessary to improve results for some fonts. The value is expressed in 1/1000th of an em. .Sp \&\f(CW\*(C`descender\*(C'\fR \- If set overrides the font descender. This may be necessary to improve results for some fonts. The value is expressed in 1/1000th of an em. .IP \(bu 4 \&\f(CW\*(C`underline_thickness\*(C'\fR, \f(CW\*(C`underline_position\*(C'\fR \- Overrides the font specified or calculated values for underline thickness and/or position. This may improve results for some fonts. .IP \(bu 4 \&\f(CW\*(C`strikeline_thickness\*(C'\fR, \f(CW\*(C`strikeline_position\*(C'\fR \- Overrides the font specified or calculated values for strikeline thickness and/or position. This may improve results for some fonts. .Sp Note that strikeline thickness will default to underline thickness, if set. .IP \(bu 4 \&\f(CW\*(C`overline_thickness\*(C'\fR, \f(CW\*(C`overline_position\*(C'\fR \- Overrides the font specified or calculated values for overline thickness and/or position. .Sp This may improve results for some fonts. .Sp Note that overline thickness will default to underline thickness, if set. .RE .RS 4 .RE .ie n .IP "add_fontdirs( @dirs )" 4 .el .IP "add_fontdirs( \f(CW@dirs\fR )" 4 .IX Item "add_fontdirs( @dirs )" Adds one or more file paths to be searched for font files. .ie n .IP "register_aliases( $family, $aliases, ... )" 4 .el .IP "register_aliases( \f(CW$family\fR, \f(CW$aliases\fR, ... )" 4 .IX Item "register_aliases( $family, $aliases, ... )" Adds aliases for existing font families. .Sp Multiple aliases can be specified, e.g. .Sp .Vb 1 \& $layout\->register_aliases( "times", "serif, default" ); .Ve .Sp or .Sp .Vb 1 \& $layout\->register_aliases( "times", "serif", "default" ); .Ve .ie n .IP "register_corefonts( $noaliases )" 4 .el .IP "register_corefonts( \f(CW$noaliases\fR )" 4 .IX Item "register_corefonts( $noaliases )" This is a convenience method that registers all built-in corefonts. .Sp Aliases for families \f(CW\*(C`serif\*(C'\fR, \f(CW\*(C`sans\*(C'\fR, and \f(CW\*(C`monospace\*(C'\fR are added unless \f(CW$noaliases\fR is specified. .Sp You do not need to call this method if you provide your own font registrations. .ie n .IP "find_font( $family, $style, $weight )" 4 .el .IP "find_font( \f(CW$family\fR, \f(CW$style\fR, \f(CW$weight\fR )" 4 .IX Item "find_font( $family, $style, $weight )" Returns a font descriptor based on the given family, style and weight. .Sp On Linux, fallback using fontconfig. .ie n .IP "from_string( $description )" 4 .el .IP "from_string( \f(CW$description\fR )" 4 .IX Item "from_string( $description )" Returns a font descriptor using a Pango-style font description, e.g. \&\f(CW\*(C`Sans Italic 14\*(C'\fR. .Sp On Linux, fallback using fontconfig. .ie n .IP "parse( $description )" 4 .el .IP "parse( \f(CW$description\fR )" 4 .IX Item "parse( $description )" Parses a Pango-style font description and returns a hash ref with keys \&\f(CW\*(C`family\*(C'\fR, \f(CW\*(C`style\*(C'\fR, \f(CW\*(C`weight\*(C'\fR, and \f(CW\*(C`size\*(C'\fR. .Sp Unspecified items are returned as empty strings or, in the case of \&\f(CW\*(C`size\*(C'\fR, zero. .ie n .IP "from_filename( $filename )" 4 .el .IP "from_filename( \f(CW$filename\fR )" 4 .IX Item "from_filename( $filename )" Returns a font descriptor from a filename. Tries to infer Pango data from the name. .SH "SEE ALSO" .IX Header "SEE ALSO" Text::Layout, Text::Layout::FontDescriptor. .SH AUTHOR .IX Header "AUTHOR" Johan Vromans, \f(CW\*(C`\*(C'\fR .SH SUPPORT .IX Header "SUPPORT" This module is part of . .PP Development takes place on GitHub: . .PP You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Text::Layout::FontConfig .Ve .PP Please report any bugs or feature requests using the issue tracker for Text::Layout on GitHub. .SH LICENSE .IX Header "LICENSE" See Text::Layout, Text::Layout::FontDescriptor, HarfBuzz::Shaper.