summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/fontools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-23 20:56:57 +0000
committerKarl Berry <karl@freefriends.org>2019-05-23 20:56:57 +0000
commit13c26861f5d3a197cd2593f569b4c0da5909a1af (patch)
treeb32a4d1f074fe7b0e10da44df327daa23293129d /Master/texmf-dist/scripts/fontools
parent8677bbdef11fcc17cdbc065587f330cb86681493 (diff)
fontools (23may19)
git-svn-id: svn://tug.org/texlive/trunk@51204 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/fontools')
-rwxr-xr-xMaster/texmf-dist/scripts/fontools/afm2afm51
-rwxr-xr-xMaster/texmf-dist/scripts/fontools/autoinst119
-rwxr-xr-xMaster/texmf-dist/scripts/fontools/ot2kpx36
3 files changed, 136 insertions, 70 deletions
diff --git a/Master/texmf-dist/scripts/fontools/afm2afm b/Master/texmf-dist/scripts/fontools/afm2afm
index 997e195d7f4..d4b4980edec 100755
--- a/Master/texmf-dist/scripts/fontools/afm2afm
+++ b/Master/texmf-dist/scripts/fontools/afm2afm
@@ -4,7 +4,7 @@
----------------------------------------------------------------------------
- Copyright (C) 2005-2013 Marc Penninga.
+ Copyright (C) 2005-2019 Marc Penninga.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -37,6 +37,8 @@ use File::Basename;
use Getopt::Long;
use Pod::Usage;
+my $VERSION = "20190522";
+
parse_commandline();
my $afm = read_afm($ARGV[0]);
@@ -72,7 +74,8 @@ print_mapentry($afm->{fontinfo}, , $enc->{scheme})
#-----------------------------------------------------------------------
sub parse_commandline {
Getopt::Long::GetOptions(
- 'help|?' => sub { pod2usage(-verbose => 1) },
+ 'help|?' => sub { pod2usage(-verbose => 1) },
+ 'version' => sub { print "$VERSION\n"; exit; },
'encoding=s' => \$ARGV{encoding},
'kpx=s' => \$ARGV{kpx},
'output=s' => \$ARGV{output},
@@ -123,14 +126,14 @@ sub read_kpx {
my ($filename, $kpx) = @_;
open my $kpxfile, '<', $filename
or die "[ERROR] can't open '$filename': $!";
-
+
my %seen = map { ($_ => 1) } @$kpx;
for (<$kpxfile>) {
if (m/\A\s* KPX \s/xms) { push @$kpx, $_ unless $seen{$_}++ }
}
-
+
close $kpxfile;
-
+
return $kpx;
}
@@ -317,6 +320,7 @@ afm2afm - reencode an F<afm> file
=item B<afm2afm>
[B<-help>]
+[B<-version>]
[B<-encoding> I<encodingfile>]
[B<-kpx> I<kpxfile>]
[B<-output> I<outputfile>]
@@ -334,8 +338,8 @@ chosen encoding are excluded from the output, which resuls in
(potentially much) smaller files.
Additional kerning pairs can be added to the output file.
-If you don't specify an encoding file,
-the F<afm> file isn't re-encoded;
+If you don't specify an encoding file,
+the F<afm> file isn't re-encoded;
however, all unused (unencoded) data is still pruned.
The program also generates an entry for a F<dvips>-style map file,
@@ -352,6 +356,10 @@ the output was written to file
Print a short description of the syntax
+=item B<-version>
+
+Print version number and exit
+
=item B<-encoding> I<encodingfile>
Re-encode to the enconding in I<encodingfile>
@@ -359,14 +367,14 @@ Re-encode to the enconding in I<encodingfile>
=item B<-kpx> I<kpxfile>
Read additional kerning pairs from I<kpxfile> and add these to the output.
-This option cannot be used to override values from the input F<afm> file,
+This option cannot be used to override values from the input F<afm> file,
since B<afm2afm> will write both old and new values to the output!
The I<kpxfile> should contain kerning data in standard F<afm> format,
i.e. for each kerning pair there should be a line
KPX <left_glyph> <right_glyph> <amount>
-
+
All other lines in the I<kpxfile> are ignored.
=item B<-output> I<outputfile>
@@ -390,7 +398,7 @@ Marc Penninga <marcpenninga@gmail.com>
=head1 COPYRIGHT
-Copyright (C) 2005-2013 Marc Penninga.
+Copyright (C) 2005-2019 Marc Penninga.
=head1 LICENSE
@@ -411,12 +419,28 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
+=head1 VERSION
+
+This document describes B<afm2afm> version 20190522.
+
+
=head1 RECENT CHANGES
(See the source code for the rest of the story.)
=over 12
+=item I<2019-05-20>
+
+Added the I<-version> option.
+
+=back
+
+
+=begin Really_old_history
+
+=over 12
+
=item I<2013-08-07>
Added the I<-kpx> command-line option.
@@ -428,13 +452,6 @@ to avoid warnings about experimental features in Perl 5.18 and later.
Refactored the code; added the "no re-encoding, only pruning"
functionality.
-=back
-
-
-=begin Really_old_history
-
-=over 12
-
=item I<2005-01-10>
First version
diff --git a/Master/texmf-dist/scripts/fontools/autoinst b/Master/texmf-dist/scripts/fontools/autoinst
index d01043cc8ee..acface7bfed 100755
--- a/Master/texmf-dist/scripts/fontools/autoinst
+++ b/Master/texmf-dist/scripts/fontools/autoinst
@@ -40,6 +40,8 @@ use Getopt::Long ();
use Pod::Usage ();
use POSIX ();
+my $VERSION = '20190522';
+
my ($d, $m, $y) = (localtime time)[3 .. 5];
my $TODAY = sprintf "%04d/%02d/%02d", $y + 1900, $m + 1, $d;
@@ -716,7 +718,7 @@ sub create_logfile {
############################################################################
-@{[ POSIX::strftime("[%F %T]", localtime time) ]} $0
+@{[ POSIX::strftime("[%F %T]", localtime time) ]} $0, version $VERSION
"$ARGV{cmdline}"
@@ -775,7 +777,7 @@ END_ARGUMENTS
}
printf {$LOG} "\n";
- return if $ARGV{verbose} < 1;
+ return if $ARGV{Verbose} < 1;
my ($prevfn, $prevsty, $prevenc) = ('') x 3;
my @cmds;
@@ -818,7 +820,7 @@ END_FONTINFO
push @cmds, $item->{cmdline};
}
- return if $ARGV{verbose} < 2;
+ return if $ARGV{Verbose} < 2;
print {$LOG} join "\n\n", @cmds;
print {$LOG} "\n";
close $LOG;
@@ -986,8 +988,9 @@ Possible options:
-doc Print the complete documentation and exit
-dryrun Don't generate fonts, only log what would be done
-logfile="FILE" Write log data to "FILE" (default: <fontfamily>.log)
- -verbose Print more data to log file
+ -Verbose Print more data to log file
(repeat for even higher verbosity)
+ -version Print version number and exit
font[s] The fonts (.otf or .ttf format) to install.
Please report any bugs or suggestions to <marcpenninga@gmail.com>.
@@ -1023,7 +1026,7 @@ END_USAGE
figurekern => '1', # 0 = no, 1 = yes
mergewidths => '1', # 0 = no, 1 = yes
mergesmallcaps => '1', # 0 = no, 1 = yes
- verbose => 0,
+ Verbose => 0,
);
#-----------------------------------------------------------------------
@@ -1034,7 +1037,8 @@ sub parse_options {
Getopt::Long::GetOptions(
'help|?' => sub { print $USAGE; exit; },
- 'doc' => sub { Pod::Usage::pod2usage(-verbose => 2); },
+ 'version' => sub { print "$VERSION\n"; exit; },
+ 'doc' => sub { Pod::Usage::pod2usage(-Verbose => 2); },
'encoding=s' => \$ARGV{encoding},
'ts1!' => \$ARGV{textcomp},
'lining!' => \$ARGV{lining},
@@ -1067,7 +1071,7 @@ sub parse_options {
'mergewidths!' => \$ARGV{mergewidths},
'mergesmallcaps!' => \$ARGV{mergesmallcaps},
'logfile=s' => \$ARGV{logfile},
- 'verbose+' => \$ARGV{verbose},
+ 'Verbose+' => \$ARGV{Verbose},
'nfssweight=s%' => sub {
my ( $ignored, $key, $values ) = @_;
my @values = split m/,/, lc $values;
@@ -1670,6 +1674,12 @@ END_STY_XKEYVAL
"\\DeclareOptionX{proportional}{\\edef\\$fam\@figurealign{}}\n";
}
+ print {$STY} <<"END_STY_MAINFONT";
+\\DeclareOptionX{mainfont}{
+ \\renewcommand{\\familydefault}{\\$ARGV{nfss}default}
+}
+END_STY_MAINFONT
+
my $defaults
= $seen{OsF} ? 'oldstyle,proportional'
: $seen{TOsF} ? 'oldstyle,tabular'
@@ -1706,7 +1716,6 @@ END_STY_XKEYVAL
\\renewcommand*
{\\$ARGV{nfss}default}
{$fam-\\$fam\@figurealign\\$fam\@figurestyle}
-\\renewcommand*{\\familydefault}{\\$ARGV{nfss}default}
\\endinput
END_STYLE_REST
@@ -1756,7 +1765,9 @@ sub write_fdfile {
\\edef\\${fam}\@\@scale{s*[\\csname ${fam}\@scale\\endcsname]}%
\\fi
-\\DeclareFontFamily{${enc}}{${fam}-${sty}}{}
+\\DeclareFontFamily{${enc}}{${fam}-${sty}}{@{[
+ $ARGV{nfss} eq 'tt' ? '\hyphenchar\font=-1' : ""
+]}}
END_FD_HEADER
@@ -2027,7 +2038,7 @@ but this choice can be overridden by the user;
see the I<-logfile> command-line option in L</"COMMAND-LINE OPTIONS"> below.
If this log file already exists, B<autoinst> will append its data to the end
rather than overwrite it.
-Use the I<-verbose> command-line option to ask for more detailed info.
+Use the I<-Verbose> command-line option to ask for more detailed info.
=head2 A note for MiKTeX users
@@ -2075,6 +2086,15 @@ This style file defines a number of options:
=over 4
+=item C<mainfont>
+
+Redefine C<\familydefault> to make this font the main font
+for the document.
+This is a no-op if the font is installed as a serif font;
+but if the font is installed as a sanserif or typewriter font,
+this option saves you from having to redefine C<\familydefault>
+yourself.
+
=item C<lining>, C<oldstyle>, C<tabular>, C<proportional>
Choose which figure style to use.
@@ -2162,20 +2182,6 @@ Other encodings can be chosen using the I<-encoding> option
=head2 NFSS codes
-I<< B<CAVEAT>: this functionality was almost completely rewritten
-in release 2019-03-14.
-Older versions tried to map all fonts directly to short NFSS codes,
-but often had to invent non-standard codes in order to deal with the
-many different weights and widths that occur in the wild.
-Such non-standard NFSS codes will no longer
-work for fonts installed with newer versions; for those you'll have to either
-use the long names or stick to the standard NFSS codes.
-(This change mainly concerns very light or very heavy weights
-and very condensed widths;
-for more moderate weights and widths,
-existing code will very probably continue to work.)
->>
-
LaTeX's New Font Selection System (NFSS)
identifies fonts by a combination of family,
series (the concatenation of weight and width), shape and size.
@@ -2254,18 +2260,26 @@ but B<-e> is ambiguous (it may mean either B<-encoding> or B<-extra>)).
=over 4
+=item B<-version>
+
+Print B<autoinst>'s version number and exit.
+
+=item B<-help>
+
+Print a (relatively) short help text and exit.
+
=item B<-dryrun>
Don't generate output; just parse input fonts and write
-a log file saying what it would have done.
+a log file saying what B<autoinst> would have done.
=item B<-logfile>=I<filename>
Write log data to F<filename> instead of the default F<< <fontfamily>.log >>.
-If the file already exist, B<autoinst> appends to it;
+If the file already exists, B<autoinst> appends to it;
it doesn't overwrite an existing file.
-=item B<-verbose>
+=item B<-Verbose> (I<note:> uppercase 'V'!)
Add more details to the log file. Repeat this option for even more info.
@@ -2290,13 +2304,19 @@ Control the creation of TS1-encoded fonts. The default is B<-ts1>
if the text encodings (see I<-encoding> above) include T1,
B<-nots1> otherwise.
-=item B<-serif>, B<-sanserif>, B<-typewriter>
+=item B<-serif> / B<-sanserif> / B<-typewriter>
Install the font as a serif, sanserif or typewriter font, respectively.
-This changes how you access the font in LaTeX: with C<\rmfamily>/C<\textrm>,
-C<\sffamily>/C<\textsf> or C<\ttfamily>/C<\texttt>.
-The generated style file redefines C<\familydefault>,
-so including it will still make this font the default text font.
+This changes how you access the font in LaTeX:
+with C<\rmfamily>/C<\textrm>, C<\sffamily>/C<\textsf>
+or C<\ttfamily>/C<\texttt>.
+
+Installing the font as a typewriter font will cause two further changes:
+it will - by default - turn off the use of f-ligatures
+(though this can be overridden with the I<-ligatures> option),
+and it will disable hyphenation for this font.
+This latter effect cannot be disabled in B<autoinst>;
+if you want typewriter text to be hyphenated, use the F<hyphenat> package.
=item B<-lining> / B<-nolining>
@@ -2344,7 +2364,7 @@ as inferiors or subscripts: "Subscripts" (OpenType feature "subs"),
This option allows the user to determine which of these styles B<autoinst>
should use for the inferior characters.
Alternatively, the value "auto" tells B<autoinst> to use the first value
-in the list "subs", "sinf" or "dnom" that is supported by the fonts.
+in "subs", "sinf" or "dnom" that is supported by the font.
The default value is "none".
I<< If you specify a style of inferiors that isn't present in the font,
@@ -2508,7 +2528,7 @@ Marc Penninga (F<marcpenninga@gmail.com>)
When sending a bug report, please give as much relevant information as possible;
this usually includes (but may not be limited to) the log file
-(please add the I<-verbose> command-line option, for extra info).
+(please add the I<-Verbose> command-line option, for extra info).
If you see any error messages, please include these I<verbatim>;
don't paraphase.
@@ -2536,6 +2556,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
+=head1 VERSION
+
+This document describes B<autoinst> version 20190522.
+
=head1 RECENT CHANGES
@@ -2543,6 +2567,13 @@ GNU General Public License for more details.
=over 12
+=item I<2019-05-22>
+
+Added the I<mainfont> option to the generated F<sty> files.
+Prevented hyphenation for typewriter fonts
+(added C<\hyphenchar\font=-1> to the C<\DeclareFontFamily> declarations).
+Added the I<-version> option, and renamed I<-verbose> to I<-Verbose>.
+
=item I<2019-05-17>
Changed the way the F<-ligatures> option works:
@@ -2594,8 +2625,6 @@ to tell B<autoinst> to use whatever inferior characters are available.
=item I<2019-03-14>
-(never released to CTAN)
-
Overhauled the mapping of fonts (more specifically of weights and widths;
the mapping of shapes didn't change) to NFSS codes.
Instead of inventing our own codes to deal with every possible weight
@@ -2605,20 +2634,20 @@ Then we add "ssub" rules to the F<fd> files to map the standard NFSS codes
to our fancy names (see the section B<NFSS codes>;
based on discussions with Frank Mittelbach and Bob Tennent).
-=item I<2018-08-10>
+=back
-Added encoding files for LGR and T2A/B/C to I<fontools>.
-=item I<2018-03-26>
+=begin Really_old_history
-Added the I<-(no)mergewidths> option; tried to improve the documentation.
+=over 12
-=back
+=item I<2018-08-10>
+Added encoding files for LGR and T2A/B/C to I<fontools>.
-=begin Really_old_history
+=item I<2018-03-26>
-=over 12
+Added the I<-(no)mergewidths> option; tried to improve the documentation.
=item I<2018-03-26>
@@ -2803,7 +2832,7 @@ Tweaked the font info parsing to work around a bug in the naming of
some FontFont fonts, where every font is in a family of its own.
Added the "scaled" option (including the loading of F<xkeyval>)
to the generated style file.
-Extended the output of the I<-verbose> option.
+Extended the output of the I<-Verbose> option.
=item I<2007-02-08>
@@ -2881,7 +2910,7 @@ changed the generated style
file to include an interface for the ornaments and to load Lehman's NFSS
extensions F<nfssext.sty> if this is installed; corrected the "fontname" codes
for OT1, T1, LY1 and user-specific encodings; extended the output generated by
-the I<-verbose> option; and rewrote and extended the documentation.
+the I<-Verbose> option; and rewrote and extended the documentation.
=item I<2005-06-16>
diff --git a/Master/texmf-dist/scripts/fontools/ot2kpx b/Master/texmf-dist/scripts/fontools/ot2kpx
index 8ce5d6a9aa7..e1548e8c9d1 100755
--- a/Master/texmf-dist/scripts/fontools/ot2kpx
+++ b/Master/texmf-dist/scripts/fontools/ot2kpx
@@ -38,6 +38,8 @@ use Getopt::Long ();
use List::Util @List::Util::EXPORT_OK;
use Pod::Usage;
+my $VERSION = "20190522";
+
our ($NUM_GLYPHS, $UNITS_PER_EM, %kern);
sub main {
@@ -47,6 +49,7 @@ sub main {
Getopt::Long::GetOptions(
'help|?' => sub { pod2usage(-verbose => 0); },
+ 'version' => sub { print "$VERSION\n"; exit; },
'doc' => sub { pod2usage(-verbose => 2); },
'afm' => sub { $ARGV{print_func} = \&print_kpx; },
'kpx' => sub { $ARGV{print_func} = \&print_kpx; },
@@ -750,6 +753,14 @@ or as a Luatex custom feature, for use with the C<\directlua> command.
=over 4
+=item B<-help>
+
+Print a short help text and exit.
+
+=item B<-version>
+
+Print B<ot2kpx>'s version and exit.
+
=item B<-afm>, B<-kpx>
Output the kerning data in Adobe's KPX format, as used in F<afm> files.
@@ -845,17 +856,33 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
+=head1 VERSION
+
+This document describes B<ot2kpx> version 20190522.
+
+
=head1 RECENT CHANGES
(See the source code for the rest of the story.)
=over 12
+=item I<2019-05-20>
+
+Added the I<-version> option.
+
=item I<2019-04-15>
-Added the -lua command-line option to get output in Luatex's
+Added the I<-lua> command-line option to get output in Luatex's
custom feature format.
+=back
+
+
+=begin Really_old_history
+
+=over 12
+
=item I<2013-08-07>
Replaced all C<given/when> constructions in the source code by C<if>'s,
@@ -866,13 +893,6 @@ to avoid warnings about experimental features in Perl 5.18 and later.
Refactored the code, and fixed a number of bugs in the process.
Updated the documentation.
-=back
-
-
-=begin Really_old_history
-
-=over 12
-
=item I<2005-01-10>
First version