summaryrefslogtreecommitdiff
path: root/fonts/marvosym/source/fonts/marvosym/generate_marvosym_derivs.sh
blob: 09ad70e55852c9ae250062a243e7b3cecd986986 (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
#!/bin/sh

sourcedir=$PWD
cd ../../../
TDS=$PWD

write_comment()
{
	echo
	echo "# $1"
	echo
}

check_for_success()
{
	if [ "x$1" == "x0" ]; then
		echo "    OK"
	else
		echo "    failed (return code: $1)"
		return -1
	fi
}

run_command()
{
	echo ">>> running: '$1'"
	$1
	check_for_success $?
}


mvs=marvosym

patchA="$sourcedir/patch_marvosym_afm.sed"
patchB="$sourcedir/patch_marvosym_pfb.sed"
fileA="$TDS/fonts/afm/public/$mvs/$mvs.afm"
fileB="$TDS/fonts/type1/public/$mvs/$mvs.pfb"

# the reason why I first move and then edit in place is that somebody might
# want to change licence or something else in afm/pfb without running the
# conversion itself
write_comment "create type1 fonts"
run_command   "cd $TDS/fonts/truetype/public/$mvs"
run_command   "ttf2pt1 -b $mvs.ttf"
run_command   "mv $mvs.afm $fileA"
run_command   "mv $mvs.pfb $fileB"

write_comment "patch comments in afm"
echo "\$\$ sed -i \"\" -f $patchA $fileA"
sed -i "" -f $patchA $fileA
check_for_success $?

write_comment "patch comments in pfb"
run_command   "cd $TDS/fonts/type1/public/$mvs"
write_comment "create ascii version of the font first (disassemble)"
run_command   "t1disasm $mvs.pfb $mvs.pfb.txt"
write_comment "apply a patch to that one"
echo "\$\$ sed -i \"\" -f $patchB $fileB.txt"
sed -i "" -f $patchB $fileB.txt
check_for_success $?
write_comment "convert the font back into binary"
run_command   "t1asm $mvs.pfb.txt $mvs.pfb"
run_command   "rm $mvs.pfb.txt"

write_comment "create tex metrics"
run_command   "cd $TDS/fonts/afm/public/marvosym"
run_command   "afm2tfm marvosym.afm"
run_command   "mv marvosym.tfm $TDS/fonts/tfm/public/marvosym/umvs.tfm"