diff options
author | Norbert Preining <preining@logic.at> | 2011-10-26 01:07:22 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2011-10-26 01:07:22 +0000 |
commit | 896628bd51693a9f12e2957a0def360889946fff (patch) | |
tree | 89823b782f7797f0619bfe91fe96e5ab9f548f53 /Master/texmf/scripts/tetex/updmap.pl | |
parent | 4a7444b5659f5279957d6737a2253e4ef984f0c8 (diff) |
merge updmap.pl changes from source
git-svn-id: svn://tug.org/texlive/trunk@24398 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts/tetex/updmap.pl')
-rwxr-xr-x | Master/texmf/scripts/tetex/updmap.pl | 98 |
1 files changed, 89 insertions, 9 deletions
diff --git a/Master/texmf/scripts/tetex/updmap.pl b/Master/texmf/scripts/tetex/updmap.pl index 52ee55ce692..2836340eafa 100755 --- a/Master/texmf/scripts/tetex/updmap.pl +++ b/Master/texmf/scripts/tetex/updmap.pl @@ -12,7 +12,7 @@ BEGIN { unshift (@INC, "$TEXMFROOT/tlpkg"); } -my $version = '$Id: updmap.pl 23807 2011-09-04 17:11:12Z karl $'; +my $version = '$Id: updmap.pl 24397 2011-10-26 01:03:45Z preining $'; use strict; use TeXLive::TLUtils qw(mkdirhier mktexupd win32); @@ -27,6 +27,7 @@ my $cnfFileShort; my $outputdir; my $dvipsoutputdir; my $pdftexoutputdir; +my $dvipdfmoutputdir; my $quiet; my $nohash; my $nomkmap; @@ -51,6 +52,7 @@ my $mode; my $dvipsPreferOutline; my $dvipsDownloadBase35; my $pdftexDownloadBase14; +my $kanjiEmbed; my $dvips35; my $pdftex35; @@ -118,13 +120,15 @@ Commands: --showoptions ITEM show alternatives for options --setoption OPTION VALUE set option, where OPTION is one of: LW35, dvipsPreferOutline, dvipsDownloadBase35, - or pdftexDownloadBase14 + pdftexDownloadBase14, or kanjiEmbed --setoption OPTION=VALUE as above, just different syntax --enable MAPTYPE MAPFILE add "MAPTYPE MAPFILE" to updmap.cfg, - where MAPTYPE is either Map or MixedMap + where MAPTYPE is one of: Map, MixedMap, KanjiMap --enable Map=MAPFILE add \"Map MAPFILE\" to updmap.cfg --enable MixedMap=MAPFILE add \"MixedMap MAPFILE\" to updmap.cfg - --disable MAPFILE disable MAPFILE, whether Map or MixedMap + --enable KanjiMap=MAPFILE add \"KanjiMap MAPFILE\" to updmap.cfg + --disable MAPFILE disable MAPFILE, whether Map or MixedMap, + or KanjiMap --listmaps list all active and inactive maps --listavailablemaps same as --listmaps, but without unavailable map files @@ -150,6 +154,7 @@ Explanation of the --setoption possibilities: URW URW fonts with "vendor" filenames (e.g. n019064l.pfb) ADOBEkb Adobe fonts with "berry" filenames (e.g. phvbo8an.pfb) ADOBE Adobe fonts with "vendor" filenames (e.g. hvnbo___.pfb) + kanjiEmbed (any string) These options are only read and acted on by updmap; dvips, pdftex, etc., do not know anything about them. They work by changing the default map @@ -227,7 +232,7 @@ sub processOptions { "cnffile=s" => \$cnfFile, "copy" => \$copy, "disable=s" => \@disableItem, - "dvipdfmoutputdir=s" => sub {print "$0: ignoring --dvipdfmoutputdir\n"}, + "dvipdfmoutputdir=s" => \$dvipdfmoutputdir, "dvipsoutputdir=s" => \$dvipsoutputdir, "enable=s" => \$enableItem, "edit" => \$opt_edit, @@ -256,6 +261,7 @@ sub processOptions { if ($outputdir) { $dvipsoutputdir = $outputdir if (! $dvipsoutputdir); $pdftexoutputdir = $outputdir if (! $pdftexoutputdir); + $dvipdfmoutputdir = $outputdir if (! $dvipdfmoutputdir); } if ($cnfFile && ! -f $cnfFile) { die "$0: Config file \"$cnfFile\" not found.\n"; @@ -263,6 +269,9 @@ sub processOptions { if ($dvipsoutputdir && ! $dry_run && ! -d $dvipsoutputdir) { &mkdirhier ($dvipsoutputdir); } + if ($dvipdfmoutputdir && ! $dry_run && ! -d $dvipdfmoutputdir) { + &mkdirhier ($dvipdfmoutputdir); + } if ($pdftexoutputdir && ! $dry_run && ! -d $pdftexoutputdir) { &mkdirhier ($pdftexoutputdir); } @@ -613,6 +622,8 @@ m/^(dvipsPreferOutline|dvipsDownloadBase35|(pdftex|dvipdfm)DownloadBase14)$/) { if ($val !~ m/^(true|false)$/) { die "$0: Invalid value $val for option $opt; should be \"true\" or \"false\".\n"; } + } elsif ($opt eq "kanjiEmbed"){ + # do nothing } else { die "$0: Unsupported option $opt (value given: $val).\n"; } @@ -637,6 +648,9 @@ sub showOptions { m/(dvipsPreferOutline|(dvipdfm|pdftex)DownloadBase14|dvipsDownloadBase35)/) { print "true false\n"; } + elsif ($item eq "kanjiEmbed") { + print "(any string)\n"; + } else { print "Unknown item \"$item\"; should be one of LW35, dvipsPreferOutline,\n" . " dvipsDownloadBase35, or pdftexDownloadBase14\n"; @@ -653,7 +667,7 @@ m/(dvipsPreferOutline|(dvipdfm|pdftex)DownloadBase14|dvipsDownloadBase35)/) { sub enableMap { my ($type, $map) = @_; - if ($type !~ m/^(Map|MixedMap)$/) { + if ($type !~ m/^(Map|MixedMap|KanjiMap)$/) { die "$0: Invalid mapType $type\n"; } # a map can only have one type, so we carefully disable everything @@ -675,7 +689,7 @@ sub disableMap { my @mapType = grep { my @fields = split; - if ($fields[0] and $fields[0] =~ /^(MixedMap|Map)$/ + if ($fields[0] and $fields[0] =~ /^(MixedMap|Map|KanjiMap)$/ and $fields[1] eq $map and ++$count{$fields[0]}) { $_ = $fields[0]; } @@ -720,6 +734,7 @@ sub setupOutputDir { sub setupDestDir { $dvipsoutputdir = &setupOutputDir($dvipsoutputdir, "dvips"); $pdftexoutputdir = &setupOutputDir($pdftexoutputdir, "pdftex"); + $dvipdfmoutputdir = &setupOutputDir($dvipdfmoutputdir, "dvipdfm"); } ############################################################################### @@ -763,6 +778,7 @@ sub catMaps { my @maps = grep { $_ =~ m/$map/ } @cfg; map{ $_ =~ s/\#.*//; + $_ =~ s/\@kanjiEmbed@/$kanjiEmbed/; $_ =~ s/\s*([^\s]*)\s*([^\s]*)/$2/; } @maps; @maps = sort(@maps); @@ -780,6 +796,7 @@ sub listMaps { my $what=shift; my @mapfiles; my @paths; + $kanjiEmbed = &cfgval("kanjiEmbed"); my @lines = grep { if ($what eq 'sync') { @@ -793,14 +810,16 @@ sub listMaps { # --listmaps map { print "$_\n"; } @lines; } else { - @mapfiles=grep { $_ =~ s/^(\#! *)?(Mixed)?Map\s+// } @lines; + map { $_ =~ s/\@kanjiEmbed@/$kanjiEmbed/ } @lines; + @mapfiles=grep { $_ =~ s/^(\#! *)?(Mixed|Kanji)?Map\s+// } @lines; @paths=&locateMap(@mapfiles); if ($what eq 'avail') { # --listavailablemaps map { my $entry="$_"; - # print "$entry\n" if (grep { $_ =~ m/\/$entry/ } @paths); + # why is that disabled? + # print "$entry\n" if (grep { $_ =~ m/\/$entry/ } @paths); } @lines; } elsif ($what eq 'sync') { # --syncwithtrees @@ -858,6 +877,34 @@ sub to_pdftex { return @out; } +############################################################################### +# 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) { + 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 +} + ############################################################################### # mkMaps() @@ -910,6 +957,9 @@ sub mkMaps { $pdftexDownloadBase14 = &cfgval("pdftexDownloadBase14"); $pdftexDownloadBase14 = 1 unless (defined $pdftexDownloadBase14); + $kanjiEmbed = &cfgval("kanjiEmbed"); + $kanjiEmbed = "noEmbed" unless (defined $kanjiEmbed); + &wlog ("\n$0 " . ($dry_run ? "would create" : "is creating") . " new map files" . "\nusing the following configuration:" @@ -951,6 +1001,20 @@ sub mkMaps { printf " [%3d files]\n", scalar @tmp1 unless ($quiet || $dry_run); + &wlog ("Scanning for KanjiMap entries"); + &newline; + my @tmpkanji0 = &catMaps('^KanjiMap'); + foreach my $line (@tmpkanji0) { + if ($dry_run) { + print "$line\n"; + } else { + print LOG "$line\n"; + } + } + &newline; + printf " [%3d files]\n", scalar @tmpkanji0 + unless ($quiet || $dry_run); + &wlog ("Scanning for Map entries"); &newline(); my @tmp2 = &catMaps('^Map'); @@ -982,6 +1046,7 @@ sub mkMaps { "$dvipsoutputdir/psfonts_pk.map", "$pdftexoutputdir/pdftex_dl14.map", "$pdftexoutputdir/pdftex_ndl14.map", + "$dvipdfmoutputdir/kanjix.map", "$dvipsoutputdir/ps2pk.map") { open FILE, ">$file"; print FILE "% $file:\ @@ -994,6 +1059,14 @@ sub mkMaps { close FILE; } + print "Generating output for dvipdfm...\n" if !$quiet; + my @tmpkanji1; + push @tmpkanji1, &getLines(@tmpkanji0); + @tmpkanji1 = &normalizeLines(@tmpkanji1); + &writeLines(">$dvipdfmoutputdir/kanjix.map", + @tmpkanji1); + my @tmpkanji2 = &cidx2dvips(\@tmpkanji1); + print "Generating output for ps2pk...\n" if !$quiet; my @ps2pk_map = &transLW35($ps2pk35); push @ps2pk_map, &getLines(@tmp1); @@ -1015,11 +1088,13 @@ sub mkMaps { my @psfonts_t1_map = &transLW35($dftdvips); push @psfonts_t1_map, &getLines(@tmp1); push @psfonts_t1_map, &getLines(@tmp2); + push @psfonts_t1_map, @tmpkanji2; &writeLines(">$dvipsoutputdir/psfonts_t1.map", &normalizeLines(@psfonts_t1_map)); my @psfonts_pk_map = &transLW35($dftdvips); push @psfonts_pk_map, &getLines(@tmp2); + push @psfonts_pk_map, @tmpkanji2; &writeLines(">$dvipsoutputdir/psfonts_pk.map", &normalizeLines(@psfonts_pk_map)); @@ -1087,6 +1162,11 @@ sub mkMaps { dir ($d, $f, 'pdftex.map'); $updLSR->{add}("$d/$f"); } + $d="$dvipdfmoutputdir"; &wlog (" $d:\n"); + foreach my $f ('kanjix.map') { + dir ($d, $f, ''); + $updLSR->{add}("$d/$f"); + } close LOG; print "\nTranscript written on \"$logfile\".\n" if !$quiet; } |