punkfont-definitions.mp /size: 3465 b    last modification: 2020-07-01 14:35
1
% Remark:
2
%
3
% This file is a merge of the original punk files by Donald Knuth, who
4
% added this comment:
5
%
6
% Font inspired by Gerard and Marjan Unger's lectures, Feb 1985
7
%
8
% The regular punk files are part of TeXLive and in metafont format. All
9
% errors introduced are ours. We also changed the encoding to unicode. In
10
% due time we might add a few more more characters. We still need to
11
% improve some of the metrics which involves a bit of trial and error. The
12
% font just covers basic latin shapes but in ConTeXt MkIV we add virtual
13
% composed shapes. There is a module m-punk.tex that implements this. This
14
% derivate is also used in mk.tex (mk.pdf) which is one of our tests for
15
% LuaTeX. We published an article on it in the MAPS (NTG magazine).
16
%
17
% 2008, Taco Hoekwater & Hans Hagen
18 19
if
unknown
punk_font_loaded
:
20 21
if
unknown
scale_factor
:
22
scale_factor
:
=
1
;
23
fi
;
24 25
boolean
punk_font_loaded
;
26 27
punk_font_loaded
:
=
true
;
28
warningcheck
:
=
0
;
29
proofing
:
=
0
;
30
designsize
:
=
10
pt
#
;
31
font_identifier
:
=
"
Punk Nova
"
;
% dedicated to Don Knuth and Hermann Zapf
32 33
ht
#
:
=
7
pt
#
;
% height of characters
34
u
#
:
=
1
/
4
pt
#
;
% unit width
35
dev
#
:
=
.3
pt
#
;
% standard deviation of punk points
36 37
if
known
bold_punk
:
38
s
#
:
=
1.2
pt
#
;
% extra sidebar
39
px
#
:
=
1
pt
#
;
% horizontal thickness of pen
40
py
#
:
=
.8
pt
#
;
% vertical thickness of pen
41
dot
#
:
=
1.7
pt
#
;
% diameter of dots
42
else
:
43
s
#
:
=
0
;
% extra sidebar, ok
44
px
#
:
=
.6
pt
#
;
% horizontal thickness of pen
45
py
#
:
=
.5
pt
#
;
% vertical thickness of pen
46
dot
#
:
=
1.3
pt
#
;
% diameter of dots
47
fi
;
48 49
pt
:
=
.1
pt
;
50
mag
:
=
scale_factor
*
10
;
51
bp_per_pixel
:
=
bpppix_
*
mag
;
52 53
define_pixels
(
u
,
dev
)
;
54
define_blacker_pixels
(
px
,
py
,
dot
)
;
55
define_whole_pixels
(
s
)
;
56
xoffset
:
=
s
;
57 58
pickup
pencircle
xscaled
px
yscaled
py
;
59
punk_pen
:
=
savepen
;
60
pickup
pencircle
scaled
dot
;
61
path
dot_pen_path
;
62
dot_pen_path
:
=
tensepath
makepath
currentpen
;
63 64
defaultcolormodel
:
=
1
;
65 66
if
known
slanted_punk
:
67
dot_pen_path
:
=
dot_pen_path
slanted
-0.25
;
68
extra_endchar
:
=
extra_endchar
&
"
currentpicture := currentpicture slanted 0.25 ;
"
;
69
fi
;
70 71 72
def
beginpunkchar
(
expr
c
,
n
,
h
,
v
)
=
% code $c$; width is $n$ units
73
hdev
:
=
h
*
dev
;
% modify horizontal amounts of deviation
74
vdev
:
=
v
*
dev
;
% modify vertical amounts of deviation
75
beginchar
(
c
,
n
*
u
#
,
ht
#
,
0
)
;
76
italcorr
0
;
77
% italcorr ht#*slant;
78
pickup
punk_pen
79
enddef
;
80 81
def
^
=
82
transformed
currenttransform
83
enddef
;
84 85
def
makebox
(
text
rule
)
=
86
for
y
=
0
,
h
:
% horizontals
87
rule
(
(
-
s
,
y
)
^
,
(
w
-
s
,
y
)
^
)
;
88
endfor
89
for
x
=
-
s
,
0
,
w
-2
s
,
w
-
s
:
% verticals
90
rule
(
(
x
,
0
)
^
,
(
x
,
h
)
^
)
;
91
endfor
92
enddef
;
93 94
rulepen
:
=
pensquare
;
95 96
vardef
pp
expr
z
=
97
z
+
(
hdev
*
normaldeviate
,
vdev
*
normaldeviate
)
98
enddef
;
99 100
def
pd
expr
z
=
% {\bf drawdot}
101
addto
currentpicture
contour
dot_pen_path
shifted
z
.
t_
% withpen penspeck
102
enddef
;
103 104
def
initialize_punk_upper
=
105
ht
#
:
=
7
pt
#
;
dev
#
:
=
.3
pt
#
;
106
enddef
;
107
def
initialize_punk_lower
=
108
sht
#
:
=
ht
#
;
sdev
:
=
dev
;
109
ht
#
:
=
.6
ht
#
;
dev
:
=
.7
dev
;
110
enddef
;
111
def
revert_punk_lower
=
112
ht
#
:
=
sht
#
;
dev
:
=
sdev
;
113
enddef
;
114 115
fi
;
116