summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/vntex/vntex-update-maps
blob: b4124f4390fc3544e55dcee47488ed109478274e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env perl
#
# vntex-3.2.1
#
# vntex-update-maps
#
# Copyright 2007 Reinhard Kotucha <reinhard.kotucha@web.de>
#
# This work may be distributed and/or modified under the
# conditions of the LaTeX Project Public License, either version 1.3
# of this license or (at your option) any later version.
# The latest version of this license is in
#   http://www.latex-project.org/lppl.txt
# 
# The current maintainer is Reinhard Kotucha.

$^W=1;

use Getopt::Long;
$Getopt::Long::autoabbrev=0;

($basename=$0)=~s/.*\///;

sub usage {
    print <<"EOF";
Usage:

    $basename [-h] [-n] -home|-sys
    
	$basename adds font map files to updmap.cfg and 
	executes updmap in order to create the font databases.

	You have to use the -home option if you extracted VnTeX 
	to TEXMFHOME and you have to use the -sys option if you 
	extracted VnTeX to TEXMFLOCAL

 	$basename -help will tell you the content of the 
	variables TEXMFHOME and TEXMFLOCAL.
	
    Options:

	-h|--help  Print this message.

	-sys       Run updmap-sys.

	-home      Run updmap.

        -n         Print the commands that would be executed, but 
	           do not execute them.

EOF
;
}


unless (@ARGV) { usage and exit 1 }

GetOptions 
    "n",
    "sys",
    "home",
    "help|h";


sub expand_var {
    my $var=shift;

    if ($^O=~/^MSWin(32|64)$/i) {
        open KPSEWHICH, 'kpsewhich --expand-var=$'  . "$var |";
    } else {
        open KPSEWHICH, 'kpsewhich --expand-var=\$' . "$var |";
    }
    while (<KPSEWHICH>) {
        return "$_";
        chop;
    }
    close KPSEWHICH;
}


if ($opt_help) {
    usage;
    print "    TEXMFHOME=", expand_var 'TEXMFHOME';
    print "\n";
    print "    TEXMFLOCAL=",expand_var 'TEXMFLOCAL';
    print "\n";
    exit 0;
}

$chicken_mode=($opt_n)? 1:0;

if ($opt_home) {
    $sys=0;
} elsif ($opt_sys) {
    $sys=1;
} else {
    die "No target specified.  Valid arguments: -home or -sys.\n\n"
	. "Run: perl $basename -help\n\n";
}

$updmap_cmd=($sys)? "updmap-sys":"updmap";

while (<DATA>) {
    last if /^__/;
    next if /^\s*$/;
    s/\@UPDMAP\@/$updmap_cmd/;
    @command=split " ", $_;
    print "@command\n";
    system @command unless $chicken_mode;
}

print "$updmap_cmd\n";
system "$updmap_cmd" unless $chicken_mode;

__DATA__
@UPDMAP@ --nomkmap --nohash --disable vnr.map
@UPDMAP@ --nomkmap --nohash --enable MixedMap vnrtext.map
@UPDMAP@ --nomkmap --nohash --enable MixedMap vnrother.map
@UPDMAP@ --nomkmap --nohash --enable Map urwvn.map
@UPDMAP@ --nomkmap --nohash --enable Map chartervn.map
@UPDMAP@ --nomkmap --nohash --enable Map mscorevn.map
@UPDMAP@ --nomkmap --nohash --enable Map arevvn.map
@UPDMAP@ --nomkmap --nohash --enable Map classicovn.map
@UPDMAP@ --nomkmap --nohash --enable Map cmbrightvn.map
@UPDMAP@ --nomkmap --nohash --enable Map comicvn.map
@UPDMAP@ --nomkmap --nohash --enable Map concretevn.map
@UPDMAP@ --nomkmap --nohash --enable Map garamondvn.map
@UPDMAP@ --nomkmap --nohash --enable Map grotesqvn.map
@UPDMAP@ --nomkmap --nohash --enable Map vntopia.map
@UPDMAP@ --nomkmap --nohash --enable Map txttvn.map