Update of bug #63018 (group groff):

                  Status:               Confirmed => Need Info              
             Assigned to:                    None => deri                   

    _______________________________________________________

Follow-up Comment #39:

Hi Deri,

The comment fields for the glyphs in the ZD font description file don't seem
to be accurate.  They don't look like correct Unicode correspondences to me. 
Or at least most don't.


charset
space   278     0       32      space
---     974,621 3       33      a1      --      0021
---     961,611 3       34      a2      --      0022
---     974,621 3       35      a202    --      0023
---     980,692 3       36      a3      --      0024
---     719,566 3       37      a4      --      0025
---     789,705,14      3       38      a5      --      0026
---     790,705,14      3       39      a119    --      2019
---     791,705,13      3       40      a118    --      0028
---     690,553 3       41      a117    --      0029
---     960,568 3       42      a11     --      002A
rh      939,559 3       43      a12     --      002B
---     549,705,11      3       44      a13     --      002C
...


Those code points 0021..002C can't be right, can they?

I've got some patches for _afmtodit_ ready.  Using my patched version I can
recreate the contents of the ZD file as of Werner's last change to it.


commit 7a7ef828efa6292b44d5530f0efb3ea993aac125
Author: Werner LEMBERG <w...@gnu.org>
Date:   Wed May 19 06:22:37 2010 +0000

    Update symbol tables for devps font generation.
    
    * font/devps/generate/textmap: Sort alphabetically.
    Replace tabs with spaces.
    
    * font/devps/generate/symbolchars: Update list to remove duplicates
    which have already been added to `textmap' on 2007-04-09.
    
    * font/devps/symbolmap: Regenerated.
    
    * font/devps/*: Regenerate font definition files.


...except for the comment header, which I changed on purpose.

Here's the command and the diff.


$ ./build/afmtodit -cms -i 0 /tmp/Adobe-Core35_AFMs-314/ZapfDingbats.afm
font/devps/generate/dingbats.map ./font/devps/ZD
$ git diff 7a7ef828efa6292b44d5530f0efb3ea993aac125 font/devps/ZDdiff --git
a/font/devps/ZD b/font/devps/ZD
index 2ffaf6b00..6acfbc750 100644
--- a/font/devps/ZD
+++ b/font/devps/ZD
@@ -1,10 +1,13 @@
-# This file has been generated with GNU afmtodit (groff) version 1.20.1
+# generated by GNU afmtodit (groff) version 1.23.0
+#   AFM file: /tmp/Adobe-Core35_AFMs-314/ZapfDingbats.afm
+#   map file: font/devps/generate/dingbats.map
+#   with options "-c -i 0 -m -s"
 #
 #   FullName ITC Zapf Dingbats
 #   Version 002.000
 #   FamilyName ITC Zapf Dingbats
 #
-# The original AFM file contains the following comments:
+# The AFM file contained the following comments.
 #
 #   Notice Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems
Incorporated. All Rights Reserved.ITC Zapf Dingbats is a registered trademark
of International Typeface Corporation.
 #   Comment Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems
Incorporated. All Rights Reserved.


Here are the changes to "afmtodit.pl".


commit 5e7fccb0e653e189cea119a2d843e5d2cd5e49bc (HEAD)
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Tue Aug 20 21:48:10 2024 -0500

    XXX src/utils/afmtodit/afmtodit.pl

diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index d85defd6f..84588cb38 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -1,5 +1,5 @@
 #!@PERL@
-# Copyright (C) 1989-2020 Free Software Foundation, Inc.
+# Copyright (C) 1989-2024 Free Software Foundation, Inc.
 #      Written by James Clark (j...@jclark.com)
 #
 # This file is part of groff.
@@ -22,21 +22,34 @@ use strict;
 
 @afmtodit.tables@
 
-my $prog = $0;
+use File::Spec qw(splitpath);
+(undef,undef,my $prog)=File::Spec->splitpath($0);
+
 my $groff_sys_fontdir = "@FONTDIR@";
 my $want_help;
 my $space_width = 0;
 
 our ($opt_a, $opt_c, $opt_d, $opt_e, $opt_f, $opt_i, $opt_k,
-     $opt_m, $opt_n, $opt_o, $opt_s, $opt_v, $opt_x);
+     $opt_m, $opt_n, $opt_o, $opt_s, $opt_v, $opt_w, $opt_x);
 
 use Getopt::Long qw(:config gnu_getopt);
 GetOptions( "a=s", "c", "d=s", "e=s", "f=s", "i=s", "k", "m", "n",
-  "o=s", "s", "v", "w=i" => \$space_width, "x", "version" => \$opt_v,
+  "o=s", "s", "v", "w=i", "x", "version" => \$opt_v,
   "help" => \$want_help
 );
 
-my $afmtodit_version = "GNU afmtodit (groff) version @VERSION@";
+# We keep these two scalars separate so we can report out the option.
+$space_width = $opt_w if $opt_w;
+
+# Preserve the Git revision and partial hash from development builds in
+# `--version` output, but scrub it from comments written to files.
+my $groff_version = "@VERSION@";
+my $short_version = $groff_version;
+$short_version =~ s/(\d+\.\d+.\d+).*/$1/;
+
+my $version_stub = "GNU afmtodit (groff) version";
+my $afmtodit_version = "$version_stub $groff_version";
+my $output_version = "$version_stub $short_version";
 
 if ($opt_v) {
     print "$afmtodit_version\n";
@@ -45,10 +58,15 @@ if ($opt_v) {
 
 sub croak {
   my $msg = shift;
-  print STDERR "$prog: error: $msg";
+  print STDERR "$prog: error: $msg\n";
   exit(1);
 }
 
+sub whine {
+  my $msg = shift;
+  print STDERR "$prog: warning: $msg\n";
+}
+
 sub usage {
     my $stream = *STDOUT;
     my $had_error = shift;
@@ -100,7 +118,7 @@ my (@encoding, %in_encoding);
 my (%width, %height, %depth);
 my (%left_side_bearing, %right_side_bearing);
 
-open(AFM, $afm) || croak("unable to open '$ARGV[0]': $!\n");
+open(AFM, $afm) || &croak("unable to open '$ARGV[0]': $!\n");
 
 while (<AFM>) {
     chomp;
@@ -214,7 +232,7 @@ my ($sizescale, $resolution, $unitwidth);
 $sizescale = 1;
 
 open(DESC, $desc) || open(DESC, $sys_desc) ||
-    croak("unable to open '$desc' or '$sys_desc': $!\n");
+    &croak("unable to open '$desc' or '$sys_desc': $!\n");
 while (<DESC>) {
     next if /^#/;
     chop;
@@ -238,7 +256,7 @@ if ($opt_e) {
 
     my $sys_opt_e = $groff_sys_fontdir . "/devps/" . $opt_e;
     open(ENCODING, $opt_e) || open(ENCODING, $sys_opt_e) ||
-       croak("unable to open '$opt_e' or '$sys_opt_e': $!\n");
+       &croak("unable to open '$opt_e' or '$sys_opt_e': $!\n");
     while (<ENCODING>) {
        next if /^#/;
        chop;
@@ -259,7 +277,7 @@ if ($opt_e) {
 my (%nmap, %map);
 
 open(MAP, $map) || open(MAP, $sys_map) ||
-    croak("unable to open '$map' or '$sys_map': $!\n");
+    &croak("unable to open '$map' or '$sys_map': $!\n");
 while (<MAP>) {
     next if /^#/;
     chop;
@@ -269,12 +287,12 @@ while (<MAP>) {
        if ($field[1] eq "space") {
            # The PostScript character "space" is automatically mapped
            # to the groff character "space"; this is for grops.
-           warn "$prog: you are not allowed to map to " .
-                "the groff character 'space'";
+           &whine("$prog: you are not allowed to map to " .
+                  "the groff character 'space'");
        }
        elsif ($field[0] eq "space") {
-           warn "$prog: you are not allowed to map " .
-                "the PostScript character 'space'";
+           &whine("$prog: you are not allowed to map " .
+                  "the PostScript character 'space'");
        }
        else {
            $nmap{$field[0]} += 0;
@@ -421,7 +439,7 @@ if (!$opt_x) {
            $u =~ s/^_/u/;
            if ($u) {
                if (defined $mapped{$u}) {
-                   warn "$prog: both $mapped{$u} and $ch map to $u";
+                   whine("$prog: both $mapped{$u} and $ch map to $u");
                }
                else {
                    $mapped{$u} = $ch;
@@ -453,10 +471,31 @@ foreach my $lig (sort keys %default_ligatures) {
 # print it all out
 
 open(FONT, ">$outfile") ||
-  croak("unable to open '$outfile' for writing: $!\n");
+  &croak("unable to open '$outfile' for writing: $!\n");
 select(FONT);
 
-print("# This file was generated with $afmtodit_version.\n");
+my @options;
+
+push @options, "-a $opt_a" if defined $opt_a;
+push @options, "-c"        if defined $opt_c;
+push @options, "-d $opt_d" if defined $opt_d;
+push @options, "-e $opt_e" if defined $opt_e;
+push @options, "-f $opt_f" if defined $opt_f;
+push @options, "-i $opt_i" if defined $opt_i;
+push @options, "-k"        if defined $opt_k;
+push @options, "-m"        if defined $opt_m;
+push @options, "-n"        if defined $opt_n;
+push @options, "-o $opt_o" if defined $opt_o;
+push @options, "-s"        if defined $opt_s;
+push @options, "-v"        if defined $opt_v;
+push @options, "-w $opt_w" if defined $opt_w;
+
+my $opts = join ' ', @options;
+
+print("# generated by $output_version\n");
+print("#   AFM file: $afm\n");
+print("#   map file: $map\n");
+print("#   with options \"$opts\"\n") if @options;
 print("#\n");
 print("#   $fullname\n") if defined $fullname;
 print("#   $version\n") if defined $version;
@@ -465,7 +504,7 @@ print("#   $familyname\n") if defined $familyname;
 if ($opt_c) {
     print("#\n");
     if (defined $notice || @comments) {
-       print("# The original AFM file contains the following comments:\n");
+       print("# The AFM file contained the following comments.\n");
        print("#\n");
        print("#   $notice\n") if defined $notice;
        foreach my $comment (@comments) {
@@ -473,7 +512,7 @@ if ($opt_c) {
        }
     }
     else {
-       print("# The original AFM file contains no comments.\n");
+       print("# The AFM file contained no comments.\n");
     }
 }
 
@@ -621,7 +660,9 @@ for (my $i = 0; $i <= $#encoding; $i++) {
            printf(",%d", conv($h));
        }
        printf("\t%d", $type);
-       printf("\t%d\t%s\t%s\t%s\n", $i, $ch, '--',
$AGL_to_unicode{$ch}||'');
+       my $comment = '';
+       $comment .= "\t-- " . $AGL_to_unicode{$ch} if ($AGL_to_unicode{$ch});
+       printf("\t%d\t%s%s\n", $i, $ch, $comment);
        if (defined $nmap{$ch}) {
            for (my $j = 1; $j < $nmap{$ch}; $j++) {
                printf("%s\t\"\n", $map{$ch, $j});


Does this look okay to you?  If so, I'll break it up into sensible change sets
and then regenerate ZD (and I guess ZDR) and commit them.  Then add your new
"dingbats.map" file, and regenerate and commit again.  (It's important to me
to prove reconstructibility of the font descriptions _grops_ has used for 12
years.)  That should resolve this ticket, I think.

But I'll also take a look at the "BALLOT X" symbols in _groff_tmac_(5) to
verify that they're not using a fallback.

I apologize for the clumsiness of my Perl.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63018>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to