AFM(3)
π NAME π
Font::AFM is the main character of this AFM(3) manual page, bestie β it's the interface to Adobe Font Metrics files. β¨
β¨ SYNOPSIS β¨
use Font::AFM;
$h = new Font::AFM "Helvetica";
$copyright = $h->Notice;
$w = $h->Wx->{"aring"};
$w = $h->stringwidth("Gisle", 10);
$h->dump; # for debugging
πΈ DESCRIPTION πΈ
Okay so this module implements the Font::AFM class. Objects of this class are initialised from an AFM (Adobe Font Metrics) file, and then they let you obtain info about the font and the metrics of the various glyphs in the font. No cap. π¦
All measurements in AFM files are given in terms of units equal to 1/1000 of the scale factor of the font being used. To compute actual sizes in a document, these amounts should be multiplied by (scale factor of font)/1000. Math is giving, but stay with me. π
The following methods are available β yes, the whole roster, no skips:
$afm = Font::AFM->new($fontname)β Object constructor. Takes the name of the font as argument. Croaks if the font can not be found. π$afm->latin1_wx_table()β Returns a 256-element array, where each element contains the width of the corresponding character in the iso-8859-1 character set.$afm->stringwidth($string, [$fontsize])β Returns the width of the argument string. The string is assumed to be encoded in the iso-8859-1 character set. A second argument can be used to scale the width according to the font size.$afm->FontNameβ The name of the font as presented to the PostScript languagefindfontoperator, for instanceTimes-Roman.$afm->FullNameβ Unique, human-readable name for an individual font, for instanceTimes Roman.$afm->FamilyNameβ Human-readable name for a group of fonts that are stylistic variants of a single design. All fonts that are members of such a group should have exactly the sameFamilyName. Example of a family name isTimes.$afm->Weightβ Human-readable name for the weight, or "boldness", attribute of a font. Examples areRoman,Bold,Light.$afm->ItalicAngleβ Angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the font.$afm->IsFixedPitchβ Iftrue, the font is a fixed-pitch (monospaced) font.$afm->FontBBoxβ A string of four numbers giving the lower-left x, lower-left y, upper-right x, and upper-right y of the font bounding box. The font bounding box is the smallest rectangle enclosing the shape that would result if all the characters of the font were placed with their origins coincident, and then painted.$afm->UnderlinePositionβ Recommended distance from the baseline for positioning underline strokes. This number is the y coordinate of the center of the stroke.$afm->UnderlineThicknessβ Recommended stroke width for underlining.$afm->Versionβ Version number of the font.$afm->Noticeβ Trademark or copyright notice, if applicable.$afm->Commentβ Comments found in the AFM file.$afm->EncodingSchemeβ The name of the standard encoding scheme for the font. Most Adobe fonts use theAdobeStandardEncoding. Special fonts might stateFontSpecific.$afm->CapHeightβ Usually the y-value of the top of the capital H.$afm->XHeightβ Typically the y-value of the top of the lowercase x.$afm->Ascenderβ Typically the y-value of the top of the lowercase d.$afm->Descenderβ Typically the y-value of the bottom of the lowercase p.$afm->Wxβ Returns a hash table that maps from glyph names to the width of that glyph.$afm->BBoxβ Returns a hash table that maps from glyph names to bounding box information. The bounding box consist of four numbers:llx,lly,urx,ury.$afm->dumpβ Dumps the content of theFont::AFMobject toSTDOUT. Might sometimes be useful for debugging.
The AFM specification can be found at:
http://partners.adobe.com/asn/developer/pdfs/tn/5004.AFM_Spec.pdf
π¦ ENVIRONMENT π¦
METRICSβ Contains the path to search for AFM-files. Format is as for thePATHenvironment variable. The default path built into this library is:
/usr/lib/afm:/usr/local/lib/afm:/usr/openwin/lib/fonts/afm/:.
π BUGS π
Kerning data and composite character data are not yet parsed. Ligature data is not parsed. Not me reading this and going "soon, hopefully" π
π COPYRIGHT π
Copyright 1995-1998 Gisle Aas. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π That's the whole AFM(3) page, bestie! Source/version: perl v5.42.0. Date: 2019-11-13. Slay and goodbye. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Font-AFM 1.20-160000.2.2 Β· Artistic-1.0 OR GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms