blob: 1b9d2cdb3f72622947185f4e98bae67079dbbf44 (
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
|
@echo off
rem Wrapper script to configure and call dviout
rem
rem Originally written 2009 by Siep Kroonenberg and Tomasz M. Trzeciak
rem Public Domain
rem Make environment changes local
rem Disable delayed expansion (makes processing bang ! char easier)
setlocal enableextensions disabledelayedexpansion
rem Get TL installation root (w/o trailing backslash)
set tlroot=%~dp0:
set tlroot=%tlroot:\bin\win32\:=%
if not exist "%tlroot%\bin\win32\kpsewhich.exe" goto :no_tl
rem Make sure our bin dir is the first one on the path
path %tlroot%\bin\win32;%path%
rem Ask kpsewhich for TEXMFVAR
for /f "delims=" %%I in (
'kpsewhich --expand-var "$TEXMFVAR/fonts"'
) do (
set fontsdir=%%~fI
)
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" -NULL -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=%~sf1
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 the marker; this leaves us with a "...\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
|