summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwl <wl>2006-05-01 08:37:13 +0000
committerwl <wl>2006-05-01 08:37:13 +0000
commite91b3785cc151a3579a9be4659a2aca4ba49ca2c (patch)
treee688391ba0130971538c9d89307d20a3c2fd83d3 /src
parent70128f499d3aabc5669ad48251a9b02c90d7f84e (diff)
downloadgroff-e91b3785cc151a3579a9be4659a2aca4ba49ca2c.tar.gz
* src/utils/afmtodit/afmtodit.pl: New option `-c' to add font
information as a comment in output. * src/utils/afmtodit/afmtodit.man, NEWS: Document it.
Diffstat (limited to 'src')
-rw-r--r--src/utils/afmtodit/afmtodit.man9
-rw-r--r--src/utils/afmtodit/afmtodit.pl41
2 files changed, 42 insertions, 8 deletions
diff --git a/src/utils/afmtodit/afmtodit.man b/src/utils/afmtodit/afmtodit.man
index 54554b36..b77773f3 100644
--- a/src/utils/afmtodit/afmtodit.man
+++ b/src/utils/afmtodit/afmtodit.man
@@ -1,5 +1,6 @@
.ig
-Copyright (C) 1989-2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+Copyright (C) 1989-2000, 2001, 2002, 2003, 2005, 2006
+ Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -45,7 +46,7 @@ afmtodit \- create font files for use with groff \-Tps
.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 +201,10 @@ then use the
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
diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 82990111..f8361c35 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w
# -*- Perl -*-
-# Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Written by James Clark (jjc@jclark.com)
#
@@ -30,9 +30,10 @@ $prog =~ s@.*/@@;
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 @VERSION@\n";
@@ -40,7 +41,7 @@ if ($opt_v) {
}
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 +55,7 @@ my $sys_desc = $groff_sys_fontdir . "/devps/" . $desc;
# 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 +69,28 @@ my (%left_side_bearing, %right_side_bearing);
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];
}
@@ -286,7 +304,8 @@ if (!$opt_x) {
# computation of a character sequence. It can be used by font
# designers to indicate some characteristics of the glyph. The
# suffix may contain periods or any other permitted characters.
- # Small cap A, for example, could be named `uni0041.sc' or `A.sc'.
+ # Small cap A, for example, could be named `uni0041.sc' or
+ # `A.sc'.
next if $ch =~ /\./;
@@ -409,6 +428,16 @@ if ($opt_e) {
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) {