summaryrefslogtreecommitdiff
path: root/fonts/utilities/t1tools/afm-inf.bat
blob: e88bb004c39586c7ef48a6a182b9bf3dad6d1770 (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
@echo off
set dumvar=
set del=
if not "%1"=="-" goto mach
set del=rem
shift

:mach
egrep CapHeight %1.afm > %1.inf
if not errorlevel 1 goto capok
egrep FontBBox %1.afm | sed "s,.* \([-0-9][-0-9]*\) *$,CapHeight \1," > %1.inf
:capok
echo Serif true >> %1.inf
echo Pi false >> %1.inf
:getstyle
if "%3"=="" goto genstyle
echo VPStyle (%3) >> %1.inf
goto getname
:genstyle
egrep "FontName.*(Demi|Semi|Bold|Heavy|Black|Ultra|Three)" %1.afm > nul
if errorlevel 1 goto testweight
goto testobl
:testweight
egrep "Weight.*(Demi|Semi|Bold|Heavy|Black|Ultra)" %1.afm > nul
if errorlevel 1 goto notbold
:testobl
egrep "FontName.*(Italic|Oblique|Slanted)" %1.afm > nul
if errorlevel 1 goto bold
echo ItalicAngle -20 >> %1.inf
echo VPStyle (T) >> %1.inf
goto getname
:bold
echo VPStyle (B) >> %1.inf
goto getname
:notbold
egrep "FontName.*(Italic|Oblique|Slanted)" %1.afm > nul
if errorlevel 1 goto normal
echo ItalicAngle -20 >> %1.inf
echo VPStyle (I) >> %1.inf
goto getname
:normal
echo VPStyle (N) >> %1.inf

:getname
if "%2"=="" goto genname
if "%2"=="-" goto genname
if not "%3"=="" echo DOS command restriction: family name may not contain blanks
echo MSMenuName (%2) >> %1.inf
goto end

rem this was used with dos grep and without sed:
:gennameold
grep FamilyName %1.afm | sort > MSMenu$$.bat
call MSMenu$$.bat
type MSMenu$$.i >> %1.inf
%del% del MSMenu$$.bat
%del% del MSMenu$$.i
goto end

:genname
egrep -e FamilyName %1.afm | sed "s,FamilyName *\(.*\) *$,MSMenuName (\1)," >> %1.inf
rem with DOS grep, grep -o could be used here instead of egrep -e

:end