Dear Werner, On Wed, 8 Mar 2006, Werner LEMBERG wrote:
... BTW, it might be a good idea to add comments to the devps font description files, giving the version and origin of the used AFMs.
The patch to make afmtodit copy Comments, Notice, Version, FullName and FamilyName from AFM file to groff font file as comments is attached.
Please, test ;) Sincerely, Michail
--- afmtodit.pl.orig 2005-12-09 21:12:30.000000000 +0300 +++ afmtodit.pl 2006-04-02 13:07:06.000000000 +0400 @@ -30,9 +30,9 @@ my $groff_sys_fontdir = "@FONTDIR@"; use Getopt::Std; -getopts('a:d:e:i:mnsvx'); +getopts('a:cd:e:i:mnsvx'); -our ($opt_a, $opt_d, $opt_e, $opt_i, $opt_m, $opt_n, $opt_s, $opt_v, $opt_x); +our ($opt_a, $opt_c, $opt_d, $opt_e, $opt_i, $opt_m, $opt_n, $opt_s, $opt_v, $opt_x); if ($opt_v) { print "GNU afmtodit (groff) version @[EMAIL PROTECTED]"; @@ -40,7 +40,7 @@ } if ($#ARGV != 2) { - die "usage: $prog [-mnsvx] [-a angle] [-d DESC] [-e encoding]\n" . + die "usage: $prog [-cmnsvx] [-a angle] [-d DESC] [-e encoding]\n" . " [-i n] afmfile mapfile font\n"; } @@ -54,6 +54,7 @@ # read the afm file my $psname; +my ($notice, $version, $fullname, $familyname, @comments); my $italic_angle = 0; my (@kern1, @kern2, @kernx); my (%italic_correction, %left_italic_correction); @@ -67,12 +68,28 @@ open(AFM, $afm) || die "$prog: can't open \`$ARGV[0]': $!\n"; while (<AFM>) { - chop; + chomp; + s/\x0D$//; my @field = split(' '); next if $#field < 0; if ($field[0] eq "FontName") { $psname = $field[1]; } + elsif($field[0] eq "Notice") { + $notice = $_; + } + elsif($field[0] eq "Version") { + $version = $_; + } + elsif($field[0] eq "FullName") { + $fullname = $_; + } + elsif($field[0] eq "FamilyName") { + $familyname = $_; + } + elsif($field[0] eq "Comment") { + push(@comments, $_); + } elsif($field[0] eq "ItalicAngle") { $italic_angle = -$field[1]; } @@ -409,6 +426,16 @@ print("encoding $e\n"); } +if ($opt_c) { + print("# $fullname\n") if defined $fullname; + print("# $version\n") if defined $version; + print("# $familyname\n") if defined $familyname; + print("# $notice\n") if defined $notice; + foreach my $comment (@comments) { + print("# $comment\n"); + } +} + if (!$opt_n && %ligatures) { print("ligatures"); while (my $lig = each %ligatures) {
--- afmtodit.man.orig 2006-04-02 02:25:31.000000000 +0400 +++ afmtodit.man 2006-04-02 11:01:15.000000000 +0400 @@ -45,7 +45,7 @@ .in +\w'\fBafmtodit 'u .ti \niu .B afmtodit -.OP \-mnsvx +.OP \-cmnsvx .OP \-a n .OP \-d desc_file .OP \-e enc_file @@ -200,6 +200,10 @@ option to give the font a smaller slant. . .TP +.B \-c +Include comments in the font file in order to identify the PS font. +. +.TP .BI \-d desc_file The device description file is .I desc_file
_______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff