bug-groff
[Top][All Lists]
Advanced

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

[bug #62150] [afmtodit] should not write full file names to "name" direc


From: G. Branden Robinson
Subject: [bug #62150] [afmtodit] should not write full file names to "name" directive of font descriptions
Date: Tue, 8 Mar 2022 23:28:09 -0500 (EST)

Follow-up Comment #4, bug #62150 (project groff):

Hi Dave,

Here's a fresh version of the patch, as I have committed locally (but _not_
pushed).


diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 73ae7c65f..afaabc219 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -48,8 +48,8 @@ if ($#ARGV != 2) {
 
 my $afm = $ARGV[0];
 my $map = $ARGV[1];
-my $font = $ARGV[2];
-my $outfile = $opt_o || $font;
+my $fontfile = $ARGV[2];
+my $outfile = $opt_o || $fontfile;
 my $desc = $opt_d || "DESC";
 my $sys_map = $groff_sys_fontdir . "/devps/generate/" . $map;
 my $sys_desc = $groff_sys_fontdir . "/devps/" . $desc;
@@ -445,7 +445,10 @@ if ($opt_c) {
 
 print("\n");
 
-print("name $font\n");
+my $name = $fontfile;
+$name =~ s@.*/@@;
+
+print("name $name\n");
 print("internalname $psname\n") if $psname;
 print("special\n") if $opt_s;
 printf("slant %g\n", $italic_angle) if $italic_angle != 0;


[comment #3 comment #3:]
> [comment #2 comment #2:]
> > I have conflicting goals.
> 
> As some internet wag once said, "I don't have a solution, but I admire the
problem."

That's a good saying.  :D

> Won't argue against that precept...but "$font" seems a fairly solid variable
name to hold a font name.

Yes--but at first it's a file system object.

> > Perl is not the level of programming where we need to emulate
> > a register allocator.
> 
> True, but I was thinking more of the human reader.  I read that, and I
think, "oh, he's preserving the old value so he can use it again later." 
However, I cannot vouch that my interpretation is universal, or even common.

It should be common to an experienced programmer.  It simply isn't the case
this time.

A fellow student in my high school programming class (Pascal-based) discovered
for himself the arbitrariness of variable names, recognizing that the machine
did not care what we called them.  So on one occasion he named something, I
think it was a loop index, "BANANA".

He ended up being a lawyer.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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