summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Strzelczyk <piotr@eps.gda.pl>2009-05-09 16:32:54 +0000
committerPiotr Strzelczyk <piotr@eps.gda.pl>2009-05-09 16:32:54 +0000
commit8ab401f2568d1d5227a3201a82d62a9588f173fb (patch)
tree5067c9a74a9f02e3de2928c2228b2aceb1c2c6d7
parentbb7ca2b540ca8a15459c1f1a1aa61915494e2667 (diff)
.bat replacement for dviout.vbs
git-svn-id: svn://tug.org/texlive/branches/branch2009-dev@13022 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/bin/win32/dviout.bat77
1 files changed, 77 insertions, 0 deletions
diff --git a/Master/bin/win32/dviout.bat b/Master/bin/win32/dviout.bat
new file mode 100755
index 00000000000..211a3121fd9
--- /dev/null
+++ b/Master/bin/win32/dviout.bat
@@ -0,0 +1,77 @@
+@echo off
+rem Wrapper script to configure and call dviout
+rem
+rem Copyright 2009 by Siep Kroonenberg and Tomasz M. Trzeciak
+rem Public Domain
+
+setlocal enableextensions disabledelayedexpansion
+
+rem Ask kpsewhich for TLROOT and TEXMFVAR
+set tlroot=
+for /f "tokens=1,2 delims=;" %%I in (
+ 'kpsewhich --expand-var "$SELFAUTOPARENT;$TEXMFVAR"'
+) do (
+ set tlroot=%%~sfI
+ set fontsdir=%%~fJ\fonts
+)
+if not defined tlroot goto :no_tl
+if not exist "%fontsdir%\" md "%fontsdir%"
+if not exist "%fontsdir%\" goto :no_fontsdir
+
+rem Ask kpsewhich for TFM search path
+for /f "delims=" %%I in (
+ 'kpsewhich --show-path tfm'
+) do (
+ set tfmpath=%%I
+)
+rem Remove kpse specific syntax from path definition, change slash to backslash
+set tfmpath=%tfmpath:!!=%
+set tfmpath=%tfmpath:/=\%
+rem Split font path var into arguments and rebuild it with only existing 'fonts' dirs
+call :build_tfmpath ";" "%tfmpath:;=" "%"
+
+rem Use TL gostscript
+set GS_LIB=%tlroot%\tlpkg\tlgs\fonts;%tlroot%\tlpkg\tlgs\lib;%tlroot%\tlpkg\tlgs\Resource
+path %tlroot%\tlpkg\tlgs\bin;%path%
+
+rem Assemble dviout command
+set cmdstr="%tlroot%\tlpkg\dviout\dviout.exe" -TEXROOT="%tfmpath%"
+set cmdstr=%cmdstr% -TEXPK="^r\pk\\^s.^dpk;^r\tfm\\^s^tfm;^r\vf\\^s.vf;^r\ovf\\^s.ovf;^r\tfm\\^s.tfm"
+rem Start dviout
+start "" %cmdstr% %*
+goto :eof
+
+rem Soubroutine to build font path only with existing "...\fonts" directories
+rem Directories to process are supplied as arguments
+:build_tfmpath ";" dir list ...
+shift
+rem The first argument (";") serves as a marker to reset the path
+if "%~0"==";" set tfmpath=
+rem Finish if no more arguments to process
+if "%~1"=="" goto :eof
+rem Get short path (dviout has problems with long ones)
+set fontsdir=%~f1
+rem Substitute "\fonts\tfm" in dir name with a marker
+rem String substitution in expanded vars is case insensitive
+set fontsdir=%fontsdir:\fonts\tfm=\fonts;%
+rem Continue if no substitution
+if "%fontsdir%"=="%~sf1" goto :build_tfmpath
+rem Split dir name on marker; this leaves us with "...\fonts" dir
+for /f "delims=;" %%I in ("%fontsdir%") do (set fontsdir=%%~sfI)
+rem Continue if dir does not exist
+if not exist "%fontsdir%\" goto :build_tfmpath
+rem Add dir to path
+if not defined tfmpath (
+ set tfmpath=%fontsdir%
+) else (
+ set tfmpath=%tfmpath%;%fontsdir%
+)
+goto :build_tfmpath
+
+:no_tl
+echo TeX Live not found; aborting...>&2
+exit /b 1
+
+:no_fontsdir
+echo No place to put bitmaps; aborting...>&2
+exit /b 1