summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-01-09 04:52:38 +0000
committerNorbert Preining <preining@logic.at>2012-01-09 04:52:38 +0000
commit32af1b800481e25f3c877bebf4964f8955543f19 (patch)
tree77bdf9093af68748d1f925189e603e5ac4f56b8f /Master
parent60a76b456137a270f7e459a0a7dd63227e1c17ef (diff)
include kanjiEmbed and pxdviUse support in multi-updmap, still some bugs
git-svn-id: svn://tug.org/texlive/trunk@25059 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/mupdmap.pl212
1 files changed, 172 insertions, 40 deletions
diff --git a/Master/texmf/scripts/texlive/mupdmap.pl b/Master/texmf/scripts/texlive/mupdmap.pl
index caf0fedc6bd..78a5887bb7c 100755
--- a/Master/texmf/scripts/texlive/mupdmap.pl
+++ b/Master/texmf/scripts/texlive/mupdmap.pl
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# mupdmap: utility to maintain map files for outline fonts.
#
-# Copyright 2011 Norbert Preining
+# Copyright 2011, 2012 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
@@ -13,6 +13,9 @@
# Anyone may freely use, modify, and/or distribute this file, without
# limitation.
#
+# TODO TODO
+# it seems that the entries from KanjiMap end up in the dvips
+# config file where it should NOT end up!!!
my $TEXMFROOT;
@@ -72,6 +75,7 @@ my @cmdline_options = (
"dry-run|n",
"outputdir=s",
"pdftexoutputdir=s",
+ "pxdvioutputdir=s",
"quiet|silent|q",
# the following is a correct specification of an option according
# to the manual, but it does not work!
@@ -85,11 +89,35 @@ my @cmdline_options = (
);
my %settings = (
- dvipsPreferOutline => [ qw/true false/ ],
- LW35 => [ qw/URW URWkb ADOBE ADOBEkb/ ],
- dvipsDownloadBase35 => [ qw/true false/ ],
- pdftexDownloadBase14 => [ qw/true false/ ],
- dvipdfmDownloadBase14 => [ qw/true false/ ],
+ dvipsPreferOutline => {
+ type => "binary",
+ default => "true",
+ },
+ LW35 => {
+ type => "string",
+ possible => [ qw/URW URWkb ADOBE ADOBEkb/ ],
+ default => "URWkb",
+ },
+ dvipsDownloadBase35 => {
+ type => "binary",
+ default => "true",
+ },
+ pdftexDownloadBase14 => {
+ type => "binary",
+ default => "true",
+ },
+ dvipdfmDownloadBase14 => {
+ type => "binary",
+ default => "true",
+ },
+ pxdviUse => {
+ type => "binary",
+ default => "false",
+ },
+ kanjiEmbed => {
+ type => "any",
+ default => "noEmbed",
+ },
);
&main();
@@ -104,7 +132,15 @@ sub main {
if ($opts{'showoptions'}) {
for my $o (@{$opts{'showoptions'}}) {
if (defined($settings{$o})) {
- print "@{$settings{$o}}\n";
+ if ($settings{$o}{'type'} eq "binary") {
+ print "true false\n";
+ } elsif ($settings{$o}{'type'} eq "string") {
+ print "@{$settings{$o}{'possible'}}\n";
+ } elsif ($settings{$o}{'type'} eq "any") {
+ print "(any string)\n";
+ } else {
+ print "strange: unknown type of option $o\nplease report\n";
+ }
} else {
print "$prg: unknown option: $o\n";
}
@@ -210,7 +246,13 @@ 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 ",
@@ -285,6 +327,9 @@ sub main {
$alldata->{'order'} = [ @aaa ];
setupOutputDir("dvips");
setupOutputDir("pdftex");
+ setupOutputDir("dvipdfmx");
+ setupOutputDir("dvipdfm");
+ setupOutputDir("pxdvi");
my @missing = read_map_files();
if (@missing) {
print STDERR "\nERROR: The following map file(s) couldn't be found:\n";
@@ -608,6 +653,28 @@ 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'} );
+ }
+ } else {
+ return ($settings{$v}{'default'}, "default");
+ }
+ }
+
+ for my $a (keys %settings) {
+ my ($v, $vo) = get_cfg($a);
+ $settings{$a}{'value'} = $v;
+ $settings{$a}{'origin'} = $vo;
+ }
+}
sub mkMaps {
my $logfile;
@@ -633,29 +700,19 @@ sub mkMaps {
sub only_log {
print LOG shift unless $opts{'dry-run'};
}
- sub get_cfg {
- my ($v, $def, $opt) = @_;
- if (defined($alldata->{'merged'}{'setting'}{$v})) {
- if (defined($opt) && $opt eq "-str") {
- return ( $alldata->{'merged'}{'setting'}{$v}{'val'},
- $alldata->{'merged'}{'setting'}{$v}{'origin'} );
- } else {
- return ( ($alldata->{'merged'}{'setting'}{$v}{'val'} eq "true" ? 1 : 0),
- $alldata->{'merged'}{'setting'}{$v}{'origin'} );
- }
- } else {
- return ($def, "default");
- }
- }
- my ($mode, $mode_origin) =
- get_cfg('LW35', 'URWkb', '-str');
- my ($dvipsPreferOutline, $dvipsPreferOutline_origin) =
- get_cfg('dvipsPreferOutline', 1);
- my ($dvipsDownloadBase35, $dvipsDownloadBase35_origin) =
- get_cfg('dvipsDownloadBase35', 1);
- my ($pdftexDownloadBase14, $pdftexDownloadBase14_origin) =
- get_cfg('pdftexDownloadBase14', 1);
+ 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'};
print_and_log ("\n$prg is creating new map files"
. "\nusing the following configuration:"
@@ -672,6 +729,11 @@ sub mkMaps {
. "\n download standard fonts (pdftex) : "
. ($pdftexDownloadBase14 ? "true" : "false" )
. " ($pdftexDownloadBase14_origin)"
+ . "\n kanjiEmbed replacement string : "
+ . "$kanjiEmbed ($kanjiEmbed_origin)"
+ . "\n create a mapfile for pxdvi : "
+ . ($pxdviUse ? "true" : "false" )
+ . " ($pxdviUse_origin)"
. "\n\n");
print_and_log ("Scanning for LW35 support files");
@@ -687,6 +749,7 @@ sub mkMaps {
print_and_log ("Scanning for MixedMap entries");
my @mixedmaps;
my @notmixedmaps;
+ my @kanjimaps;
for my $m (keys %{$alldata->{'maps'}}) {
my $origin = $alldata->{'maps'}{$m}{'origin'};
next if !defined($origin);
@@ -695,9 +758,15 @@ 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;
+ }
}
@mixedmaps = sort @mixedmaps;
@notmixedmaps = sort @notmixedmaps;
+ @kanjimaps = sort @kanjimaps;
only_log("\n");
foreach my $line (sort @mixedmaps) {
only_log("$line\n");
@@ -706,6 +775,15 @@ sub mkMaps {
print_and_log (sprintf(" [%3d files]\n", scalar @mixedmaps));
only_log("\n");
+ print_and_log ("Scanning for KanjiMap entries");
+ only_log("\n");
+ foreach my $line (@kanjimaps) {
+ only_log("$line\n");
+ }
+ only_log("\n");
+ print_and_log (sprintf(" [%3d files]\n", scalar @kanjimaps));
+ only_log("\n");
+
print_and_log ("Scanning for Map entries");
only_log("\n");
foreach my $line (@notmixedmaps) {
@@ -718,14 +796,20 @@ sub mkMaps {
# Create psfonts_t1.map, psfonts_pk.map, ps2pk.map and pdftex.map:
my $dvipsoutputdir = $opts{'dvipsoutputdir'};
my $pdftexoutputdir = $opts{'pdftexoutputdir'};
+ my $dvipdfmoutputdir = $opts{'dvipdfmoutputdir'};
+ my $pxdvioutputdir = $opts{'pxdvioutputdir'};
if (!$opts{'dry-run'}) {
- for my $file ("$dvipsoutputdir/download35.map",
+ my @managed_files = ("$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") {
+ "$dvipdfmoutputdir/kanjix.map",
+ "$dvipsoutputdir/ps2pk.map");
+ push @managed_files, "$pxdvioutputdir/xdvi-ptex.map"
+ if $pxdviUse;
+ for my $file (@managed_files) {
open FILE, ">$file";
print FILE "% $file:\
% maintained by updmap[-sys] (multi).\
@@ -738,6 +822,19 @@ sub mkMaps {
}
}
+ print "Generating output for dvipdfm...\n" if !$opts{'quiet'};
+ my @tmpkanji1 = getFonts(@kanjimaps);
+ @tmpkanji1 = &normalizeLines(@tmpkanji1);
+ &writeLines(">$dvipdfmoutputdir/kanjix.map", @tmpkanji1);
+
+ if ($pxdviUse) {
+ # 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);
+ }
+
+
print "Generating output for ps2pk...\n" if !$opts{'quiet'};
my @ps2pk_fonts = getFonts('-all', "ps2pk35.map");
my @ps2pk_map;
@@ -858,6 +955,20 @@ sub mkMaps {
dir ($d, $f, 'pdftex.map');
$updLSR->{add}("$d/$f") unless $opts{'dry-run'};
}
+ $d="$dvipdfmoutputdir";
+ print_and_log(" $d:\n");
+ foreach my $f ('kanjix.map') {
+ dir ($d, $f, '');
+ $updLSR->{add}("$d/$f") unless $opts{'dry-run'};
+ }
+ if ($pxdviUse) {
+ $d="$pxdvioutputdir";
+ print_and_log(" $d:\n");
+ foreach my $f ('xdvi-ptex.map') {
+ dir ($d, $f, '');
+ $updLSR->{add}("$d/$f") unless $opts{'dry-run'};
+ }
+ }
close LOG unless $opts{'dry-run'};
print "\nTranscript written on \"$logfile\".\n" if !$opts{'quiet'};
@@ -1106,6 +1217,20 @@ sub save_updmap {
return 0;
}
+######################
+# check for correct option value
+#
+sub check_option {
+ my ($opt, $val) = @_;
+ if ((($settings{$opt}{'type'} eq "binary") &&
+ $val ne "true" && $val ne "false") ||
+ (($settings{$opt}{'type'} eq "string") &&
+ !member($val, @{$settings{$opt}{'possible'}}))) {
+ return 0;
+ }
+ return 1;
+}
+
###############################################################################
# setOption (conf_file, option, value)
# sets option to value in the config file (replacing the existing setting
@@ -1116,7 +1241,7 @@ sub setOption {
die "$prg: Unsupported option $opt." if (!defined($settings{$opt}));
die "$0: Invalid value $val for option $opt."
- if (!member($val, @{$settings{$opt}}));
+ if (!check_option($opt, $val));
# silently accept this old option name, just in case.
return if $opt eq "dvipdfmDownloadBase14";
@@ -1370,14 +1495,13 @@ sub read_updmap_file {
warning("updmap: line $i in $fn contains a syntax error, more than two words!\n");
}
if (defined($settings{$a})) {
- my @possible_values = @{$settings{$a}};
- if (scalar(grep($_ eq $b, @possible_values))) {
+ if (check_option($a, $b)) {
$data{'setting'}{$a}{'val'} = $b;
$data{'setting'}{$a}{'line'} = $i;
} else {
warning("updmap: unknown setting for $a: $b, ignored!\n");
}
- } elsif ($a eq "Map" || $a eq "MixedMap") {
+ } elsif ($a eq "Map" || $a eq "MixedMap" || $a eq "KanjiMap") {
if (defined($data{'maps'}{$b}) && $data{'maps'}{$b}{'type'} ne $a) {
warning("updmap: double mentioning of $b with conflicting types in $fn\n");
} else {
@@ -1412,6 +1536,8 @@ 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;
@@ -1562,8 +1688,8 @@ Usage: $prg [OPTION] ... [COMMAND]
or: $prg-sys [OPTION] ... [COMMAND]
Update the default font map files used by pdftex, dvips, and dvipdfm(x),
-as determined by all configuration files updmap.cfg (the one returned by
-running "kpsewhich --all updmap.cfg", but see below).
+(and optionally pxdvi) as determined by all configuration files updmap.cfg
+(the ones returned by running "kpsewhich --all updmap.cfg", but see below).
Among other things, these map files are used to determine which fonts
should be used as bitmaps and which as outlines, and to determine which
@@ -1575,8 +1701,10 @@ Options:
--cnffile FILE read FILE for the updmap configuration
(can be given multiple times, in which case
all the files are used)
+ --dvipdfmoutputdir DIR specify output directory (dvipdfm syntax)
--dvipsoutputdir DIR specify output directory (dvips syntax)
--pdftexoutputdir DIR specify output directory (pdftex syntax)
+ --pxdvioutputdir DIR specify output directory (pxdvi syntax)
--outputdir DIR specify output directory (for all files)
--copy cp generic files rather than using symlinks
--force recreate files even if config hasn't changed
@@ -1591,13 +1719,14 @@ Commands:
--showoptions ITEM show alternatives for options
--setoption OPTION VALUE set option, where OPTION is one of:
LW35, dvipsPreferOutline, dvipsDownloadBase35,
- or pdftexDownloadBase14
+ pdftexDownloadBase14, pxdviUse, 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 either 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, MixedMap, or KanjiMap
--listmaps list all active and inactive maps
--listavailablemaps same as --listmaps, but without
unavailable map files
@@ -1617,12 +1746,15 @@ Explanation of the --setoption possibilities:
Whether dvips includes the standard 35 PostScript fonts in its output.
pdftexDownloadBase14 true|false (default true)
Whether pdftex includes the standard 14 PDF fonts in its output.
+ pxdviUse true|false (default false)
+ Whether maps for pxdvi (Japanese-patched xdvi) is under control of updmap.
LW35 URWkb|URW|ADOBEkb|ADOBE (default URWkb)
Adapt the font and file names of the standard 35 PostScript fonts.
URWkb URW fonts with "berry" filenames (e.g. uhvbo8ac.pfb)
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