summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-02-05 23:21:57 +0000
committerNorbert Preining <preining@logic.at>2012-02-05 23:21:57 +0000
commit2d1b4013b165e1ce117c1c08fe6005f66b880c7a (patch)
treecfcb63d7388dc7aeac099f027ca142a6c09e7d6c /Build
parentfcfcd6a1b62bb9f80ed10f4d91999f991d2af8ed (diff)
jfontmaps: include script, update linked_scripts, adjust ctan2tds, adjust
tlpsrc, add a README to Build/source/texk/texlive/linked_scripts/ git-svn-id: svn://tug.org/texlive/trunk@25294 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.am1
-rw-r--r--Build/source/texk/texlive/linked_scripts/README35
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji.pl295
3 files changed, 331 insertions, 0 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am
index 3fbb7c176fc..507ce1cc115 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.am
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.am
@@ -97,6 +97,7 @@ texmf_dist_other_scripts = \
fontools/showglyphs \
fragmaster/fragmaster.pl \
glossaries/makeglossaries \
+ jfontmaps/updmap-setup-kanji.pl \
latex2man/latex2man \
latexdiff/latexdiff.pl \
latexdiff/latexdiff-vc.pl \
diff --git a/Build/source/texk/texlive/linked_scripts/README b/Build/source/texk/texlive/linked_scripts/README
new file mode 100644
index 00000000000..8016d61c710
--- /dev/null
+++ b/Build/source/texk/texlive/linked_scripts/README
@@ -0,0 +1,35 @@
+source/texk/texlive/linked_scripts
+==================================
+
+This directory contains copies of the scripts that are shipped within
+TeX Live.
+
+Steps to add a new script:
+--------------------------
+* create a directory with the package name, and add the script
+* add the dir/script-name to Makefile.am in the respective section
+ (shell vs general interpreter, texmf vs texmf-dist)
+
+
+Other explanation from Makefile.am
+----------------------------------
+# The idea is to install the scripts themselves in texmf*/scripts, and
+# have bin/arch/foo be a symlink to, say,
+# ../../texmf-dist/scripts/foo/foo.pl. That way we save a bit of disk
+# space, but more importantly omit duplication, and most
+# importantly of all make it possible to invoke the same Perl script on
+# Windows (see ../w32_wrapper).
+#
+# The installation into texmf*/scripts is ideally done with ctan2tl.
+# The copy of the wrapper for Windows is also done by ctan2tl. (And
+# for shell scripts, its addition must be undone by hand.) The
+# check-wrapper-consistency script checks after the fact for problems.
+#
+# We also keep a copy of all the scripts here and install into the runtime.
+# This is purely for other distro builders, so symlinks are not dangling in
+# the inst/bin dir (it is meaningless in native TL). We have not yet
+# written the auto-update to ensure linked_scripts is actually up to date
+# with the masters in Master/texmf*/scripts, but one day.
+#
+# We support native builds, multiplatform or not, as well as distro builds.
+
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
new file mode 100755
index 00000000000..3797d9c41be
--- /dev/null
+++ b/Build/source/texk/texlive/linked_scripts/jfontmaps/updmap-setup-kanji.pl
@@ -0,0 +1,295 @@
+#!/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/
+#
+# 31 Jan 2012
+# rewrite in Perl, so that the script is usable under Windows
+# add command line options for help, dry-run, etc
+# support jis2004 via cmd line -jis2004
+# 27 Jan 2012 by PREINING Norbert <preining@logic.at> v0.9.2
+# support IPA and IPAex fonts
+# improve and extended documentation
+# 11 Nov 2011 by PREINING Norbert <preining@logic.at> v0.9.1
+# use kpsewhich for finding fonts
+# use updmap-sys --setoption kanjiEmbed to select the font family
+# use current names of map files
+# use different font name for Kozuka font, as used in the map file
+# get state from updmap.cfg, not from some state file
+# 27 May 2006 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.9
+# use noEmbed.map instead of noEmbeddedFont.map
+# 10 Jun 2005 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.8
+# modified to use updmap-sys in teTeX3
+# 07 Nov 2004 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.7
+# do not echo back the message of updmap.
+# 17 Oct 2004 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.6
+# set hiragino map file if nofont is installed and arg is auto.
+# 04 Oct 2004 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.5
+# handl standby map files more strictly
+# 20 Sep 2004 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.4
+# hand over current status to map file installer
+# 19 Sep 2004 by KOBAYASHI R. Taizo <tkoba965@mac.com> v0.3
+# handl *-udvips.map in TEXMF/dvipdfm/config/otf/
+# 02 Mar 2004 by KOBAYASHI R. Taizo <tkoba@ike-dyn.ritsumei.ac.jp> v0.2
+# added noFont-udvips.map
+# 28 Feb 2004 by KOBAYASHI R. Taizo <tkoba@ike-dyn.ritsumei.ac.jp> v0.1
+
+$^W = 1;
+use Getopt::Long qw(:config no_autoabbrev ignore_case_always);
+use strict;
+
+my $prg = "updmap-setup-kanji";
+my $version = '$Id: updmap-setup-kanji.pl 25259 2012-02-01 02:13:03Z preining $';
+
+my $updmap_real = "updmap-sys";
+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";
+}
+
+if ($dry_run) {
+ $updmap = "echo updmap-sys";
+}
+
+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 (perl) 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.
+
+ Usage: $prg {<fontname>|auto|nofont|status}
+
+ <fontname> embed fonts as defined by the map file otf-<fontname>.map
+ if it exists.
+ auto: embed one of the following supported font families
+ automatically:
+ hiragino, morisawa, kozuka, ipaex, ipa
+ 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
+
+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>/dev/null`;
+ 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=(.*)( \()?/) {
+ $STATUS = $1;
+ $STATUS =~ s/\s*$//;
+ $STATUS =~ s/^"(.*)"$/\1/;
+ } else {
+ printf STDERR "Cannot find status of current kanjiEmbed setting via updmap-sys --showoption!\n";
+ exit 1;
+ }
+
+ if (check_mapfile("otf-$STATUS.map")) {
+ print "CURRENT map file : otf-$STATUS.map\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 map file : $MAPFILE\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 -setoption kanjiEmbed $rep");
+ if ($opt_jis) {
+ system("$updmap -setoption kanjiVariant -04");
+ } else {
+ system("$updmap -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) = @_;
+
+ # mktexlsr 2> /dev/null
+
+ 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: