We don’t just borrow words; on occasion, English has pursued other languages down alleyways to beat them unconscious and rifle their pockets for new vocabulary.
— James D. Nicol
PDF::Builder::Resource::Font::SynFont - Module for creating temporary synthetic Fonts
Inherits from PDF::Builder::Resource::Font
This module permits you to create a "new" font (loaded temporarily, but not permanently stored) based on an existing font, where you can modify certain attributes in the original font, such as:
* slant/obliqueness
* extra weight/boldness (by drawing glyph outlines at various line
thicknesses, rather than just filling enclosed areas)
* condense/expand (narrower or wider characters)
* extra space between characters
* small caps (synthesized, not using any provided with a font)
* change the encoding
$pdf = PDF::Builder->new();
$cft = $pdf->font('Times-Roman'); # corefont, ttfont, etc. also works
$sft = $pdf->synfont($cft, 'condense' => .75); # condense by 25%
This works for corefonts, PS fonts, and TTF/OTF fonts; but does not work for CJK fonts or bitmapped fonts. See also "Synthetic Fonts" in PDF::Builder::Docs.
Alternate name: synthetic_font
This is for compatibility with recent changes to PDF::API2.
$font = PDF::Builder::Resource::Font::SynFont->new($pdf, $fontobj, %opts)
Returns a synfont object.$fontobj
is a normal font object read in from a file, and$font
is the modified output.
Valid options %opts are:
Changes the encoding of the font from its default. See Perl's Encode for the supported values. Warning: only single byte encodings are supported. Multibyte encodings such as UTF-8 are invalid.
Changes the reference-name of the font from its default. The reference-name is normally generated automatically and can be retrieved via $pdfname=$font->name().
Alternate name: name
(for PDF::API2 compatibility)
Condense/expand factor (0.1-0.9 = condense, 1 = normal, 1.1+ = expand). It's the multiplier for character widths vs. normal.
Alternate names:hscale
andslant
(for PDF::API2 compatibility)
The slant option is a deprecated name in both PDF::Builder and PDF::API2. Its value is the same as condense value (1 = normal, unchanged scale). For the hscale option, the value is percentage (%), with 100 being normal, and other values 100 times the condense value. Use only one (at most) of these three option names.
Italic angle (+/-) in degrees, where the character box is skewed. While it's unlikely that anyone will want to slant characters at +/-360 degrees, they should be aware that these will be treated as an angle of 0 degrees (deg2rad() wraps around). 0 degrees of italic slant (obliqueness) is the default.
Alternate name: angle
(for PDF::API2 compatibility)
Use only one (at most) of these two option names.
Embolding factor (0.1+, bold=1, heavy=2, ...). It is additional outline thickness (linewidth), which expands the character (glyph) outwards (as well as shrinking unfilled enclosed areas such as bowls and counters). Normally, the glyph's outline is not drawn (it is only filled); this adds a thick outline. The units are in 1/100ths of a text unit.
If used with thesynthetic_font
alternate entry name, the unit is 1/1000th of a text unit, so you will need a value 10 times larger than with thesynfont
entry to get the same effect
Additional charspacing in thousandths of an em.
Create synthetic small-caps. 0 = no, 1 = yes. These are capitals of lowercase letters, at 80% height and 88% width. Note that this is guaranteed to cover ASCII lowercase letters only -- single byte encoded accented characters usually work, but we can make no promises on accented characters in general, as well as ligatures!
Alternate name: smallcaps
(for PDF::API2 compatibility)
Use only one (at most) of these two option names.
Master Index
PDF::Builder -- Facilitates the creation and modification of PDF files
PDF::Builder::Resource -- Base class for PDF resources
PDF::Builder::Resource::Font -- Some common support routines for font files
PDF::Builder::Resource::Font::BdFont -- Module for using bitmapped Fonts
PDF::Builder::Resource::Font::CoreFont -- Module for using the 14 standard PDF built-in Fonts (plus 15 Windows Fonts)
PDF::Builder::Resource::Font::Postscript -- Support routines for using PostScript fonts
All content © copyright 2005 – 2024
by Catskill Technology Services, LLC.
All rights reserved.
Note that Third Party software (whether Open Source or proprietary) on this
site remains under the copyright and license of its owners.
Catskill Technology Services, LLC does not claim copyright over such software.
This page is https://www.catskilltech.com/Documentation/PDF/Builder/Resource/Font/SynFont.html
Search Quotations database.
Last updated Sat, 09 Dec 2023 at 10:59 PM