From 9dfb2e59a988e766dd444e4df31c161a3bdb8e03 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 11 Apr 2013 00:39:11 +0000 Subject: update source linked_scripts for new jfontmaps git-svn-id: svn://tug.org/texlive/trunk@29850 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/texk/texlive/linked_scripts/Makefile.am | 4 +- .../source/texk/texlive/linked_scripts/Makefile.in | 4 +- .../jfontmaps/kanji-config-updmap-sys.sh | 31 +++ .../jfontmaps/kanji-config-updmap.pl | 299 +++++++++++++++++++++ .../jfontmaps/updmap-setup-kanji-sys.sh | 31 --- .../linked_scripts/jfontmaps/updmap-setup-kanji.pl | 291 -------------------- .../source/texk/texlive/linked_scripts/scripts.lst | 4 +- 7 files changed, 336 insertions(+), 328 deletions(-) create mode 100755 Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap-sys.sh create mode 100755 Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap.pl delete mode 100755 Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji-sys.sh delete mode 100755 Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji.pl (limited to 'Build') diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 120524abc4a..b9715d12db5 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -102,8 +102,8 @@ texmf_other_scripts = \ fragmaster/fragmaster.pl \ glossaries/makeglossaries \ jfontmaps/kanji-fontmap-creator.pl \ - jfontmaps/updmap-setup-kanji.pl \ - jfontmaps/updmap-setup-kanji-sys.sh \ + jfontmaps/kanji-config-updmap.pl \ + jfontmaps/kanji-config-updmap-sys.sh \ latex2man/latex2man \ latexdiff/latexdiff.pl \ latexdiff/latexdiff-vc.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index d3472726fef..58bc635805e 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -279,8 +279,8 @@ texmf_other_scripts = \ fragmaster/fragmaster.pl \ glossaries/makeglossaries \ jfontmaps/kanji-fontmap-creator.pl \ - jfontmaps/updmap-setup-kanji.pl \ - jfontmaps/updmap-setup-kanji-sys.sh \ + jfontmaps/kanji-config-updmap.pl \ + jfontmaps/kanji-config-updmap-sys.sh \ latex2man/latex2man \ latexdiff/latexdiff.pl \ latexdiff/latexdiff-vc.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap-sys.sh b/Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap-sys.sh new file mode 100755 index 00000000000..92ff2248727 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap-sys.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# updmap-kanji-sys: +# copy of fmtutil-sys by Thomas Esser, public domain. + +# wrapper script for updmap-setup-kanji with TEXMFVAR and TEXMFCONFIG set to +# TEXMFSYSVAR / TEXMFSYSCONFIG + +test -f /bin/ksh && test -z "$RUNNING_KSH" \ + && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \ + && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; } +unset RUNNING_KSH + +test -f /bin/bsh && test -z "$RUNNING_BSH" \ + && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \ + && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; } +unset RUNNING_BSH + +# hack around a bug in zsh: +test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"' +export PATH + +v=`kpsewhich -var-value TEXMFSYSVAR` +c=`kpsewhich -var-value TEXMFSYSCONFIG` + +TEXMFVAR="$v" +TEXMFCONFIG="$c" +export TEXMFVAR TEXMFCONFIG + +exec updmap-kanji ${1+"$@"} + diff --git a/Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap.pl b/Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap.pl new file mode 100755 index 00000000000..7ffc386965f --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/jfontmaps/kanji-config-updmap.pl @@ -0,0 +1,299 @@ +#!/usr/bin/env perl +# kanji-config-updmap: setup Japanese font embedding +# Version 20130410.0 +# +# formerly known as updmap-setup-kanji +# +# Copyright 2004-2006 by KOBAYASHI R. Taizo for the shell version (updmap-otf) +# Copyright 2011-2013 by PREINING Norbert +# +# This file is licensed under GPL version 3 or any later version. +# For copyright statements see end of file. +# +# For development see +# https://git.gitorious.org/tlptexlive/jfontmaps.git +# +# For a changelog see +# https://gitorious.org/tlptexlive/jfontmaps/blobs/master/ChangeLog +# + +$^W = 1; +use Getopt::Long qw(:config no_autoabbrev ignore_case_always); +use strict; + +my $prg = "kanji-config-updmap"; +my $version = "20130410.0"; + +my $updmap_real = "updmap"; +my $updmap = $updmap_real; + +my $dry_run = 0; +my $opt_help = 0; +my $opt_jis = 0; + +if (! GetOptions( + "n|dry-run" => \$dry_run, + "h|help" => \$opt_help, + "jis2004" => \$opt_jis, + "version" => sub { print &version(); exit(0); }, ) ) { + die "Try \"$0 --help\" for more information.\n"; +} + + +sub win32 { return ($^O=~/^MSWin(32|64)$/i); } + +my $nul = (win32() ? 'nul' : '/dev/null') ; + + +if ($dry_run) { + $updmap = "echo updmap"; +} + +if ($opt_help) { + Usage(); + exit 0; +} + +# +# representatives of support font families +# +my %representatives = ( + "hiragino" => "HiraMinPro-W3.otf", + "hiragino-pron" => "HiraMinProN-W3.otf", + "morisawa" => "A-OTF-RyuminPro-Light.otf", + "morisawa-pr6n" => "A-OTF-RyuminPr6N-Light.otf", + "kozuka" => "KozMinPro-Regular.otf", + "kozuka-pr6n" => "KozMinPr6N-Regular.otf", + "kozuka-pr6" => "KozMinProVI-Regular.otf", + "ipa" => "ipam.ttf", + "ipaex" => "ipaexm.ttf", + "ms" => "msgothic.tcc", +); +my %available; + + +main(@ARGV); + +sub version { + my $ret = sprintf "%s version %s\n", + $prg, $version; + return $ret; +} + +sub Usage { + my $usage = <<"EOF"; + $prg Set up embedding of Japanese fonts via updmap.cfg. + + This script searches for some of the most common fonts + for embedding into pdfs by dvipdfmx. + + In addition it allows to set up arbitrary font families + to be embedded into the generated pdf files, as long + as at least the map file otf-.map is present. + Other map files that will be used if available are + + ptex-.map + uptex-.map + otf-up-.map + + Please see the documentation of updmap for details (updmap --help). + + Usage: $prg [OPTION] {|auto|nofont|status} + + embed an arbitrary font family , at least the + map file otf-.map has to be available. + auto: embed one of the following supported font families + automatically: + hiragino, hiragino-pron, morisawa, morisawa-pr6n, + kozuka, kozuka-pr6, kozuka-pr6n, ipaex, ipa, ms + and fall back to not embedding any font if none of them + is available + nofont: embed no fonts (and rely on system fonts when displaying pdfs) + If your system does not have any of the supported font + families as specified above, this target is selected + automatically. + status: get information about current environment and usable font map + + Options: + -n, --dry-run do not actually run updmap + -h, --help show this message and exit + -jis2004 use JIS2004 variants for default fonts of (u)pTeX + --version show version information and exit + +EOF +; + print $usage; + exit 0; +} + + + +### +### Check Installed Font +### + +sub CheckInstallFont { + for my $k (keys %representatives) { + my $f = `kpsewhich $representatives{$k}`; + if (! $?) { + $available{$k} = chomp($f); + } + } +} + +### +### GetStatus +### + +sub check_mapfile { + my $mapf = shift; + my $f = `kpsewhich $mapf 2> $nul`; + my $ret = $?; + if (wantarray) { + return (!$ret, $f); + } else { + return (!$ret); + } +} + +sub GetStatus { + my $val = `$updmap_real --quiet --showoption kanjiEmbed`; + my $STATUS; + if ($val =~ m/^kanjiEmbed=([^()\s]*)(\s+\()?/) { + $STATUS = $1; + } else { + printf STDERR "Cannot find status of current kanjiEmbed setting via updmap --showoption!\n"; + exit 1; + } + + if (check_mapfile("ptex-$STATUS.map")) { + print "CURRENT family : $STATUS\n"; + } else { + print "WARNING: Currently selected map file cannot be found: ptex-$STATUS.map\n"; + } + + for my $k (sort keys %representatives) { + my $MAPFILE = "ptex-$k.map"; + next if ($MAPFILE eq "ptex-$STATUS.map"); + if (check_mapfile($MAPFILE)) { + if ($available{$k}) { + print "Standby family : $k\n"; + } + } + } + return $STATUS; +} + +### +### Setup Map files +### + +sub SetupMapFile { + my $rep = shift; + my $MAPFILE = "ptex-$rep.map"; + if (check_mapfile($MAPFILE)) { + print "Setting up ... $MAPFILE\n"; + system("$updmap --quiet --nomkmap --nohash -setoption kanjiEmbed $rep"); + if ($opt_jis) { + system("$updmap --quiet --nomkmap --nohash -setoption kanjiVariant -04"); + } else { + system("$updmap --quiet --nomkmap --nohash -setoption kanjiVariant \"\""); + } + system("$updmap"); + } else { + print "NOT EXIST $MAPFILE\n"; + exit 1; + } +} + +sub SetupReplacement { + my $rep = shift; + if (defined($representatives{$rep})) { + if ($available{$rep}) { + return SetupMapFile($rep); + } else { + printf STDERR "$rep not available, falling back to auto!\n"; + return SetupReplacement("auto"); + } + } else { + if ($rep eq "nofont") { + return SetupMapFile("noEmbed"); + } elsif ($rep eq "auto") { + my $STATUS = GetStatus(); + # first check if we have a status set and the font is installed + # in this case don't change anything, just make sure + if (defined($representatives{$STATUS}) && $available{$STATUS}) { + return SetupMapFile($STATUS); + } else { + if (!($STATUS eq "noEmbed" || $STATUS eq "")) { + # some unknown setting is set up currently, overwrite, but warn + print "Previous setting $STATUS is unknown, replacing it!\n" + } + # if we are in the noEmbed or nothing set case, but one + # of the three fonts hiragino/morisawa/kozuka are present + # then use them + for my $i (qw/hiragino morisawa kozuka ipaex ipa/) { + if ($available{$i}) { + return SetupMapFile($i); + } + } + # still here, no map file found! + return SetupMapFile("noEmbed"); + } + } else { + # anything else is treated as a map file name + return SetupMapFile($rep); + } + } +} + +### +### MAIN +### + +sub main { + my ($a, $b) = @_; + + CheckInstallFont(); + + if (!defined($a) || defined($b)) { + Usage(); + exit 1; + } + + if ($a eq "status") { + GetStatus(); + exit 0; + } + + return SetupReplacement($a); +} + +# +# +# Copyright statements: +# +# KOBAYASHI Taizo +# email to preining@logic.at +# Message-Id: <20120130.162953.59640143170594580.tkoba@cc.kyushu-u.ac.jp> +# Message-Id: <20120201.105639.625859878546968959.tkoba@cc.kyushu-u.ac.jp> +# -------------------------------------------------------- +# copyright statement は簡単に以下で結構です。 +# +# Copyright 2004-2006 by KOBAYASHI Taizo +# +# では +# GPL version 3 or any later version +# +# -------------------------------------------------------- +# +# PREINING Norbert +# as author and maintainer of the current file +# Licensed under GPL version 3 or any later version +# +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim: set tabstop=2 expandtab autoindent: diff --git a/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji-sys.sh b/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji-sys.sh deleted file mode 100755 index f84fcd7a671..00000000000 --- a/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji-sys.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# updmap-setup-kanji-sys: -# copy of fmtutil-sys by Thomas Esser, public domain. - -# wrapper script for updmap-setup-kanji with TEXMFVAR and TEXMFCONFIG set to -# TEXMFSYSVAR / TEXMFSYSCONFIG - -test -f /bin/ksh && test -z "$RUNNING_KSH" \ - && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \ - && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; } -unset RUNNING_KSH - -test -f /bin/bsh && test -z "$RUNNING_BSH" \ - && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \ - && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; } -unset RUNNING_BSH - -# hack around a bug in zsh: -test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"' -export PATH - -v=`kpsewhich -var-value TEXMFSYSVAR` -c=`kpsewhich -var-value TEXMFSYSCONFIG` - -TEXMFVAR="$v" -TEXMFCONFIG="$c" -export TEXMFVAR TEXMFCONFIG - -exec updmap-setup-kanji ${1+"$@"} - diff --git a/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji.pl b/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji.pl deleted file mode 100755 index 367fddff829..00000000000 --- a/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji.pl +++ /dev/null @@ -1,291 +0,0 @@ -#!/usr/bin/env perl -# updmap-setup-kanji: setup Japanese font embedding -# -# Copyright 2004-2006 by KOBAYASHI R. Taizo for the shell version (updmap-otf) -# Copyright 2011-2012 by PREINING Norbert -# -# This file is licensed under GPL version 3 or any later version. -# For copyright statements see end of file. -# -# For development see -# http://www.tug.org/svn/texlive/trunk/Build/source/extra/jfontmaps/ -# -# For a changelog see -# http://www.tug.org/svn/texlive/trunk/Build/source/extra/jfontmaps/ChangeLog -# - -$^W = 1; -use Getopt::Long qw(:config no_autoabbrev ignore_case_always); -use strict; - -my $prg = "updmap-setup-kanji"; -my $vers = "0.9.6"; -my $version = '$Id: updmap-setup-kanji.pl 27277 2012-08-02 00:16:14Z karl $'; - -my $updmap_real = "updmap"; -my $updmap = $updmap_real; - -my $dry_run = 0; -my $opt_help = 0; -my $opt_jis = 0; - -if (! GetOptions( - "n|dry-run" => \$dry_run, - "h|help" => \$opt_help, - "jis2004" => \$opt_jis, - "version" => sub { print &version(); exit(0); }, ) ) { - die "Try \"$0 --help\" for more information.\n"; -} - - -sub win32 { return ($^O=~/^MSWin(32|64)$/i); } - -my $nul = (win32() ? 'nul' : '/dev/null') ; - - -if ($dry_run) { - $updmap = "echo updmap"; -} - -if ($opt_help) { - Usage(); - exit 0; -} - -# -# representatives of support font families -# -my %representatives = ( - hiragino => "HiraMinPro-W3.otf", - morisawa => "A-OTF-RyuminPro-Light.otf", - kozuka => "KozMinPro-Regular.otf", - ipa => "ipam.ttf", - ipaex => "ipaexm.ttf", -); -my %available; - - -main(@ARGV); - -sub version { - my $ret = sprintf "%s version %s\n(svn id: %s)\n", - $prg, $vers, $version; - return $ret; -} - -sub Usage { - my $usage = <<"EOF"; - $prg Set up embedding of Japanese fonts via updmap.cfg. - - This script searches for some of the most common fonts - for embedding into pdfs by dvipdfmx. - - In addition it allows to set up arbitrary font families - to be embedded into the generated pdf files, as long - as at least the map file otf-.map is present. - Other map files that will be used if available are - - ptex-.map - uptex-.map - otf-up-.map - - Please see the documentation of updmap for details (updmap --help). - - Usage: $prg [OPTION] {|auto|nofont|status} - - embed an arbitrary font family , at least the - map file otf-.map has to be available. - auto: embed one of the following supported font families - automatically: - hiragino, morisawa, kozuka, ipaex, ipa - and fall back to not embedding any font if none of them - is available - nofont: embed no fonts (and rely on system fonts when displaying pdfs) - If your system does not have any of the supported font - families as specified above, this target is selected - automatically. - status: get information about current environment and usable font map - - Options: - -n, --dry-run do not actually run updmap - -h, --help show this message and exit - -jis2004 use JIS2004 variants for default fonts of (u)pTeX - --version show version information and exit - -EOF -; - print $usage; - exit 0; -} - - - -### -### Check Installed Font -### - -sub CheckInstallFont { - for my $k (keys %representatives) { - my $f = `kpsewhich $representatives{$k}`; - if (! $?) { - $available{$k} = chomp($f); - } - } -} - -### -### GetStatus -### - -sub check_mapfile { - my $mapf = shift; - my $f = `kpsewhich $mapf 2> $nul`; - my $ret = $?; - if (wantarray) { - return (!$ret, $f); - } else { - return (!$ret); - } -} - -sub GetStatus { - my $val = `$updmap_real --quiet --showoption kanjiEmbed`; - my $STATUS; - if ($val =~ m/^kanjiEmbed=([^()\s]*)(\s+\()?/) { - $STATUS = $1; - } else { - printf STDERR "Cannot find status of current kanjiEmbed setting via updmap --showoption!\n"; - exit 1; - } - - if (check_mapfile("otf-$STATUS.map")) { - print "CURRENT family : $STATUS\n"; - } else { - print "WARNING: Currently selected map file cannot be found: otf-$STATUS.map\n"; - } - - for my $k (sort keys %representatives) { - my $MAPFILE = "otf-$k.map"; - next if ($MAPFILE eq "otf-$STATUS.map"); - if (check_mapfile($MAPFILE)) { - if ($available{$k}) { - print "Standby family : $k\n"; - } - } - } - return $STATUS; -} - -### -### Setup Map files -### - -sub SetupMapFile { - my $rep = shift; - my $MAPFILE = "otf-$rep.map"; - if (check_mapfile($MAPFILE)) { - print "Setting up ... $MAPFILE\n"; - system("$updmap --quiet --nomkmap --nohash -setoption kanjiEmbed $rep"); - if ($opt_jis) { - system("$updmap --quiet --nomkmap --nohash -setoption kanjiVariant -04"); - } else { - system("$updmap --quiet --nomkmap --nohash -setoption kanjiVariant \"\""); - } - system("$updmap"); - } else { - print "NOT EXIST $MAPFILE\n"; - exit 1; - } -} - -sub SetupReplacement { - my $rep = shift; - if (defined($representatives{$rep})) { - if ($available{$rep}) { - return SetupMapFile($rep); - } else { - printf STDERR "$rep not available, falling back to auto!\n"; - return SetupReplacement("auto"); - } - } else { - if ($rep eq "nofont") { - return SetupMapFile("noEmbed"); - } elsif ($rep eq "auto") { - my $STATUS = GetStatus(); - # first check if we have a status set and the font is installed - # in this case don't change anything, just make sure - if (defined($representatives{$STATUS}) && $available{$STATUS}) { - return SetupMapFile($STATUS); - } else { - if (!($STATUS eq "noEmbed" || $STATUS eq "")) { - # some unknown setting is set up currently, overwrite, but warn - print "Previous setting $STATUS is unknown, replacing it!\n" - } - # if we are in the noEmbed or nothing set case, but one - # of the three fonts hiragino/morisawa/kozuka are present - # then use them - for my $i (qw/hiragino morisawa kozuka ipaex ipa/) { - if ($available{$i}) { - return SetupMapFile($i); - } - } - # still here, no map file found! - return SetupMapFile("noEmbed"); - } - } else { - # anything else is treated as a map file name - return SetupMapFile($rep); - } - } -} - -### -### MAIN -### - -sub main { - my ($a, $b) = @_; - - CheckInstallFont(); - - if (!defined($a) || defined($b)) { - Usage(); - exit 1; - } - - if ($a eq "status") { - GetStatus(); - exit 0; - } - - return SetupReplacement($a); -} - -# -# -# Copyright statements: -# -# KOBAYASHI Taizo -# email to preining@logic.at -# Message-Id: <20120130.162953.59640143170594580.tkoba@cc.kyushu-u.ac.jp> -# Message-Id: <20120201.105639.625859878546968959.tkoba@cc.kyushu-u.ac.jp> -# -------------------------------------------------------- -# copyright statement は簡単に以下で結構です。 -# -# Copyright 2004-2006 by KOBAYASHI Taizo -# -# では -# GPL version 3 or any later version -# -# -------------------------------------------------------- -# -# PREINING Norbert -# as author and maintainer of the current file -# Licensed under GPL version 3 or any later version -# -### Local Variables: -### perl-indent-level: 2 -### tab-width: 2 -### indent-tabs-mode: nil -### End: -# vim: set tabstop=2 expandtab autoindent: diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index 96a46245afb..c83550dde7e 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -51,8 +51,8 @@ fontools/ot2kpx fragmaster/fragmaster.pl glossaries/makeglossaries jfontmaps/kanji-fontmap-creator.pl -jfontmaps/updmap-setup-kanji.pl -jfontmaps/updmap-setup-kanji-sys.sh +jfontmaps/kanji-config-updmap.pl +jfontmaps/kanji-config-updmap-sys.sh latex2man/latex2man latexdiff/latexdiff.pl latexdiff/latexdiff-vc.pl -- cgit v1.2.3