gbranden pushed a commit to branch master
in repository groff.

commit 66df2be1a90c88efda979305cde588c1ed3e3b7c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 21 08:20:53 2024 -0500

    [afmtodit]: Improve generated comments.
    
    * src/utils/afmtodit/afmtodit.pl: Improve information written to
      generated font description files in comments.  Name the AFM and map
      files used.  Report any options specified on the command line.  The
      idea is to make it easier for future (and current) maintainers to
      update such files because years pass between occurrences, and
      institutional memory is, if not lost, laborious to dredge up.  This
      practice might also assist users in producing groff description files
      for their own fonts.  Also write out a glyph's corresponding Unicode
      code point in the comment field only if one is defined.  Otherwise we
      get a comment marker followed by a tab and a newline, which Git marks
      in radioactive red.
    
    Begins addressing <https://savannah.gnu.org/bugs/?65697>.
---
 ChangeLog                      | 17 +++++++++++++++++
 src/utils/afmtodit/afmtodit.pl | 31 +++++++++++++++++++++++++++----
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a30d47d0e..a82cda237 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-08-21  G. Branden Robinson <[email protected]>
+
+       * src/utils/afmtodit/afmtodit.pl: Improve information written to
+       generated font description files in comments.  Name the AFM and
+       map files used.  Report any options specified on the command
+       line.  The idea is to make it easier for future (and current)
+       maintainers to update such files because years pass between
+       occurrences, and institutional memory is, if not lost, laborious
+       to dredge up.  This practice might also assist users in
+       producing groff description files for their own fonts.  Also
+       write out a glyph's corresponding Unicode code point in the
+       comment field only if one is defined.  Otherwise we get a
+       comment marker followed by a tab and a newline, which Git marks
+       in radioactive red.
+
+       Begins addressing <https://savannah.gnu.org/bugs/?65697>.
+
 2024-08-21  G. Branden Robinson <[email protected]>
 
        * src/utils/afmtodit/afmtodit.pl: Define `prog` scalar as only
diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 7b79ef991..343df6125 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 ([email protected])
 #
 # This file is part of groff.
@@ -474,7 +474,28 @@ open(FONT, ">$outfile") ||
   &croak("unable to open '$outfile' for writing: $!");
 select(FONT);
 
+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;
@@ -483,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) {
@@ -491,7 +512,7 @@ if ($opt_c) {
        }
     }
     else {
-       print("# The original AFM file contains no comments.\n");
+       print("# The AFM file contained no comments.\n");
     }
 }
 
@@ -639,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});

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to