summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-01-09 11:12:00 +0000
committerNorbert Preining <preining@logic.at>2012-01-09 11:12:00 +0000
commit05990dcdb5bce5e218164dd437ac795b13ebcac2 (patch)
tree537f9a350777b8a026d78cb33decc712c019fe6d /Master/texmf/scripts
parent32af1b800481e25f3c877bebf4964f8955543f19 (diff)
mupdmap fixes, now normal operation works as expected
git-svn-id: svn://tug.org/texlive/trunk@25060 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts')
-rwxr-xr-xMaster/texmf/scripts/texlive/mupdmap.pl237
1 files changed, 149 insertions, 88 deletions
diff --git a/Master/texmf/scripts/texlive/mupdmap.pl b/Master/texmf/scripts/texlive/mupdmap.pl
index 78a5887bb7c..440fcd41d18 100755
--- a/Master/texmf/scripts/texlive/mupdmap.pl
+++ b/Master/texmf/scripts/texlive/mupdmap.pl
@@ -38,6 +38,9 @@ use strict;
use TeXLive::TLUtils qw(mkdirhier mktexupd win32 basename dirname
sort_uniq member);
+#use Data::Dumper;
+#$Data::Dumper::Indent = 1;
+
chomp(my $TEXMFMAIN = `kpsewhich --var-value=TEXMFMAIN`);
chomp(my $TEXMFVAR = `kpsewhich -var-value=TEXMFVAR`);
chomp(my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`);
@@ -246,13 +249,7 @@ sub main {
$alldata->{'changes_config'} = $changes_config_file;
read_updmap_files(@{$opts{'cnffile'}});
- #
- # determine the settings
- determine_settings();
-
if ($opts{'listmaps'}) {
- # TODO TODO
- # any adaption for kanjiEmbed???
for my $m (keys %{$alldata->{'maps'}}) {
my $origin = $alldata->{'maps'}{$m}{'origin'};
print $alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'}, " $m ",
@@ -322,7 +319,7 @@ sub main {
# onto the list of available files. Since it is already properly
# initialized and the merging is done later, all settings should be
# honored
- my @aaa = $alldata->{'order'};
+ my @aaa = @{$alldata->{'order'}};
unshift @aaa, $changes_config_file;
$alldata->{'order'} = [ @aaa ];
setupOutputDir("dvips");
@@ -344,9 +341,8 @@ sub main {
}
merge_data();
# for inspecting the output
- #use Data::Dumper;
- #$Data::Dumper::Indent = 1;
#print STDERR Data::Dumper->Dump([$alldata], [qw(mapdata)]);
+ #print Dumper($alldata);
mkMaps();
}
unlink ($bakFile) if (-r $bakFile);
@@ -375,6 +371,7 @@ sub getFonts {
my @lines = ();
for my $m (@maps) {
if (defined($alldata->{'maps'}{$m})) {
+ print LOG "\n" . $alldata->{'maps'}{$m}{'fullpath'} . ":\n" unless $opts{'dry-run'};
push @lines, "% $m";
for my $k (sort keys %{$alldata->{'maps'}{$m}{'fonts'}}) {
if ($getall || $alldata->{'fonts'}{$k}{'origin'} eq $m) {
@@ -437,7 +434,7 @@ sub setupSymlinks {
my %link;
my @link;
- if ($dvipsPreferOutline) {
+ if ($dvipsPreferOutline eq "true") {
$src = "psfonts_t1.map";
} else {
$src = "psfonts_pk.map";
@@ -445,7 +442,7 @@ sub setupSymlinks {
unlink "$dvipsoutputdir/psfonts.map" unless $opts{"dry-run"};
push @link, &SymlinkOrCopy("$dvipsoutputdir", "$src", "psfonts.map");
- if ($pdftexDownloadBase14) {
+ if ($pdftexDownloadBase14 eq "true") {
$src = "pdftex_dl14.map";
} else {
$src = "pdftex_ndl14.map";
@@ -653,26 +650,45 @@ sub transLW35 {
return @lines;
}
-sub determine_settings {
- sub get_cfg {
- my ($v) = @_;
- if (defined($alldata->{'merged'}{'setting'}{$v})) {
- if ($settings{$v}{'type'} eq "binary") {
- return ( ($alldata->{'merged'}{'setting'}{$v}{'val'} eq "true" ? 1 : 0),
- $alldata->{'merged'}{'setting'}{$v}{'origin'} );
- } else {
- return ( $alldata->{'merged'}{'setting'}{$v}{'val'},
- $alldata->{'merged'}{'setting'}{$v}{'origin'} );
+###############################################################################
+# cidx2dvips()
+# reads from stdin, writes to stdout. It transforms "cid-x"-like syntax into
+# "dvips"-like syntax.
+###############################################################################
+sub cidx2dvips {
+ my ($s) = @_;
+ my @d;
+ foreach (@$s) {
+ if (m/^%/) {
+ push(@d, $_);
+ next;
}
- } else {
- return ($settings{$v}{'default'}, "default");
+ s/,BoldItalic/ -s .3/;
+ s/,Bold//;
+ s/,Italic/ -s .3/;
+ s/\s\s*/ /g;
+ if ($_ =~ /.*[@\:\/,]/) {next;}
+ elsif ($_ =~ /^[^ ][^ ]* unicode /) {next;}
+ s/^([^ ][^ ]* [^ ][^ ]* [^ ][^ ]*)\.[Oo][Tt][Ff]/$1/;
+ s/^([^ ][^ ]* [^ ][^ ]* [^ ][^ ]*)\.[Tt][Tt][FfCc]/$1/;
+ s/$/ %/;
+ s/^(([^ ]*).*)/$1$2/;
+ s/^([^ ][^ ]* ([^ ][^ ]*) !*([^ ][^ ]*).*)/$1 $3-$2/;
+ s/^(.* -e ([.0-9-][.0-9-]*).*)/$1 "$2 ExtendFont"/;
+ s/^(.* -s ([.0-9-][.0-9-]*).*)/$1 "$2 SlantFont"/;
+ s/.*%//;
+ push(@d, $_);
}
- }
+ return @d
+}
- for my $a (keys %settings) {
- my ($v, $vo) = get_cfg($a);
- $settings{$a}{'value'} = $v;
- $settings{$a}{'origin'} = $vo;
+sub get_cfg {
+ my ($v) = @_;
+ if (defined($alldata->{'merged'}{'setting'}{$v})) {
+ return ( $alldata->{'merged'}{'setting'}{$v}{'val'},
+ $alldata->{'merged'}{'setting'}{$v}{'origin'} );
+ } else {
+ return ($settings{$v}{'default'}, "default");
}
}
@@ -701,39 +717,32 @@ sub mkMaps {
print LOG shift unless $opts{'dry-run'};
}
- my $mode = $settings{'LW35'}{'value'};
- my $mode_origin = $settings{'LW35'}{'origin'};
- my $dvipsPreferOutline = $settings{'dvipsPreferOutline'}{'value'};
- my $dvipsPreferOutline_origin = $settings{'dvipsPreferOutline'}{'origin'};
- my $dvipsDownloadBase35 = $settings{'dvipsDownloadBase35'}{'value'};
- my $dvipsDownloadBase35_origin = $settings{'dvipsDownloadBase35'}{'origin'};
- my $pdftexDownloadBase14 = $settings{'pdftexDownloadBase14'}{'value'};
- my $pdftexDownloadBase14_origin = $settings{'pdftexDownloadBase14'}{'origin'};
- my $pxdviUse = $settings{'pxdviUse'}{'value'};
- my $pxdviUse_origin = $settings{'pxdviUse'}{'origin'};
- my $kanjiEmbed = $settings{'kanjiEmbed'}{'value'};
- my $kanjiEmbed_origin = $settings{'kanjiEmbed'}{'origin'};
+ my ($mode, $mode_origin) = get_cfg('LW35');
+ my ($dvipsPreferOutline, $dvipsPreferOutline_origin) =
+ get_cfg('dvipsPreferOutline');
+ my ($dvipsDownloadBase35, $dvipsDownloadBase35_origin) =
+ get_cfg('dvipsDownloadBase35');
+ my ($pdftexDownloadBase14, $pdftexDownloadBase14_origin) =
+ get_cfg('pdftexDownloadBase14');
+ my ($pxdviUse, $pxdviUse_origin) = get_cfg('pxdviUse');
+ my ($kanjiEmbed, $kanjiEmbed_origin) = get_cfg('kanjiEmbed');
print_and_log ("\n$prg is creating new map files"
. "\nusing the following configuration:"
. "\n LW35 font names : "
. "$mode ($mode_origin)"
. "\n prefer outlines : "
- . ($dvipsPreferOutline ? "true" : "false")
- . " ($dvipsPreferOutline_origin)"
+ . "$dvipsPreferOutline ($dvipsPreferOutline_origin)"
. "\n texhash enabled : "
. ($opts{'nohash'} ? "false" : "true")
. "\n download standard fonts (dvips) : "
- . ($dvipsDownloadBase35 ? "true" : "false")
- . " ($dvipsDownloadBase35_origin)"
+ . "$dvipsDownloadBase35 ($dvipsDownloadBase35_origin)"
. "\n download standard fonts (pdftex) : "
- . ($pdftexDownloadBase14 ? "true" : "false" )
- . " ($pdftexDownloadBase14_origin)"
+ . "$pdftexDownloadBase14 ($pdftexDownloadBase14_origin)"
. "\n kanjiEmbed replacement string : "
. "$kanjiEmbed ($kanjiEmbed_origin)"
. "\n create a mapfile for pxdvi : "
- . ($pxdviUse ? "true" : "false" )
- . " ($pxdviUse_origin)"
+ . "$pxdviUse ($pxdviUse_origin)"
. "\n\n");
print_and_log ("Scanning for LW35 support files");
@@ -758,18 +767,20 @@ sub mkMaps {
if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "MixedMap");
push @notmixedmaps, $m
if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "Map");
- if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "KanjiMap") {
- my $tmp = $m;
- $tmp =~ s/\@kanjiEmbed@/$kanjiEmbed/;
- push @kanjimaps, $tmp;
- }
+ push @kanjimaps, $m
+ if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "KanjiMap");
}
+
@mixedmaps = sort @mixedmaps;
@notmixedmaps = sort @notmixedmaps;
@kanjimaps = sort @kanjimaps;
only_log("\n");
- foreach my $line (sort @mixedmaps) {
- only_log("$line\n");
+ foreach my $m (sort @mixedmaps) {
+ if (defined($alldata->{'maps'}{$m}{'fullpath'})) {
+ only_log($alldata->{'maps'}{$m}{'fullpath'} . "\n");
+ } else {
+ only_log("$m (full path not set?)\n");
+ }
}
only_log("\n");
print_and_log (sprintf(" [%3d files]\n", scalar @mixedmaps));
@@ -777,8 +788,12 @@ sub mkMaps {
print_and_log ("Scanning for KanjiMap entries");
only_log("\n");
- foreach my $line (@kanjimaps) {
- only_log("$line\n");
+ foreach my $m (@kanjimaps) {
+ if (defined($alldata->{'maps'}{$m}{'fullpath'})) {
+ only_log($alldata->{'maps'}{$m}{'fullpath'} . "\n");
+ } else {
+ only_log("$m (full path not set?)\n");
+ }
}
only_log("\n");
print_and_log (sprintf(" [%3d files]\n", scalar @kanjimaps));
@@ -786,8 +801,12 @@ sub mkMaps {
print_and_log ("Scanning for Map entries");
only_log("\n");
- foreach my $line (@notmixedmaps) {
- only_log("$line\n");
+ foreach my $m (@notmixedmaps) {
+ if (defined($alldata->{'maps'}{$m}{'fullpath'})) {
+ only_log($alldata->{'maps'}{$m}{'fullpath'} . "\n");
+ } else {
+ only_log("$m (full path not set?)\n");
+ }
}
only_log("\n");
print_and_log (sprintf(" [%3d files]\n\n", scalar @notmixedmaps));
@@ -808,7 +827,7 @@ sub mkMaps {
"$dvipdfmoutputdir/kanjix.map",
"$dvipsoutputdir/ps2pk.map");
push @managed_files, "$pxdvioutputdir/xdvi-ptex.map"
- if $pxdviUse;
+ if ($pxdviUse eq "true");
for my $file (@managed_files) {
open FILE, ">$file";
print FILE "% $file:\
@@ -822,26 +841,31 @@ sub mkMaps {
}
}
+ my @kanjimaps_fonts = getFonts(@kanjimaps);
+ @kanjimaps_fonts = &normalizeLines(@kanjimaps_fonts);
+ my @ps2pk_fonts = getFonts('-all', "ps2pk35.map");
+ my @dvips35_fonts = getFonts('-all', "dvips35.map");
+ my @pdftex35_fonts = getFonts('-all', "pdftex35.map");
+ my @mixedmaps_fonts = getFonts(@mixedmaps);
+ my @notmixedmaps_fonts = getFonts(@notmixedmaps);
+
print "Generating output for dvipdfm...\n" if !$opts{'quiet'};
- my @tmpkanji1 = getFonts(@kanjimaps);
- @tmpkanji1 = &normalizeLines(@tmpkanji1);
- &writeLines(">$dvipdfmoutputdir/kanjix.map", @tmpkanji1);
+ &writeLines(">$dvipdfmoutputdir/kanjix.map", @kanjimaps_fonts);
- if ($pxdviUse) {
+ if ($pxdviUse eq "true") {
# we use the very same data as for kanjix.map, but generate
# a different file, so that in case a user wants to hand-craft it
print "Generating output for pxdvi...\n" if !$opts{'quiet'};
- &writeLines(">$pxdvioutputdir/xdvi-ptex.map", @tmpkanji1);
+ &writeLines(">$pxdvioutputdir/xdvi-ptex.map", @kanjimaps_fonts);
}
print "Generating output for ps2pk...\n" if !$opts{'quiet'};
- my @ps2pk_fonts = getFonts('-all', "ps2pk35.map");
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);
+ push @ps2pk_map, @mixedmaps_fonts;
+ push @ps2pk_map, @notmixedmaps_fonts;
&writeLines(">$dvipsoutputdir/ps2pk.map",
normalizeLines(@ps2pk_map));
@@ -853,7 +877,6 @@ sub mkMaps {
normalizeLines(@download35_map));
my @builtin35_map;
- my @dvips35_fonts = getFonts('-all', "dvips35.map");
push @builtin35_map, "% dvips35.map";
push @builtin35_map, transLW35($mode, @dvips35_fonts);
&writeLines(">$dvipsoutputdir/builtin35.map",
@@ -870,32 +893,34 @@ sub mkMaps {
@dftdvips_fonts = @dvips35_fonts;
}
push @psfonts_t1_map, transLW35($mode, @dftdvips_fonts);
- push @psfonts_t1_map, getFonts(@mixedmaps);
- push @psfonts_t1_map, getFonts(@notmixedmaps);
+ my @tmpkanji2 = cidx2dvips(\@kanjimaps_fonts);
+ push @psfonts_t1_map, @mixedmaps_fonts;
+ push @psfonts_t1_map, @notmixedmaps_fonts;
+ push @psfonts_t1_map, @tmpkanji2;
&writeLines(">$dvipsoutputdir/psfonts_t1.map",
normalizeLines(@psfonts_t1_map));
my @psfonts_pk_map;
push @psfonts_pk_map, transLW35($mode, @dftdvips_fonts);
- push @psfonts_pk_map, getFonts(@notmixedmaps);
+ push @psfonts_pk_map, @notmixedmaps_fonts;
+ push @psfonts_pk_map, @tmpkanji2;
&writeLines(">$dvipsoutputdir/psfonts_pk.map",
normalizeLines(@psfonts_pk_map));
print "Generating output for pdftex...\n" if !$opts{'quiet'};
# remove PaintType due to Sebastian's request
- my @pdftex35_fonts = getFonts('-all', "pdftex35.map");
my @pdftexmaps_ndl;
push @pdftexmaps_ndl, "% pdftex35.map";
push @pdftexmaps_ndl, transLW35($mode, @pdftex35_fonts);
- push @pdftexmaps_ndl, getFonts(@mixedmaps);
- push @pdftexmaps_ndl, getFonts(@notmixedmaps);
+ push @pdftexmaps_ndl, @mixedmaps_fonts;
+ push @pdftexmaps_ndl, @notmixedmaps_fonts;
@pdftexmaps_ndl = grep { $_ !~ m/(^%\|PaintType)/ } @pdftexmaps_ndl;
my @pdftexmaps_dl;
push @pdftexmaps_dl, "% ps2pk35.map";
push @pdftexmaps_dl, transLW35($mode, @ps2pk_fonts);
- push @pdftexmaps_dl, getFonts(@mixedmaps);
- push @pdftexmaps_dl, getFonts(@notmixedmaps);
+ push @pdftexmaps_dl, @mixedmaps_fonts;
+ push @pdftexmaps_dl, @notmixedmaps_fonts;
@pdftexmaps_dl = grep { $_ !~ m/(^%\|PaintType)/ } @pdftexmaps_dl;
my @pdftex_ndl14_map = @pdftexmaps_ndl;
@@ -961,7 +986,7 @@ sub mkMaps {
dir ($d, $f, '');
$updLSR->{add}("$d/$f") unless $opts{'dry-run'};
}
- if ($pxdviUse) {
+ if ($pxdviUse eq "true") {
$d="$pxdvioutputdir";
print_and_log(" $d:\n");
foreach my $f ('xdvi-ptex.map') {
@@ -1090,7 +1115,7 @@ sub enable_disable_maps {
sub enable_map {
my ($tc, $type, $map) = @_;
- die "$prg: invalid mapType $type" if ($type !~ m/^(Map|MixedMap)$/);
+ die "$prg: invalid mapType $type" if ($type !~ m/^(Map|MixedMap|KanjiMap)$/);
if (defined($alldata->{'updmap'}{$tc}{'maps'}{$map})) {
# the map data has already been read in, no special precautions necessary
@@ -1394,7 +1419,7 @@ sub normalizeLines {
# $alldata->{'updmap'}{$full_path_name_of_updmap}{'setting'}{$key}{'val'} = $val
# $alldata->{'updmap'}{$full_path_name_of_updmap}{'setting'}{$key}{'line'} = $i
# $alldata->{'updmap'}{$full_path_name_of_updmap}{'maps'}{$mapname}{'type'}
-# = 'Map'|'MixedMap'|'disabled'
+# = 'Map'|'MixedMap'|'KanjiMap'|'disabled'
# $alldata->{'updmap'}{$full_path_name_of_updmap}{'maps'}{$mapname}{'status'}
# = 'enabled'|'disabled'
# $alldata->{'updmap'}{$full_path_name_of_updmap}{'maps'}{$mapname}{'line'} = $i
@@ -1410,6 +1435,7 @@ sub normalizeLines {
# $alldata->{'merged'}{'setting'}{$key}{'origin'} = $origin_updmap_cfg
# $alldata->{'merged'}{'allMaps'}{'fonts'}{$fontdef} = $rest
# $alldata->{'merged'}{'noMixedMaps'}{'fonts'}{$fontdef} = $rest
+# $alldata->{'merged'}{'KanjiMaps'}{'fonts'}{$fontdef} = $rest
#
sub read_updmap_files {
@@ -1438,9 +1464,35 @@ sub read_updmap_files {
}
#
$alldata->{'order'} = \@l;
+ #
+ # merge the settings so that we can check for kanjiEmbed
+ #
+ merge_settings();
+ #
+ my ($kanjiEmbed, $kanjiEmbed_origin) = get_cfg('kanjiEmbed');
+ #
+ # go through all map files and check that the text is properly replaced
+ #
+ for my $l (@l) {
+ for my $m (keys %{$alldata->{'updmap'}{$l}{'maps'}}) {
+ if ($m =~ m/\@kanjiEmbed@/) {
+ my $newm = $m;
+ $newm =~ s/\@kanjiEmbed@/$kanjiEmbed/;
+ # now we have to update various linked items
+ $alldata->{'updmap'}{$l}{'maps'}{$newm}{'type'} =
+ $alldata->{'updmap'}{$l}{'maps'}{$m}{'type'};
+ $alldata->{'updmap'}{$l}{'maps'}{$newm}{'status'} =
+ $alldata->{'updmap'}{$l}{'maps'}{$m}{'status'};
+ $alldata->{'updmap'}{$l}{'maps'}{$newm}{'line'} =
+ $alldata->{'updmap'}{$l}{'maps'}{$m}{'line'};
+ delete $alldata->{'updmap'}{$l}{'maps'}{$m};
+ }
+ }
+ }
+ #
# first round determine which maps should be used and which type, as
# different updmap.cfg files might specify different types of maps
- # (MixedMap or Map).
+ # (MixedMap or Map or KanjiMap).
# Again, we have to do that in reverse order
for my $l (reverse @l) {
if (defined($alldata->{'updmap'}{$l}{'maps'})) {
@@ -1476,7 +1528,7 @@ sub read_updmap_file {
s/([^#].*)#.*$/$1/;
my ($a, $b, @rest) = split ' ';
if ($a eq "#!") {
- if ($b eq "Map" || $b eq "MixedMap") {
+ if ($b eq "Map" || $b eq "MixedMap" || $b eq "KanjiMap") {
my $c = shift @rest;
if (!defined($c)) {
warning("updmap: apparently not a real disable line, ignored: $_\n");
@@ -1536,8 +1588,6 @@ sub read_map_files {
push @maps, $m;
$alldata->{'maps'}{$m}{'status'} = 'enabled';
}
- my $kanjiEmbed = $settings{'kanjiEmbed'}{'value'};
- map { $_ =~ s/\@kanjiEmbed@/$kanjiEmbed/ } @maps;
@maps = sort_uniq(@maps);
my @fullpath = `kpsewhich --format=map @maps`;
chomp @fullpath;
@@ -1626,11 +1676,10 @@ sub read_map_file {
return \%data;
}
-
#
-# merging the various font definitions
+# merge and update the setting
#
-sub merge_data {
+sub merge_settings {
my @l = @{$alldata->{'order'}};
#
# for security clean out everything that was there
@@ -1650,6 +1699,14 @@ sub merge_data {
}
}
#
+}
+
+#
+# merging the various font definitions
+#
+sub merge_data {
+ my @l = @{$alldata->{'order'}};
+ #
# now merge the data
#
for my $m (keys %{$alldata->{'maps'}}) {
@@ -1660,10 +1717,14 @@ sub merge_data {
# use the font definition only for those fonts where the origin matches
if ($alldata->{'fonts'}{$f}{'origin'} eq $m) {
$alldata->{'merged'}{'allMaps'}{'fonts'}{$f} =
- $alldata->{'maps'}{$m}{'fonts'}{$f};
+ $alldata->{'maps'}{$m}{'fonts'}{$f}
+ if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} ne "KanjiMap");
$alldata->{'merged'}{'noMixedMaps'}{'fonts'}{$f} =
$alldata->{'maps'}{$m}{'fonts'}{$f}
if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "Map");
+ $alldata->{'merged'}{'KanjiMap'}{'fonts'}{$f} =
+ $alldata->{'maps'}{$m}{'fonts'}{$f}
+ if ($alldata->{'updmap'}{$origin}{'maps'}{$m}{'type'} eq "KanjiMap");
}
}
}