From e26711a638906ed9b27bd3c210f4f75da6064a58 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 5 Dec 2021 03:00:50 +0000 Subject: CTAN sync 202112050300 --- support/mf2pt1/ChangeLog | 41 +++++++++++++ support/mf2pt1/README | 2 +- support/mf2pt1/mf2pt1.pdf | Bin 181030 -> 183116 bytes support/mf2pt1/mf2pt1.pl | 142 +++++++++++++++++++++++++++++++++++++++++---- support/mf2pt1/mf2pt1.texi | 17 +++--- 5 files changed, 184 insertions(+), 18 deletions(-) (limited to 'support') diff --git a/support/mf2pt1/ChangeLog b/support/mf2pt1/ChangeLog index fb3386307e..a8e6d2d910 100644 --- a/support/mf2pt1/ChangeLog +++ b/support/mf2pt1/ChangeLog @@ -1,3 +1,44 @@ +2021-12-04 Scott Pakin + + * README, mf2pt1.texi: Updated the copyright year to 2021. + + * mf2pt1.pl: + Documented that the directory specified by --output-dir must + already exist. Updated the copyright year to 2021. Updated the + version to 2.7. + +2021-11-28 Scott Pakin + + * Makefile, mf2pt1.pl, mf2pt1.texi: + Documented that environment variables for programs can now include + parameters. + + * mf2pt1.pl: + Incorporated a patch from Werner Lemberg to allow shell + commands to be overridden by environment variables that can also + include program parameters. + +2021-11-27 Scott Pakin + + * mf2pt1.pl: + Introduced a --save-temps option to suppress deletion of intermediate + files. + +2020-11-27 Scott Pakin + + * ChangeLog, README, mf2pt1.mp, mf2pt1.pl, mf2pt1.texi: + mf2pt1 no longer generates a UniqueID automatically, only when + instructed to by the user. This change assists with reproducible + builds and is consistent with Adobe's declaration that unique font IDs + are no longer required or even recommended. + + The documentation has been modified to reflect updated URLs for a + number of external links and to reference the latest copyright year + (2020) and mf2pt1 version number (2.6). + + Thanks to Werner Lemberg for bringing Lilypond's issues with + reproducible builds to my attention. + 2020-11-27 Scott Pakin * mf2pt1.pl diff --git a/support/mf2pt1/README b/support/mf2pt1/README index 500b12ffa9..0eb57ca8fc 100644 --- a/support/mf2pt1/README +++ b/support/mf2pt1/README @@ -27,7 +27,7 @@ For installation instructions, see the mf2pt1 manual (mf2pt1.pdf). Copyright and license --------------------- -Copyright (C) 2005-2020 Scott Pakin, scott+mf@pakin.org +Copyright (C) 2005-2021 Scott Pakin, scott+mf@pakin.org This package may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this diff --git a/support/mf2pt1/mf2pt1.pdf b/support/mf2pt1/mf2pt1.pdf index 5478597a47..a28895171a 100644 Binary files a/support/mf2pt1/mf2pt1.pdf and b/support/mf2pt1/mf2pt1.pdf differ diff --git a/support/mf2pt1/mf2pt1.pl b/support/mf2pt1/mf2pt1.pl index 3546aee393..a9ee8b74fc 100755 --- a/support/mf2pt1/mf2pt1.pl +++ b/support/mf2pt1/mf2pt1.pl @@ -7,7 +7,7 @@ ######################################################################## # mf2pt1 # -# Copyright (C) 2005-2020 Scott Pakin # +# Copyright (C) 2005-2021 Scott Pakin # # # # This program may be distributed and/or modified under the conditions # # of the LaTeX Project Public License, either version 1.3c of this # @@ -21,9 +21,10 @@ # version 2006/05/20 or later. # ######################################################################## -our $VERSION = "2.6"; # mf2pt1 version number +our $VERSION = "2.7"; # mf2pt1 version number require 5.6.1; # I haven't tested mf2pt1 with older Perl versions +use Cwd; use File::Basename; use File::Spec; use Getopt::Long; @@ -160,7 +161,7 @@ my $filedir; my $filenoext; my $versionmsg = "mf2pt1 version $VERSION -Copyright (C) 2005-2020 Scott Pakin +Copyright (C) 2005-2021 Scott Pakin This program may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this @@ -347,15 +348,94 @@ sub assign_default (\$@) } +# This function is taken unchanged from the Parse::CommandLine package +# on CPAN. It gets included here to avoid a dependency on a module +# that is rarely contained in distributions. + +sub parse_command_line { + my $str = shift; + + $str =~ s/\A\s+//ms; + $str =~ s/\s+\z//ms; + + my @argv; + my $buf; + my $escaped; + my $double_quoted; + my $single_quoted; + + for my $char (split //, $str) { + if ($escaped) { + $buf .= $char; + $escaped = undef; + next; + } + + if ($char eq '\\') { + if ($single_quoted) { + $buf .= $char; + } + else { + $escaped = 1; + } + next; + } + + if ($char =~ /\s/) { + if ($single_quoted || $double_quoted) { + $buf .= $char; + } + else { + push @argv, $buf if defined $buf; + undef $buf; + } + next; + } + + if ($char eq '"') { + if ($single_quoted) { + $buf .= $char; + next; + } + $double_quoted = !$double_quoted; + next; + } + + if ($char eq "'") { + if ($double_quoted) { + $buf .= $char; + next; + } + $single_quoted = !$single_quoted; + next; + } + + $buf .= $char; + } + push @argv, $buf if defined $buf; + + if ($escaped || $single_quoted || $double_quoted) { + die 'invalid command line string'; + } + + @argv; +} + + # Print and execute a shell command. An environment variable with the -# same name as the command overrides the command name. Return 1 on +# same name as the command overrides the command name; it can also be +# used to insert additional command-line parameters. Return 1 on # success, 0 on failure. Optionally abort if the command fails, based # on the first argument to execute_command. sub execute_command ($@) { my $abort_on_failure = shift; my @command = @_; - $command[0] = $ENV{uc $command[0]} || $command[0]; + my $env = $ENV{uc $command[0]}; + if ($env) { + my @argv = parse_command_line ($env); + splice @command, 0, 1, @argv; + } my $prettyargs = join (" ", map {/[\\ ]/ ? "'$_'" : $_} @command); print "Invoking \"$prettyargs\"...\n"; my $result = system @command; @@ -364,6 +444,17 @@ sub execute_command ($@) } +# Prepend a directory to a TeX variable. +sub prepend_directory($$$) +{ + my ($dir, $varname, $ftype) = @_; + my $old_value = `kpsewhich --show-path=$ftype`; + die "${progname}: failed to run kpathsea ($!)" if $?; + chomp $old_value; + $ENV{$varname} = "$dir:$old_value"; +} + + # Output the font header. sub output_header () { @@ -761,6 +852,8 @@ GetOptions (\%opthash, "rounding=f", "bpppix=f", "ffscript=s", + "save-temps!", + "output-dir=s", "h|help", "V|version") || pod2usage(2); if (defined $opthash{"h"}) { @@ -774,7 +867,7 @@ do {print $versionmsg; exit 1} if defined $opthash{"V"}; pod2usage(2) if $#ARGV != 0; # Extract the filename from the command line. -$mffile = $ARGV[0]; +$mffile = File::Spec->rel2abs($ARGV[0]); my @fileparts = fileparse $mffile, ".mf"; $filebase = $fileparts[0]; $filedir = $fileparts[1]; @@ -782,9 +875,18 @@ $filenoext = File::Spec->catfile ($filedir, $filebase); $pt1file = $filebase . ".pt1"; $pfbfile = $filebase . ".pfb"; -assign_default $bpppix, $opthash{bpppix}, 0.02; +# If --output-dir was specified, switch to that directory, but point +# Metapost to the current directory. +my $outdir = $opthash{"output-dir"}; +if ($outdir) { + my $here = getcwd(); + prepend_directory $here, "MPINPUTS", "mp"; + prepend_directory $here, "MFINPUTS", "mf"; + chdir $outdir or die "${progname}: failed to switch to $outdir ($!)\n"; +} # Make our first pass through the input, to set values for various options. +assign_default $bpppix, $opthash{bpppix}, 0.02; $mag = 100; # Get a more precise bounding box. get_bboxes(1); # This might set $designsize. @@ -879,7 +981,7 @@ printf OUTFILE "2 index /CharStrings %d dict dup begin\n", output_font_programs(); output_trailer(); close OUTFILE; -unlink @charfiles; +unlink @charfiles unless $opthash{'save-temps'}; print "\n"; # Convert from the disassembled font format to Type 1 binary format. @@ -888,7 +990,7 @@ if (!execute_command 0, ("t1asm", $pt1file, $pfbfile)) { exit 1; } print "\n"; -unlink $pt1file; +unlink $pt1file unless $opthash{'save-temps'}; # Use FontForge to autohint the result. my $user_script = 0; # 1=script file was provided by the user; 0=created here @@ -919,7 +1021,7 @@ AUTOHINT if (!execute_command 0, ("fontforge", "-script", $ffscript, $pfbfile)) { warn "${progname}: You'll need to install FontForge if you want $pfbfile autohinted (not required, but strongly recommended)\n"; } -unlink $ffscript if !$user_script; +unlink $ffscript if !$user_script && !$opthash{'save-temps'}; print "\n"; # Finish up. @@ -956,6 +1058,8 @@ mf2pt1 [B<--rounding>=I] [B<--bpppix>=I] [B<--ffscript>=I] +[B<--save-temps>] +[B<--output-dir>=I] I.mf @@ -1067,9 +1171,27 @@ Redefine the number of big points per pixel from 0.02 to I. Name a script to pass to FontForge. +=item B<--save-temps> + +Do not delete intermediate files (can be useful for debugging). + +=item B<--output-dir>=I + +Write all intermediate and output files to directory I +[default: the current directory]. The directory must already exist. + =back +=head1 ENVIRONMENT + +Environment variables with the same name as a program that B +launches but in uppercase specify an alternative program, possibly +with arguments, to run instead. For example, setting C causes B to include the B<-recorder> option when +running B. + + =head1 FILES F (which is generated from F and F) diff --git a/support/mf2pt1/mf2pt1.texi b/support/mf2pt1/mf2pt1.texi index 5b55575453..9260689d18 100644 --- a/support/mf2pt1/mf2pt1.texi +++ b/support/mf2pt1/mf2pt1.texi @@ -11,7 +11,7 @@ @c %**end of header @copying -Copyright @copyright{} 2005--2020 Scott Pakin +Copyright @copyright{} 2005--2021 Scott Pakin @sp 2 @@ -30,8 +30,8 @@ version 2006/05/20 or later. @end copying -@set VERSION 2.6 -@set DATE 27 November 2020 +@set VERSION 2.7 +@set DATE 4 December 2021 @c Define some fonts we intend to use. @iftex @@ -319,7 +319,10 @@ simply a matter of setting the @samp{FONTFORGE} environment variable to @samp{pfaedit} before invoking @command{mf2pt1}. As a corollary, you can inhibit an @command{mf2pt1} external program from running by setting the corresponding environment variable to the name of a -nonexistent program. +nonexistent program. Arguments can be included in the environment +variable's value. Hence, defining @samp{MPOST} to @samp{mpost +-recorder}, for instance, instructs @command{mf2pt1} to run +@command{mpost} with the @samp{-recorder} option. @menu * Restrictions:: Restrictions imposed on the font source code @@ -676,9 +679,9 @@ parameters that @command{mf2pt1} accepts: @noindent @b{if} known @i{ps_output}: -@multitable {@b{if}} {@b{font_underline_thickness}} {@t{"Copyright (C) 2020 Scott Pakin.";}} +@multitable {@b{if}} {@b{font_underline_thickness}} {@t{"Copyright (C) 2021 Scott Pakin.";}} @item @tab @b{font_coding_scheme} @tab @t{"ot1"}; -@item @tab @b{font_comment} @tab @t{"Copyright (C) 2020 Scott Pakin."}; +@item @tab @b{font_comment} @tab @t{"Copyright (C) 2021 Scott Pakin."}; @item @tab @b{font_family} @tab @t{"Kerplotz"}; @item @tab @b{font_fixed_pitch} @tab @b{false}; @item @tab @b{font_identifier} @tab @t{"Kerplotz Light Oblique"}; @@ -705,7 +708,7 @@ The same parameters can also be specified on the command line as follows: @example -mf2pt1 --encoding=ot1 --comment="Copyright (C) 2020 Scott Pakin." +mf2pt1 --encoding=ot1 --comment="Copyright (C) 2021 Scott Pakin." --family=Kerplotz --nofixedpitch --fullname="Kerplotz Light Oblique" --name=Kerplotz-LightOblique --designsize=10 --italicangle=-9.5 --underpos=-100 --underthick=50 --uniqueid=4112233 --version=002.005 -- cgit v1.2.3