summaryrefslogtreecommitdiff
path: root/Master/tlpkg/dev
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-08-24 14:49:15 +0000
committerNorbert Preining <preining@logic.at>2011-08-24 14:49:15 +0000
commit09644e0f6591eaca5573322d1d7caba0cbf36015 (patch)
tree388efd812e11c98ad1d96a3010c0d50a53a7cced /Master/tlpkg/dev
parent9e82db30ffdc8ecdc1ddb1085d686a34699832b8 (diff)
multi-updmap: many additions, actually generating files now
git-svn-id: svn://tug.org/texlive/trunk@23679 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/dev')
-rw-r--r--Master/tlpkg/dev/multi-updmap.pl632
1 files changed, 612 insertions, 20 deletions
diff --git a/Master/tlpkg/dev/multi-updmap.pl b/Master/tlpkg/dev/multi-updmap.pl
index 2d93452b621..fd41e98cb3d 100644
--- a/Master/tlpkg/dev/multi-updmap.pl
+++ b/Master/tlpkg/dev/multi-updmap.pl
@@ -13,6 +13,11 @@
# Anyone may freely use, modify, and/or distribute this file, without
# limitation.
#
+# TODO:
+# - implement missing functionality
+# - if a font is defined in two map files, warn and use the top one
+# DONE - ignore texmf/web2c/updmap.cfg
+# DONE - sort output by map name, not font name!
my ($TEXMFROOT, $TEXMFMAIN, $TEXMFVAR);
@@ -44,6 +49,7 @@ use Data::Dumper;
my %opts = ( quiet => 0, nohash => 0, nomkmap => 0 );
my $alldata;
+my $updLSR;
my @cmdline_options = (
"cnffile=s@",
@@ -103,8 +109,17 @@ sub main {
}
}
} else {
- @{$opts{'cnffile'}} = `kpsewhich -all updmap.cfg`;
- chomp(@{$opts{'cnffile'}});
+ my @all_files = `kpsewhich -all updmap.cfg`;
+ chomp(@all_files);
+ my @used_files;
+ for my $f (@all_files) {
+ if ($f =~ m!/texmf/web2c/updmap.cfg!) {
+ warning("Ignoring $f, it is only a sample file!\n");
+ } else {
+ push @used_files, $f;
+ }
+ }
+ @{$opts{'cnffile'}} = @used_files;
}
if ($opts{'listmaps'}) {
@@ -148,6 +163,9 @@ sub main {
exit 1;
}
+ $updLSR = &mktexupd();
+ $updLSR->{mustexist}(0);
+
if ($cmd && !$opts{'force'} && !$changed) {
print "$top_config_file unchanged. Map files not recreated.\n"
if !$opts{'quiet'};
@@ -160,24 +178,573 @@ sub main {
unlink ($bakFile) if (-r $bakFile);
}
- my $updLSR = &mktexupd();
- $updLSR->{mustexist}(0);
if (!$opts{'nohash'}) {
print "$prg: Updating ls-R files.\n" if !$opts{'quiet'};
$updLSR->{exec}();
}
}
+sub getFonts {
+ my @lines = ();
+ for my $m (@_) {
+ if (defined($alldata->{'maps'}{$m})) {
+ push @lines, "% $m";
+ for my $k (keys %{$alldata->{'maps'}{$m}{'fonts'}}) {
+ if (defined($alldata->{'maps'}{$m}{'fonts'}{$k})) {
+ push @lines, "$k " . $alldata->{'maps'}{$m}{'fonts'}{$k};
+ } else {
+ print "undefined fonts for $k in $m ?!?!?\n";
+ }
+ print LOG "$k\n";
+ }
+ }
+ }
+ chomp @lines;
+ return @lines;
+}
+
+###############################################################################
+# writeLines()
+# write the lines in $filename
+#
+sub writeLines {
+ my ($fname, @lines) = @_;
+ map { ($_ !~ m/\n$/ ? s/$/\n/ : $_ ) } @lines;
+ open FILE, ">$fname" or die "$prg: can't write lines to $fname: $!";
+ print FILE @lines;
+ close FILE;
+}
+
+###############################################################################
+# to_pdftex()
+# if $pdftexStripEnc is set, strip "PS_Encoding_Name ReEncodeFont"
+# from map entries; they are ignored by pdftex. But since the sh
+# incarnation of updmap included them, and we want to minimize
+# differences, this is not done by default.
+#
+sub to_pdftex {
+ my $pdftexStripEnc = 0;
+ return @_ unless $pdftexStripEnc;
+ my @in = @_;
+ my @out;
+ foreach my $line (@in) {
+ if ($line =~ /^(.*\s+)(\S+\s+ReEncodeFont\s)(.*)/) {
+ $line = "$1$3";
+ $line =~ s/\s+\"\s+\"\s+/ /;
+ }
+ push @out, $line;
+ }
+ return @out;
+}
+
+###############################################################################
+# setupSymlinks()
+# set symlink for psfonts.map according to dvipsPreferOutline variable
+#
+sub setupSymlinks {
+ my ($dvipsPreferOutline, $dvipsoutputdir, $pdftexDownloadBase14, $pdftexoutputdir) = @_;
+ my $src;
+ my %link;
+ my @link;
+
+ if ($dvipsPreferOutline) {
+ $src = "psfonts_t1.map";
+ } else {
+ $src = "psfonts_pk.map";
+ }
+ unlink "$dvipsoutputdir/psfonts.map";
+ push @link, &SymlinkOrCopy("$dvipsoutputdir", "$src", "psfonts.map");
+
+ if ($pdftexDownloadBase14) {
+ $src = "pdftex_dl14.map";
+ } else {
+ $src = "pdftex_ndl14.map";
+ }
+ unlink "$pdftexoutputdir/pdftex.map";
+ push @link, &SymlinkOrCopy("$pdftexoutputdir", "$src", "pdftex.map");
+ %link = @link;
+ return \%link;
+}
+
+###############################################################################
+# SymlinkOrCopy(dir, src, dest)
+# create symlinks if possible, otherwise copy files
+#
+sub SymlinkOrCopy {
+ my ($dir, $src, $dest) = @_;
+ if (&win32 || $opts{'copy'}) { # always copy
+ &copyFile("$dir/$src", "$dir/$dest");
+ } else { # symlink if supported by fs, copy otherwise
+ system("cd \"$dir\" && ln -s $src $dest 2>/dev/null || "
+ . "cp -p \"$dir/$src\" \"$dir/$dest\"");
+ }
+ # remember for "Files generated" in &mkMaps.
+ return ($src, $dest);
+}
+
+
+###############################################################################
+# transLW35(mode args ...)
+# transform fontname and filenames according to transformation specified
+# by mode. Possible values:
+# URW|URWkb|ADOBE|ADOBEkb
+#
+sub transLW35 {
+ my ($mode, @lines) = @_;
+
+ my @psADOBE = (
+ 's/ URWGothicL-Demi / AvantGarde-Demi /',
+ 's/ URWGothicL-DemiObli / AvantGarde-DemiOblique /',
+ 's/ URWGothicL-Book / AvantGarde-Book /',
+ 's/ URWGothicL-BookObli / AvantGarde-BookOblique /',
+ 's/ URWBookmanL-DemiBold / Bookman-Demi /',
+ 's/ URWBookmanL-DemiBoldItal / Bookman-DemiItalic /',
+ 's/ URWBookmanL-Ligh / Bookman-Light /',
+ 's/ URWBookmanL-LighItal / Bookman-LightItalic /',
+ 's/ NimbusMonL-Bold / Courier-Bold /',
+ 's/ NimbusMonL-BoldObli / Courier-BoldOblique /',
+ 's/ NimbusMonL-Regu / Courier /',
+ 's/ NimbusMonL-ReguObli / Courier-Oblique /',
+ 's/ NimbusSanL-Bold / Helvetica-Bold /',
+ 's/ NimbusSanL-BoldCond / Helvetica-Narrow-Bold /',
+ 's/ NimbusSanL-BoldItal / Helvetica-BoldOblique /',
+ 's/ NimbusSanL-BoldCondItal / Helvetica-Narrow-BoldOblique /',
+ 's/ NimbusSanL-Regu / Helvetica /',
+ 's/ NimbusSanL-ReguCond / Helvetica-Narrow /',
+ 's/ NimbusSanL-ReguItal / Helvetica-Oblique /',
+ 's/ NimbusSanL-ReguCondItal / Helvetica-Narrow-Oblique /',
+ 's/ CenturySchL-Bold / NewCenturySchlbk-Bold /',
+ 's/ CenturySchL-BoldItal / NewCenturySchlbk-BoldItalic /',
+ 's/ CenturySchL-Roma / NewCenturySchlbk-Roman /',
+ 's/ CenturySchL-Ital / NewCenturySchlbk-Italic /',
+ 's/ URWPalladioL-Bold / Palatino-Bold /',
+ 's/ URWPalladioL-BoldItal / Palatino-BoldItalic /',
+ 's/ URWPalladioL-Roma / Palatino-Roman /',
+ 's/ URWPalladioL-Ital / Palatino-Italic /',
+ 's/ StandardSymL / Symbol /',
+ 's/ NimbusRomNo9L-Medi / Times-Bold /',
+ 's/ NimbusRomNo9L-MediItal / Times-BoldItalic /',
+ 's/ NimbusRomNo9L-Regu / Times-Roman /',
+ 's/ NimbusRomNo9L-ReguItal / Times-Italic /',
+ 's/ URWChanceryL-MediItal / ZapfChancery-MediumItalic /',
+ 's/ Dingbats / ZapfDingbats /',
+ );
+
+ my @fileADOBEkb = (
+ 's/\buagd8a.pfb\b/pagd8a.pfb/',
+ 's/\buagdo8a.pfb\b/pagdo8a.pfb/',
+ 's/\buagk8a.pfb\b/pagk8a.pfb/',
+ 's/\buagko8a.pfb\b/pagko8a.pfb/',
+ 's/\bubkd8a.pfb\b/pbkd8a.pfb/',
+ 's/\bubkdi8a.pfb\b/pbkdi8a.pfb/',
+ 's/\bubkl8a.pfb\b/pbkl8a.pfb/',
+ 's/\bubkli8a.pfb\b/pbkli8a.pfb/',
+ 's/\bucrb8a.pfb\b/pcrb8a.pfb/',
+ 's/\bucrbo8a.pfb\b/pcrbo8a.pfb/',
+ 's/\bucrr8a.pfb\b/pcrr8a.pfb/',
+ 's/\bucrro8a.pfb\b/pcrro8a.pfb/',
+ 's/\buhvb8a.pfb\b/phvb8a.pfb/',
+ 's/\buhvb8ac.pfb\b/phvb8an.pfb/',
+ 's/\buhvbo8a.pfb\b/phvbo8a.pfb/',
+ 's/\buhvbo8ac.pfb\b/phvbo8an.pfb/',
+ 's/\buhvr8a.pfb\b/phvr8a.pfb/',
+ 's/\buhvr8ac.pfb\b/phvr8an.pfb/',
+ 's/\buhvro8a.pfb\b/phvro8a.pfb/',
+ 's/\buhvro8ac.pfb\b/phvro8an.pfb/',
+ 's/\buncb8a.pfb\b/pncb8a.pfb/',
+ 's/\buncbi8a.pfb\b/pncbi8a.pfb/',
+ 's/\buncr8a.pfb\b/pncr8a.pfb/',
+ 's/\buncri8a.pfb\b/pncri8a.pfb/',
+ 's/\buplb8a.pfb\b/pplb8a.pfb/',
+ 's/\buplbi8a.pfb\b/pplbi8a.pfb/',
+ 's/\buplr8a.pfb\b/pplr8a.pfb/',
+ 's/\buplri8a.pfb\b/pplri8a.pfb/',
+ 's/\busyr.pfb\b/psyr.pfb/',
+ 's/\butmb8a.pfb\b/ptmb8a.pfb/',
+ 's/\butmbi8a.pfb\b/ptmbi8a.pfb/',
+ 's/\butmr8a.pfb\b/ptmr8a.pfb/',
+ 's/\butmri8a.pfb\b/ptmri8a.pfb/',
+ 's/\buzcmi8a.pfb\b/pzcmi8a.pfb/',
+ 's/\buzdr.pfb\b/pzdr.pfb/',
+ );
+
+ my @fileURW = (
+ 's/\buagd8a.pfb\b/a010015l.pfb/',
+ 's/\buagdo8a.pfb\b/a010035l.pfb/',
+ 's/\buagk8a.pfb\b/a010013l.pfb/',
+ 's/\buagko8a.pfb\b/a010033l.pfb/',
+ 's/\bubkd8a.pfb\b/b018015l.pfb/',
+ 's/\bubkdi8a.pfb\b/b018035l.pfb/',
+ 's/\bubkl8a.pfb\b/b018012l.pfb/',
+ 's/\bubkli8a.pfb\b/b018032l.pfb/',
+ 's/\bucrb8a.pfb\b/n022004l.pfb/',
+ 's/\bucrbo8a.pfb\b/n022024l.pfb/',
+ 's/\bucrr8a.pfb\b/n022003l.pfb/',
+ 's/\bucrro8a.pfb\b/n022023l.pfb/',
+ 's/\buhvb8a.pfb\b/n019004l.pfb/',
+ 's/\buhvb8ac.pfb\b/n019044l.pfb/',
+ 's/\buhvbo8a.pfb\b/n019024l.pfb/',
+ 's/\buhvbo8ac.pfb\b/n019064l.pfb/',
+ 's/\buhvr8a.pfb\b/n019003l.pfb/',
+ 's/\buhvr8ac.pfb\b/n019043l.pfb/',
+ 's/\buhvro8a.pfb\b/n019023l.pfb/',
+ 's/\buhvro8ac.pfb\b/n019063l.pfb/',
+ 's/\buncb8a.pfb\b/c059016l.pfb/',
+ 's/\buncbi8a.pfb\b/c059036l.pfb/',
+ 's/\buncr8a.pfb\b/c059013l.pfb/',
+ 's/\buncri8a.pfb\b/c059033l.pfb/',
+ 's/\buplb8a.pfb\b/p052004l.pfb/',
+ 's/\buplbi8a.pfb\b/p052024l.pfb/',
+ 's/\buplr8a.pfb\b/p052003l.pfb/',
+ 's/\buplri8a.pfb\b/p052023l.pfb/',
+ 's/\busyr.pfb\b/s050000l.pfb/',
+ 's/\butmb8a.pfb\b/n021004l.pfb/',
+ 's/\butmbi8a.pfb\b/n021024l.pfb/',
+ 's/\butmr8a.pfb\b/n021003l.pfb/',
+ 's/\butmri8a.pfb\b/n021023l.pfb/',
+ 's/\buzcmi8a.pfb\b/z003034l.pfb/',
+ 's/\buzdr.pfb\b/d050000l.pfb/',
+ );
+
+ my @fileADOBE = (
+ 's/\buagd8a.pfb\b/agd_____.pfb/',
+ 's/\buagdo8a.pfb\b/agdo____.pfb/',
+ 's/\buagk8a.pfb\b/agw_____.pfb/',
+ 's/\buagko8a.pfb\b/agwo____.pfb/',
+ 's/\bubkd8a.pfb\b/bkd_____.pfb/',
+ 's/\bubkdi8a.pfb\b/bkdi____.pfb/',
+ 's/\bubkl8a.pfb\b/bkl_____.pfb/',
+ 's/\bubkli8a.pfb\b/bkli____.pfb/',
+ 's/\bucrb8a.pfb\b/cob_____.pfb/',
+ 's/\bucrbo8a.pfb\b/cobo____.pfb/',
+ 's/\bucrr8a.pfb\b/com_____.pfb/',
+ 's/\bucrro8a.pfb\b/coo_____.pfb/',
+ 's/\buhvb8a.pfb\b/hvb_____.pfb/',
+ 's/\buhvb8ac.pfb\b/hvnb____.pfb/',
+ 's/\buhvbo8a.pfb\b/hvbo____.pfb/',
+ 's/\buhvbo8ac.pfb\b/hvnbo___.pfb/',
+ 's/\buhvr8a.pfb\b/hv______.pfb/',
+ 's/\buhvr8ac.pfb\b/hvn_____.pfb/',
+ 's/\buhvro8a.pfb\b/hvo_____.pfb/',
+ 's/\buhvro8ac.pfb\b/hvno____.pfb/',
+ 's/\buncb8a.pfb\b/ncb_____.pfb/',
+ 's/\buncbi8a.pfb\b/ncbi____.pfb/',
+ 's/\buncr8a.pfb\b/ncr_____.pfb/',
+ 's/\buncri8a.pfb\b/nci_____.pfb/',
+ 's/\buplb8a.pfb\b/pob_____.pfb/',
+ 's/\buplbi8a.pfb\b/pobi____.pfb/',
+ 's/\buplr8a.pfb\b/por_____.pfb/',
+ 's/\buplri8a.pfb\b/poi_____.pfb/',
+ 's/\busyr.pfb\b/sy______.pfb/',
+ 's/\butmb8a.pfb\b/tib_____.pfb/',
+ 's/\butmbi8a.pfb\b/tibi____.pfb/',
+ 's/\butmr8a.pfb\b/tir_____.pfb/',
+ 's/\butmri8a.pfb\b/tii_____.pfb/',
+ 's/\buzcmi8a.pfb\b/zcmi____.pfb/',
+ 's/\buzdr.pfb\b/zd______.pfb/',
+ );
+
+ if ($mode eq "" || $mode eq "URWkb") {
+ # do nothing
+ } elsif ($mode eq "URW") {
+ for my $r (@fileURW) {
+ map { eval($r); } @lines;
+ }
+ } elsif ($mode eq "ADOBE" || $mode eq "ADOBEkb") {
+ for my $r (@psADOBE) {
+ map { eval($r); } @lines;
+ }
+ my @filemode = eval ("\@file" . $mode);
+ for my $r (@filemode) {
+ map { eval($r); } @lines;
+ }
+ }
+ return @lines;
+}
+
sub mkMaps {
- warning("NOT IMPLEMENTED mkMaps ... dumping data structure for now!\n");
+ my $logfile;
+
$Data::Dumper::Indent = 1;
- read_updmap_files(@{$opts{'cnffile'}});
read_map_files();
merge_data();
- print Data::Dumper->Dump([$alldata], [qw(mapdata)]);
+
+
+ if (! $opts{'dry-run'}) {
+ $logfile = "$TEXMFVAR/web2c/updmap.log";
+ mkdirhier "$TEXMFVAR/web2c";
+print "logfile = $logfile\n";
+ open LOG, ">$logfile"
+ or die "$prg: Can't open log file \"$logfile\": $!";
+ print LOG &version();
+ printf LOG "%s\n\n", scalar localtime();
+ print LOG "Using the following config files:\n";
+ for (@{$opts{'cnffile'}}) {
+ print LOG " $_\n";
+ }
+ }
+ sub wlog () {
+ my $str=shift;
+ if ($opts{'dry-run'}) {
+ print $str;
+ } else {
+ print $str if !$opts{'quiet'};
+ print LOG $str;
+ }
+ }
+ sub newline() {
+ if ($opts{'dry-run'}) {
+ print "\n";
+ } else {
+ print LOG "\n";
+ }
+ }
+
+ my ($mode, $mode_origin, $dvipsPreferOutline, $dvipsPreferOutline_origin,
+ $dvipsDownloadBase35, $dvipsDownloadBase35_origin,
+ $pdftexDownloadBase14, $pdftexDownloadBase14_origin);
+ if (defined($alldata->{'merged'}{'setting'}{'LW35'}{'val'})) {
+ $mode = $alldata->{'merged'}{'setting'}{'LW35'}{'val'};
+ $mode_origin = $alldata->{'merged'}{'setting'}{'LW35'}{'origin'};
+ } else {
+ $mode = "URWkb";
+ $mode_origin = "default";
+ }
+ if (defined($alldata->{'merged'}{'setting'}{'dvipsPreferOutline'})) {
+ $dvipsPreferOutline = $alldata->{'merged'}{'setting'}{'dvipsPreferOutline'}{'val'};
+ $dvipsPreferOutline_origin = $alldata->{'merged'}{'setting'}{'dvipsPreferOutline'}{'origin'};
+ } else {
+ $dvipsPreferOutline = 1;
+ $dvipsPreferOutline_origin = "default";
+ }
+ if (defined($alldata->{'merged'}{'setting'}{'dvipsDownloadBase35'})) {
+ $dvipsDownloadBase35 = $alldata->{'merged'}{'setting'}{'dvipsDownloadBase35'}{'val'};
+ $dvipsDownloadBase35_origin = $alldata->{'merged'}{'setting'}{'dvipsDownloadBase35'}{'origin'};
+ } else {
+ $dvipsDownloadBase35 = 1;
+ $dvipsDownloadBase35_origin = "default";
+ }
+ if (defined($alldata->{'merged'}{'setting'}{'pdftexDownloadBase14'})) {
+ $pdftexDownloadBase14 = $alldata->{'merged'}{'setting'}{'pdftexDownloadBase14'}{'val'};
+ $pdftexDownloadBase14_origin = $alldata->{'merged'}{'setting'}{'pdftexDownloadBase14'}{'origin'};
+ } else {
+ $pdftexDownloadBase14 = 1;
+ $pdftexDownloadBase14_origin = "default";
+ }
+
+ &wlog ("\n$0 "
+ . ($opts{'dry-run'} ? "would create" : "is creating") . " new map files"
+ . "\nusing the following configuration:"
+ . "\n LW35 font names : "
+ . "$mode ($mode_origin)"
+ . "\n prefer outlines : "
+ . "$dvipsPreferOutline ($dvipsPreferOutline_origin)"
+ . "\n texhash enabled : "
+ . ($opts{'nohash'} ? "false" : "true")
+ . "\n download standard fonts (dvips) : "
+ . "$dvipsDownloadBase35 ($dvipsDownloadBase35_origin)"
+ . "\n download standard fonts (pdftex) : "
+ . "$pdftexDownloadBase14 ($pdftexDownloadBase14_origin)"
+ . "\n\n");
+
+ &wlog ("Scanning for LW35 support files");
+ my $dvips35 = $alldata->{'maps'}{"dvips35.map"}{'fullpath'};
+ my $pdftex35 = $alldata->{'maps'}{"pdftex35.map"}{'fullpath'};
+ my $ps2pk35 = $alldata->{'maps'}{"ps2pk35.map"}{'fullpath'};
+ my $LW35 = "\n$dvips35\n$pdftex35\n$ps2pk35\n\n";
+ if ($opts{'dry-run'}) {
+ print $LW35;
+ } else {
+ print LOG $LW35;
+ }
+ printf " [%3d files]\n", 3 unless ($opts{'quiet'} || $opts{'dry-run'});
+
+ &wlog ("Scanning for MixedMap entries");
+ &newline;
+
+ my @mixedmaps;
+ my @notmixedmaps;
+ for my $m (keys %{$alldata->{'maps'}}) {
+ my $origin = $alldata->{'maps'}{$m}{'origin'};
+ next if !defined($origin);
+ next if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'status'} eq "disabled");
+ push @mixedmaps, $m
+ if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "MixedMap");
+ push @notmixedmaps, $m
+ if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "Map");
+ }
+
+ @mixedmaps = sort @mixedmaps;
+ @notmixedmaps = sort @notmixedmaps;
+
+ foreach my $line (sort @mixedmaps) {
+ if ($opts{'dry-run'}) {
+ print "$line\n";
+ } else {
+ print LOG "$line\n";
+ }
+ }
+ &newline;
+ printf " [%3d files]\n", scalar @mixedmaps
+ unless ($opts{'quiet'} || $opts{'dry-run'});
+
+ &wlog ("Scanning for Map entries");
+ &newline();
+ foreach my $line (@notmixedmaps) {
+ if ($opts{'dry-run'}) {
+ print "$line\n";
+ } else {
+ print LOG "$line\n";
+ }
+ }
+ &newline;
+ printf " [%3d files]\n\n", scalar @notmixedmaps
+ unless ($opts{'quiet'} || $opts{'dry-run'});
+
+ # TODO: NOT REALLY!!! for now!!
+ #exit (0) if ($opts{'dry-run'});
+ warn("WE SHOULD EXIT HERE IN DRY RUN MODE!") if ($opts{'dry-run'});
+
+ # Create psfonts_t1.map, psfonts_pk.map, ps2pk.map and pdftex.map:
+ my $dvipsoutputdir = $opts{'dvipsoutputdir'};
+ my $pdftexoutputdir = $opts{'pdftexoutputdir'};
+ for my $file ("$dvipsoutputdir/download35.map",
+ "$dvipsoutputdir/builtin35.map",
+ "$dvipsoutputdir/psfonts_t1.map",
+ "$dvipsoutputdir/psfonts_pk.map",
+ "$pdftexoutputdir/pdftex_dl14.map",
+ "$pdftexoutputdir/pdftex_ndl14.map",
+ "$dvipsoutputdir/ps2pk.map") {
+ open FILE, ">$file";
+ print FILE "% $file:\
+% maintained by updmap[-sys].\
+% Don't change this file directly. Use updmap[-sys] instead.\
+% See the updmap documentation.\
+% A log of the run that created this file is available here:\
+% $logfile\
+";
+ close FILE;
+ }
+
+ print "Generating output for ps2pk...\n" if !$opts{'quiet'};
+ my @ps2pk_fonts = sort keys %{$alldata->{'maps'}{"ps2pk35.map"}{'fonts'}};
+ my @ps2pk_map;
+ push @ps2pk_map, "% ps2pk35.map";
+ push @ps2pk_map, transLW35($mode, @ps2pk_fonts);
+ push @ps2pk_map, getFonts(@mixedmaps);
+ push @ps2pk_map, getFonts(@notmixedmaps);
+ &writeLines(">$dvipsoutputdir/ps2pk.map", @ps2pk_map);
+
+ print "Generating output for dvips...\n" if !$opts{'quiet'};
+ my @download35_map;
+ push @download35_map, "% ps2pk35.map";
+ push @download35_map, transLW35($mode, @ps2pk_fonts);
+ &writeLines(">$dvipsoutputdir/download35.map", @download35_map);
+
+ my @builtin35_map;
+ my @dvips35_fonts = sort keys %{$alldata->{'maps'}{"dvips35.map"}{'fonts'}};
+ push @builtin35_map, "% dvips35.map";
+ push @builtin35_map, transLW35($mode, @dvips35_fonts);
+ &writeLines(">$dvipsoutputdir/builtin35.map", @builtin35_map);
+
+ my @dftdvips_fonts = ($dvipsDownloadBase35 ? @ps2pk_fonts : @dvips35_fonts);
+
+ my @psfonts_t1_map;
+ if ($dvipsDownloadBase35) {
+ push @psfonts_t1_map, "% ps2pk35.map",
+ @dftdvips_fonts = @ps2pk_fonts;
+ } else {
+ push @psfonts_t1_map, "% dvips35.map";
+ @dftdvips_fonts = @dvips35_fonts;
+ }
+ push @psfonts_t1_map, transLW35($mode, @dftdvips_fonts);
+ push @psfonts_t1_map, getFonts(@mixedmaps);
+ push @psfonts_t1_map, getFonts(@notmixedmaps);
+ &writeLines(">$dvipsoutputdir/psfonts_t1.map", @psfonts_t1_map);
+
+ my @psfonts_pk_map;
+ push @psfonts_pk_map, transLW35($mode, @dftdvips_fonts);
+ push @psfonts_pk_map, getFonts(@notmixedmaps);
+ &writeLines(">$dvipsoutputdir/psfonts_pk.map", @psfonts_pk_map);
+
+ print "Generating output for pdftex...\n" if !$opts{'quiet'};
+ # remove PaintType due to Sebastian's request
+ my @pdftex35_fonts = sort keys %{$alldata->{'maps'}{"pdftex35.map"}{'fonts'}};
+ my @pdftexmaps_ndl = transLW35($mode, @pdftex35_fonts);
+ push @pdftexmaps_ndl, getFonts(@mixedmaps);
+ push @pdftexmaps_ndl, getFonts(@notmixedmaps);
+ @pdftexmaps_ndl = grep { $_ !~ m/(^%|PaintType)/ } @pdftexmaps_ndl;
+
+ my @pdftexmaps_dl = transLW35($mode, @ps2pk_fonts);
+ push @pdftexmaps_dl, getFonts(@mixedmaps);
+ push @pdftexmaps_dl, getFonts(@notmixedmaps);
+ @pdftexmaps_dl = grep { $_ !~ m/(^%|PaintType)/ } @pdftexmaps_dl;
+
+ my @pdftex_ndl14_map = @pdftexmaps_ndl;
+ @pdftex_ndl14_map = &to_pdftex(@pdftex_ndl14_map);
+ &writeLines(">$pdftexoutputdir/pdftex_ndl14.map", @pdftex_ndl14_map);
+
+ my @pdftex_dl14_map = @pdftexmaps_dl;
+ @pdftex_dl14_map = &to_pdftex(@pdftex_dl14_map);
+ &writeLines(">$pdftexoutputdir/pdftex_dl14.map", @pdftex_dl14_map);
+
+ my $link = &setupSymlinks($dvipsPreferOutline, $dvipsoutputdir, $pdftexDownloadBase14, $pdftexoutputdir);
+
+ &wlog ("\nFiles generated:\n");
+ sub dir {
+ my ($d, $f, $target)=@_;
+ our $link;
+ if (-e "$d/$f") {
+ my @stat=lstat("$d/$f");
+ my ($s,$m,$h,$D,$M,$Y)=localtime($stat[9]);
+ my $timestamp=sprintf ("%04d-%02d-%02d %02d:%02d:%02d",
+ $Y+1900, $M+1, $D, $h, $m, $s);
+ my $date=sprintf "%12d %s %s", $stat[7], $timestamp, $f;
+ &wlog ($date);
+
+ if (-l "$d/$f") {
+ my $lnk=sprintf " -> %s\n", readlink ("$d/$f");
+ &wlog ($lnk);
+ } elsif ($f eq $target) {
+ if (&files_are_identical("$d/$f", "$d/$link->{$target}")) {
+ &wlog (" = $link->{$target}\n");
+ } else {
+ &wlog (" = ?????\n"); # This shouldn't happen.
+ }
+ } else {
+ &wlog ("\n");
+ }
+ } else {
+ print STDERR "Warning: File $d/$f doesn't exist.\n";
+ print LOG "Warning: File $d/$f doesn't exist.\n";
+ }
+ }
+ my $d;
+ $d="$dvipsoutputdir"; &wlog (" $d:\n");
+ foreach my $f ('builtin35.map', 'download35.map', 'psfonts_pk.map',
+ 'psfonts_t1.map', 'ps2pk.map', 'psfonts.map') {
+ dir ($d, $f, 'psfonts.map');
+ $updLSR->{add}("$d/$f");
+ }
+ $d="$pdftexoutputdir"; &wlog (" $d:\n");
+ foreach my $f ('pdftex_dl14.map', 'pdftex_ndl14.map', 'pdftex.map') {
+ dir ($d, $f, 'pdftex.map');
+ $updLSR->{add}("$d/$f");
+ }
+ close LOG;
+ print "\nTranscript written on \"$logfile\".\n" if !$opts{'quiet'};
+
+ # warning("NOT IMPLEMENTED mkMaps ... dumping data structure for now!\n");
+ #print STDERR Data::Dumper->Dump([$alldata], [qw(mapdata)]);
}
+sub locateMap {
+ my $map = shift;
+ my $ret = `kpsewhich --format=map $map`;
+ chomp($ret);
+ return $ret;
+}
sub processOptions {
# first process the stupid setoption= s@{1,2} which is not accepted
@@ -336,7 +903,7 @@ m/^(dvipsPreferOutline|dvipsDownloadBase35|(pdftex|dvipdfm)DownloadBase14)$/) {
# silently accept this old option name, just in case.
return if $opt eq "dvipdfmDownloadBase14";
- #print "Setting option $opt to $val...\n" if !$quiet;
+ #print "Setting option $opt to $val...\n" if !$opts{'quiet'};
my $tc = $alldata->{'top_config'};
if (!defined($alldata->{'updmap'}{$tc})) {
die "$prg: top config file $tc has not been read.";
@@ -482,7 +1049,8 @@ sub equalize_file {
# $alldata->{'maps'}{$m}{'fonts'}{$font} = $rest
#
# initialized by merge_data
-# $alldata->{'merged'}{'setting'}{$key} = $val
+# $alldata->{'merged'}{'setting'}{$key}{'val'} = $val
+# $alldata->{'merged'}{'setting'}{$key}{'origin'} = $origin_updmap_cfg
# $alldata->{'merged'}{'allMaps'}{'fonts'}{$fontdef} = $rest
# $alldata->{'merged'}{'noMixedMaps'}{'fonts'}{$fontdef} = $rest
#
@@ -541,6 +1109,7 @@ sub read_updmap_file {
next if /^\s*$/;
next if /^\s*#$/;
next if /^\s*#[^!]/;
+ next if /^\s*##/;
next if /^#![^ ]/;
# allow for commands on the line itself
s/([^#].*)#.*$/$1/;
@@ -593,11 +1162,28 @@ sub read_map_files {
}
for my $f (keys %{$alldata->{'updmap'}}) {
next if !defined($alldata->{'updmap'}{$f}{'maps'});
- for my $m (keys %{$alldata->{'updmap'}{$f}{'maps'}}) {
+ my @maps = keys %{$alldata->{'updmap'}{$f}{'maps'}};
+ push @maps, qw/dvips35.map pdftex35.map ps2pk35.map/;
+ my @fullpath = `kpsewhich --format=map @maps`;
+ chomp @fullpath;
+ my @missing;
+ foreach my $map (@maps) {
+ my ($ff) = grep /\/$map(\.map)?$/, @fullpath;
+ if (! $ff) {
+ push @missing, $map;
+ } else {
+ $alldata->{'maps'}{$map}{'fullpath'} = $ff;
+ }
+ }
+ for my $m (@maps) {
# we do not read a map file multiple times, if $alldata{'maps'}{$m} is
# defined we expect that it was read and do skip it
next if defined($alldata->{'maps'}{$m}{'fonts'});
- my $ret = read_map_file($m);
+ if (!defined($alldata->{'maps'}{$m}{'fullpath'})) {
+ print "cannot find full path for $m?!?!\n";
+ next;
+ }
+ my $ret = read_map_file($alldata->{'maps'}{$m}{'fullpath'});
if (defined($ret)) {
for my $font (keys %$ret) {
$alldata->{'maps'}{$m}{'fonts'}{$font} = $ret->{$font};
@@ -608,16 +1194,20 @@ sub read_map_files {
}
sub read_map_file {
- my $mn = shift;
- my $fn = `kpsewhich $mn`;
- chomp($fn);
- return if (!$fn);
- open(MF,"<$fn") || return;
+ my $fn = shift;
+ my @lines;
+ if (!open(MF,"<$fn")) {
+ warn("cannot open $fn: $!");
+ return;
+ }
+ @lines = <MF>;
+ close(MF);
+ chomp(@lines);
my %data;
- while (<MF>) {
- chomp;
- next if /^\s*$/;
+ for (@lines) {
+ next if /^\s*#/;
next if /^\s*%/;
+ next if /^\s*$/;
my ($a, $b) = split(' ', $_, 2);
$data{$a} = $b;
}
@@ -642,7 +1232,8 @@ sub merge_data {
# merge settings
if (defined($alldata->{'updmap'}{$l}{'setting'})) {
for my $k (keys %{$alldata->{'updmap'}{$l}{'setting'}}) {
- $alldata->{'merged'}{'setting'}{$k} = $alldata->{'updmap'}{$l}{'setting'}{$k}{'val'};
+ $alldata->{'merged'}{'setting'}{$k}{'val'} = $alldata->{'updmap'}{$l}{'setting'}{$k}{'val'};
+ $alldata->{'merged'}{'setting'}{$k}{'origin'} = $l;
}
}
}
@@ -651,6 +1242,7 @@ sub merge_data {
#
for my $m (keys %{$alldata->{'maps'}}) {
my $origin = $alldata->{'maps'}{$m}{'origin'};
+ next if !defined($origin);
next if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'status'} eq "disabled");
for my $f (keys %{$alldata->{'maps'}{$m}{'fonts'}}) {
$alldata->{'merged'}{'allMaps'}{'fonts'}{$f} =