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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
% Remark:
%
% This file is a merge of the original punk files by Donald Knuth, who
% added this comment:
%
% Font inspired by Gerard and Marjan Unger's lectures, Feb 1985
%
% The regular punk files are part of TeXLive and in metafont format. All
% errors introduced are ours. We also changed the encoding to unicode. In
% due time we might add a few more more characters. We still need to
% improve some of the metrics which involves a bit of trial and error. The
% font just covers basic latin shapes but in ConTeXt MkIV we add virtual
% composed shapes. There is a module m-punk.tex that implements this. This
% derivate is also used in mk.tex (mk.pdf) which is one of our tests for
% LuaTeX. We published an article on it in the MAPS (NTG magazine).
%
% 2008, Taco Hoekwater & Hans Hagen
if
unknown
punk_font_loaded
:
if
unknown
scale_factor
:
scale_factor
:
=
1
;
fi
;
boolean
punk_font_loaded
;
punk_font_loaded
:
=
true
;
warningcheck
:
=
0
;
proofing
:
=
0
;
designsize
:
=
10
pt
#
;
font_identifier
:
=
"
Punk Nova
"
;
% dedicated to Don Knuth and Hermann Zapf
ht
#
:
=
7
pt
#
;
% height of characters
u
#
:
=
1
/
4
pt
#
;
% unit width
dev
#
:
=
.3
pt
#
;
% standard deviation of punk points
if
known
bold_punk
:
s
#
:
=
1.2
pt
#
;
% extra sidebar
px
#
:
=
1
pt
#
;
% horizontal thickness of pen
py
#
:
=
.8
pt
#
;
% vertical thickness of pen
dot
#
:
=
1.7
pt
#
;
% diameter of dots
else
:
s
#
:
=
0
;
% extra sidebar, ok
px
#
:
=
.6
pt
#
;
% horizontal thickness of pen
py
#
:
=
.5
pt
#
;
% vertical thickness of pen
dot
#
:
=
1.3
pt
#
;
% diameter of dots
fi
;
pt
:
=
.1
pt
;
mag
:
=
scale_factor
*
10
;
bp_per_pixel
:
=
bpppix_
*
mag
;
define_pixels
(
u
,
dev
)
;
define_blacker_pixels
(
px
,
py
,
dot
)
;
define_whole_pixels
(
s
)
;
xoffset
:
=
s
;
pickup
pencircle
xscaled
px
yscaled
py
;
punk_pen
:
=
savepen
;
pickup
pencircle
scaled
dot
;
path
dot_pen_path
;
dot_pen_path
:
=
tensepath
makepath
currentpen
;
defaultcolormodel
:
=
1
;
if
known
slanted_punk
:
dot_pen_path
:
=
dot_pen_path
slanted
-0.25
;
extra_endchar
:
=
extra_endchar
&
"
currentpicture := currentpicture slanted 0.25 ;
"
;
fi
;
def
beginpunkchar
(
expr
c
,
n
,
h
,
v
)
=
% code $c$; width is $n$ units
hdev
:
=
h
*
dev
;
% modify horizontal amounts of deviation
vdev
:
=
v
*
dev
;
% modify vertical amounts of deviation
beginchar
(
c
,
n
*
u
#
,
ht
#
,
0
)
;
italcorr
0
;
% italcorr ht#*slant;
pickup
punk_pen
enddef
;
def
^
=
transformed
currenttransform
enddef
;
def
makebox
(
text
rule
)
=
for
y
=
0
,
h
:
% horizontals
rule
(
(
-
s
,
y
)
^
,
(
w
-
s
,
y
)
^
)
;
endfor
for
x
=
-
s
,
0
,
w
-2
s
,
w
-
s
:
% verticals
rule
(
(
x
,
0
)
^
,
(
x
,
h
)
^
)
;
endfor
enddef
;
rulepen
:
=
pensquare
;
vardef
pp
expr
z
=
z
+
(
hdev
*
normaldeviate
,
vdev
*
normaldeviate
)
enddef
;
def
pd
expr
z
=
% {\bf drawdot}
addto
currentpicture
contour
dot_pen_path
shifted
z
.
t_
% withpen penspeck
enddef
;
def
initialize_punk_upper
=
ht
#
:
=
7
pt
#
;
dev
#
:
=
.3
pt
#
;
enddef
;
def
initialize_punk_lower
=
sht
#
:
=
ht
#
;
sdev
:
=
dev
;
ht
#
:
=
.6
ht
#
;
dev
:
=
.7
dev
;
enddef
;
def
revert_punk_lower
=
ht
#
:
=
sht
#
;
dev
:
=
sdev
;
enddef
;
fi
;