lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AFM files


From: Reimer Behrends
Subject: Re: AFM files
Date: Wed, 25 Jul 2001 12:22:09 -0400
User-agent: Mutt/1.2.5i

On Tue, Jul 24, 2001 at 08:05:55PM +0200, Michael Piotrowski wrote:
> Raúl Núñez de Arenas Coronado <address@hidden> writes:
[...]
> >     The text appears right, so the metrics should be the same. The
> > problem is that I don't have metrics for the euro symbol. And I'm
> > running out of time ;))) In six months I won't have peseta but euro in
> > my pocket ;)))
> 
> Me too, but I'll just use EUR instead of the silly logo.  Anyway, for
> this task I'd try the "prfont.ps" program that comes with
> Ghostscript.  It prints all the glyphs and their metrics of a font;
> make a copy, put the desired font name at the end (see comments), and
> send it to your printer.

prfont.ps will only give you the character width. Below is postscript
code to print the metrics for the euro symbol (or any other character
you like) for multiple fonts. Assumes that the font has Latin 9
(ISO-8859-15) encoding, otherwise it might be necessary to reencode the
font accordingly. The result should be ready for insertion into an AFM
file; note that lout's encoding files may have to be updated as well.

[...]

                        Reimer Behrends

% Printing metrics for the euro symbol.
% We assume that the font has an ISO-8859-15 (Latin 9) encoding,
% where the euro symbol can be found in position 164.

/character 164 def % character code
/fonts [ % all the fonts you need metrics for as an array
  /Times-Roman
  /Times-Bold
  /Times-Italics
] def
/basex 72 def
/basey 720 def % For US Letter, and works for A4 as well
% /basey 770 def % For A4

/showint { 10 string exch 0.5 add cvi exch cvs show } bind def
/showmetrics {
  7 dict begin
    /char exch def % local variables
    /font exch def
    1 string dup 0 char 0 lt { 0 } { char } ifelse put % character -> string
    gsave
    font setfont
    dup stringwidth pop /width exch def % compute WX
    newpath 0 0 moveto false charpath flattenpath pathbbox % compute BBox
    /ury exch def /urx exch def /lly exch def /llx exch def
    grestore
    gsave
    (C ) show char showint
    ( ; WX ) show width showint
    ( ; N ) show font begin Encoding end char get 128 string cvs show
    ( ; B ) show
    llx showint ( ) show
    lly showint ( ) show
    urx showint ( ) show
    ury showint ( ;) show
    grestore
  end
} bind def

basex basey moveto % top left corner of page

/Courier-Roman findfont 10 scalefont setfont

fonts
{
findfont 1000 scalefont
character showmetrics
0 -12 rmoveto % advance a line
} forall

showpage


reply via email to

[Prev in Thread] Current Thread [Next in Thread]