From 29b15bd74a5ccff3be057d5fd93a2ddc579ecfbb Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 4 Dec 2021 21:41:23 +0000 Subject: mf2pt1 (4dec21) git-svn-id: svn://tug.org/texlive/trunk@61217 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/info/mf2pt1.info | 40 ++++--- Master/texmf-dist/doc/support/mf2pt1/ChangeLog | 41 +++++++ Master/texmf-dist/doc/support/mf2pt1/README | 2 +- Master/texmf-dist/doc/support/mf2pt1/mf2pt1.pdf | Bin 181030 -> 183116 bytes Master/texmf-dist/doc/support/mf2pt1/mf2pt1.texi | 17 +-- Master/texmf-dist/scripts/mf2pt1/mf2pt1.pl | 142 +++++++++++++++++++++-- 6 files changed, 205 insertions(+), 37 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/info/mf2pt1.info b/Master/texmf-dist/doc/info/mf2pt1.info index 88b8792718c..5666407401c 100644 --- a/Master/texmf-dist/doc/info/mf2pt1.info +++ b/Master/texmf-dist/doc/info/mf2pt1.info @@ -1,6 +1,6 @@ -This is mf2pt1.info, produced by makeinfo version 6.7 from mf2pt1.texi. +This is mf2pt1.info, produced by makeinfo version 6.8 from mf2pt1.texi. -Copyright (C) 2005-2020 Scott Pakin +Copyright (C) 2005-2021 Scott Pakin @@ -163,8 +163,8 @@ N.B. The 'install-info' command is a convenient way to install page is embedded within the 'mf2pt1' Perl script and can be extracted with 'pod2man': - pod2man --center="User Commands" --date="27 November 2020" \ - --release="v2.6" mf2pt1 > mf2pt1.1 + pod2man --center="User Commands" --date="4 December 2021" \ + --release="v2.7" mf2pt1 > mf2pt1.1 You can then move 'mf2pt1.1' into '/usr/man/man1' or any other man page directory. Note that the 'mf2pt1' man page is fairly rudimentary. It @@ -206,7 +206,9 @@ PfaEdit, instead of FontForge is simply a matter of setting the 'FONTFORGE' environment variable to 'pfaedit' before invoking 'mf2pt1'. As a corollary, you can inhibit an 'mf2pt1' external program from running by setting the corresponding environment variable to the name of -a nonexistent program. +a nonexistent program. Arguments can be included in the environment +variable's value. Hence, defining 'MPOST' to 'mpost -recorder', for +instance, instructs 'mf2pt1' to run 'mpost' with the '-recorder' option. * Menu: @@ -480,7 +482,7 @@ parameters that 'mf2pt1' accepts: if known ps_output: font_coding_scheme "ot1"; - font_comment "Copyright (C) 2020 Scott Pakin."; + font_comment "Copyright (C) 2021 Scott Pakin."; font_family "Kerplotz"; font_fixed_pitch false; font_identifier "Kerplotz Light Oblique"; @@ -504,7 +506,7 @@ Adobe, it's generally better not to assign *font_unique_id*; let The same parameters can also be specified on the command line as follows: - 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 @@ -733,18 +735,18 @@ Node: Top628 Node: Introduction1166 Node: Requirements2998 Node: Installation4731 -Node: Usage6546 -Node: Restrictions8262 -Node: Font information10640 -Node: Parameters11998 -Node: Command-line equivalents15473 -Node: Default values16954 -Node: Parameter example19174 -Node: Additional command-line options21183 -Node: Custom font encodings23523 -Node: Restoring mfplain defaults26973 -Node: Future Work27832 -Node: Acknowledgments29696 +Node: Usage6545 +Node: Restrictions8449 +Node: Font information10827 +Node: Parameters12185 +Node: Command-line equivalents15660 +Node: Default values17141 +Node: Parameter example19361 +Node: Additional command-line options21370 +Node: Custom font encodings23710 +Node: Restoring mfplain defaults27160 +Node: Future Work28019 +Node: Acknowledgments29883  End Tag Table diff --git a/Master/texmf-dist/doc/support/mf2pt1/ChangeLog b/Master/texmf-dist/doc/support/mf2pt1/ChangeLog index fb3386307e0..a8e6d2d9105 100644 --- a/Master/texmf-dist/doc/support/mf2pt1/ChangeLog +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/mf2pt1/README b/Master/texmf-dist/doc/support/mf2pt1/README index 500b12ffa9b..0eb57ca8fcf 100644 --- a/Master/texmf-dist/doc/support/mf2pt1/README +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.pdf b/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.pdf index 5478597a475..a28895171a0 100644 Binary files a/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.pdf and b/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.pdf differ diff --git a/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.texi b/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.texi index 5b55575453b..9260689d18c 100644 --- a/Master/texmf-dist/doc/support/mf2pt1/mf2pt1.texi +++ b/Master/texmf-dist/doc/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 diff --git a/Master/texmf-dist/scripts/mf2pt1/mf2pt1.pl b/Master/texmf-dist/scripts/mf2pt1/mf2pt1.pl index 3546aee3931..a9ee8b74fc4 100755 --- a/Master/texmf-dist/scripts/mf2pt1/mf2pt1.pl +++ b/Master/texmf-dist/scripts/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) -- cgit v1.2.3