diff options
author | Karl Berry <karl@freefriends.org> | 2010-10-24 23:31:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-10-24 23:31:21 +0000 |
commit | d5a6a8d8af0b82fe3a52fa254c74de353c8d05d7 (patch) | |
tree | 4f41cc76b654ce451bc773f92e637689314f0fba /Master/texmf-dist/scripts/pkfix-helper | |
parent | 57c26fc870961733753e15f058db57f7738c0d46 (diff) |
pkfix-helper 1.3 (24oct10)
git-svn-id: svn://tug.org/texlive/trunk@20168 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/pkfix-helper')
-rwxr-xr-x | Master/texmf-dist/scripts/pkfix-helper/pkfix-helper | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/pkfix-helper/pkfix-helper b/Master/texmf-dist/scripts/pkfix-helper/pkfix-helper index 11c4ae7c103..26d56ede05a 100755 --- a/Master/texmf-dist/scripts/pkfix-helper/pkfix-helper +++ b/Master/texmf-dist/scripts/pkfix-helper/pkfix-helper @@ -17,8 +17,8 @@ use strict; # Define some global variables. my $progname = basename $0; # Name of this program -our $VERSION = "1.2"; # Version number of this program -my %name2chars; # Map from a font name to a character list +our $VERSION = "1.3"; # Version number of this program +my %name2chars; # Map from a font name to a character list my $GS = $ENV{"GS"} || "gs"; # Name of the Ghostscript interpreter my $TFTOPL = $ENV{"TFTOPL"} || "tftopl"; # Name of the TFM to PL converter my $dpi = 300; # Number of dots per inch used to generate bitmapped characters @@ -40,6 +40,7 @@ my $verbose = 1; # 0=quiet; 1=verbose output; 2=more verbose o my @forced_fonts; # Font mappings the user asserts are correct my @exclude_res; # Regexps for fonts to exclude my @extra_tfms; # Extra TFM files to use +my %retained_t3s; # Type 3 fonts to retain as is my $sample_file_ps; # Name of a PostScript file of font samples to write my $sample_file_tex; # Name of a TeX file of font samples to write my $single_font_use = 0; # 1=one use per font; 0=allow repetitions @@ -73,7 +74,7 @@ sub read_tfm_cache_file my %widths = @fields; $tfmfontwidth{$tfm} = \%widths; } - $numlines++; + $numlines++; } close CACHEFILE; print STDERR "done ($numlines entries).\n" if $verbose; @@ -182,6 +183,7 @@ sub optimal_scale ($$) $doc_dot_tfm += $docwidth * $tfmwidth; $tfm_dot_tfm += $tfmwidth**2; } + return 1.0 if $tfm_dot_tfm == 0.0; # TFM characters all have zero width. return $doc_dot_tfm / $tfm_dot_tfm; } @@ -209,6 +211,7 @@ sub compare_maps ($$;$) sub write_comments ($$) { my ($fontname, $fontdef) = @_; + return $fontdef if !defined $fontmatch{$fontname}; # Font should not be substituted my $tfm = $fontmatch{$fontname}->{"tfm"}; my $scale = $fontmatch{$fontname}->{"scale"}; my $origsize = $tfm2size{$tfm}; @@ -316,10 +319,11 @@ Getopt::Long::Configure ("bundling"); GetOptions ("h|help" => \$wanthelp, "v|verbose+" => \$verbose, "V|version" => \$wantversion, - "q|quiet" => sub {$verbose=0}, + "q|quiet" => sub {$verbose = 0}, "f|force=s" => \@forced_fonts, "i|include=s" => \@extra_tfms, "x|exclude=s" => \@exclude_res, + "k|keep=s" => sub {$retained_t3s{$_[1]} = 1}, "t|tex=s" => \$sample_file_tex, "p|ps=s" => \$sample_file_ps, "s|spp=i" => \$samples_per_page, @@ -618,6 +622,12 @@ foreach my $fontname (@sortedfontnames) { my @besttfms; # Best matching TFM file(s), sizes, and scales my $bestmatch = 10**9; # Best matching value + # Don't substitute the font if we were told not to. + if (defined $retained_t3s{$fontname}) { + print STDERR " Retaining $fontname as a bitmapped font.\n" if $verbose == 1; + next; + } + # Determine the list of eligible fonts to compare against. my @eligible_tfms; foreach my $tfminfo ($fontmatch{$fontname} || @tfmlist) { @@ -945,6 +955,7 @@ pkfix-helper [B<--cache>=I<filename>] [B<--include>=I<fontspec>] [B<--exclude>=I<regexp>] +[B<--keep>=I<fontspec>] [B<--quiet>] [B<--no-repeats>] [B<--spp>=I<number>] @@ -1099,6 +1110,17 @@ Remove all font specifications matching regular expression I<regexp> from B<pkfix-helper>'s list of known fonts. The B<--exclude> option can be specified repeatedly on the command line. +=item B<-k> I<fontspec>, B<--keep>=I<fontspec> + +Do not substitute a vector font for bitmapped font I<fontspec> (C<Fa>, +C<Fb>, etc.). This is useful when converting documents that use +obscure bitmapped fonts for which there is no vector equivalent. For +example, it was somewhat common in the past to include graphics such +as university or corporate logos into a document by converting the +bitmapped image into a single-character font and using that font in +LaTeX. B<--keep> prevents such fonts from being replaced. The +B<--keep> option can be specified repeatedly on the command line. + =item B<-q>, B<--quiet> Instruct B<pkfix-helper> to produce no output during its run except @@ -1154,7 +1176,7 @@ In its simplest form, B<pkfix-helper> takes the name of an input file file but serve as suitable input for B<pkfix>: $ pkfix-helper oldfile.ps pkfix-oldfile.ps - Reading netpipe.ps ... done. + Reading oldfile.ps ... done. Number of Type 3 fonts encountered: 10 Bitmapped fonts are typeset at 600 DPI. Finding character widths ... done. @@ -1226,7 +1248,7 @@ program to automatically detect an optimal scaling factor, even if doing so means choosing a highly nonstandard font size: $ pkfix-helper oldfile.ps pkfix-oldfile.ps --force="Ff=cmb12 @ *" - Reading netpipe.ps ... done. + Reading oldfile.ps ... done. Number of Type 3 fonts encountered: 10 Bitmapped fonts are typeset at 600 DPI. Finding character widths ... done. @@ -1237,7 +1259,7 @@ Oops, it looks like we don't have a F<cmb12.tfm> file on our system. Let's try scaling up F<cmb10.tfm> instead: $ pkfix-helper oldfile.ps pkfix-oldfile.ps --force="Ff=cmb10 @ *" - Reading netpipe.ps ... done. + Reading oldfile.ps ... done. Number of Type 3 fonts encountered: 10 Bitmapped fonts are typeset at 600 DPI. Finding character widths ... done. @@ -1310,8 +1332,8 @@ generally needed to guide B<pkfix-helper>'s font-matching procedures. =head1 NOTES Files produced using the B<--tex> option are Plain TeX files and -therefore must be compiled with F<tex> (or a variation such F<etex>, -F<pdftex>, F<pdfetex>, etc.), I<not> with F<latex>. +therefore must be compiled with F<tex> (or a variation such as +F<pdftex>, F<luatex>, etc.), I<not> with F<latex>. =head1 SEE ALSO @@ -1330,7 +1352,7 @@ Scott Pakin, I<scott+pkfh@pakin.org> =head1 COPYRIGHT AND LICENSE -Copyright (C) 2009, Scott Pakin +Copyright (C) 2010, Scott Pakin This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license |