home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / Non-RPC / !Perl / riscos / RISCOS / FontCrap < prev    next >
Text File  |  1998-04-24  |  4KB  |  145 lines

  1.  
  2.  
  3. =head1 NAME
  4.  
  5. Font::AFM - Interface to Adobe Font Metrics files
  6.  
  7. =head1 SYNOPSIS
  8.  
  9.  use Font::AFM;
  10.  $h = new Font::AFM "Helvetica";
  11.  $copyright = $h->Notice;
  12.  $w = $h->Wx->{"aring"};
  13.  $w = $h->stringwidth("Gisle", 10);
  14.  $h->dump;  # for debugging
  15.  
  16. =head1 DESCRIPTION
  17.  
  18. This module implements the Font::AFM class. Objects of this class are
  19. initialised from an AFM-file and allows you to obtain information
  20. about the font and the metrics of the various glyphs in the font.
  21.  
  22. All measurements in AFM files are given in terms of units equal to
  23. 1/1000 of the scale factor of the font being used. To compute actual
  24. sizes in a document, these amounts should be multiplied by (scale
  25. factor of font)/1000.
  26.  
  27. The following methods are available:
  28.  
  29. =over 3
  30.  
  31. =item $afm = Font::AFM->new($fontname)
  32.  
  33. Object constructor. Takes the name of the font as argument. It will
  34. croak if the font can not be found.
  35.  
  36. =item $afm->latin1_wx_table()
  37.  
  38. Returns a 256 element array, where each element contains the width
  39. of the corresponding character in the iso-8859-1 character set.
  40.  
  41. =item $afm->stringwidth($string, [$fontsize])
  42.  
  43. Returns the width of the string passed as argument. The string is
  44. assumed to be encoded in the iso-8859-1 character set.  A second
  45. argument can be used to scale the width according to the font size.
  46.  
  47. =item $afm->FontName
  48.  
  49. The name of the font as presented to the PostScript language
  50. C<findfont> operator, for instance "Times-Roman".
  51.  
  52. =item $afm->FullName
  53.  
  54. Unique, human-readable name for an individual font, for instance
  55. "Times Roman".
  56.  
  57. =item $afm->FamilyName
  58.  
  59. Human-readable name for a group of fonts that are stylistic variants
  60. of a single design. All fonts that are member of such a group should
  61. have exactly the same C<FamilyName>. Example of a family name is
  62. "Times".
  63.  
  64. =item $afm->Weight
  65.  
  66. Human-readable name for the weight, or "boldness", attribute of a font.
  67. Exampes are C<Roman>, C<Bold>, C<Light>.
  68.  
  69. =item $afm->ItalicAngle
  70.  
  71. Angle in degrees counterclockwise from the vertical of the dominant
  72. vertical strokes of the font.
  73.  
  74. =item $afm->IsFixedPitch
  75.  
  76. If the value is C<true>, it indicated that the font is a fixed-pitch
  77. (monospaced) font.
  78.  
  79. =item $afm->FontBBox
  80.  
  81. A string of four numbers giving the lower-left x, lower-left y,
  82. upper-right x, and upper-right y of the font bounding box. The font
  83. bounding box is the smallest rectangle enclosing the shape that would
  84. result if all the characters of the font were placed with their
  85. origins coincident, and then painted.
  86.  
  87. =item $afm->UnderlinePosition
  88.  
  89. Recommended distance from the baseline for positioning underline
  90. stokes. This number is the y coordinate of the center of the stroke.
  91.  
  92. =item $afm->UnderlineThickness
  93.  
  94. Recommended stroke width for underlining.
  95.  
  96. =item $afm->Version
  97.  
  98. Version number of the font.
  99.  
  100. =item $afm->Notice
  101.  
  102. Trademark or copyright notice, if applicable.
  103.  
  104. =item $afm->Comment
  105.  
  106. Comments found in the AFM file.
  107.  
  108. =item $afm->EncodingScheme
  109.  
  110. The name of the standard encoding scheme for the font. Most Adobe
  111. fonts use the C<AdobeStandardEncoding>. Special fonts might state
  112. C<FontSpecific>.
  113.  
  114. =item $afm->CapHeight
  115.  
  116. Usually the y-value of the top of the capital H.
  117.  
  118. =item $afm->XHeight
  119.  
  120. Typically the y-value of the top of the lowercase x.
  121.  
  122. =item $afm->Ascender
  123.  
  124. Typically the y-value of the top of the lowercase d.
  125.  
  126. =item $afm->Descender
  127.  
  128. Typically the y-value of the bottom of the lowercase p.
  129.  
  130. =item $afm->Wx
  131.  
  132. Returns a hash table that maps from glyph names to the width of that glyph.
  133.  
  134. =item $afm->BBox
  135.  
  136. Returns a hash table that maps from glyph names to bounding box information.
  137. The bounding box consist of 4 numbers: llx, lly, urx, ury.
  138.  
  139. =item $afm->dump
  140.  
  141. Dumps the content of the Font::AFM object to STDOUT.  Might sometimes
  142. be useful for debugging.
  143.  
  144. =back
  145.