summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/public/knitting/knit_dimens.mf
blob: e705e163dfba8a6c4442340edfd2172b0bcb56da (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
% Date: 2010/08/10

widewd# = 16.3pt#; 
% This is as wide as a cell can be without causing problems with 5-cell-wide symbols
if known wd#: else: wd# = 12 pt#; fi
 ht# + dp# = 12 pt#; ht#-dp# = 6.44444pt#;
 
 symbolwidth#=0.7pt#;
 purl_symbolwidth#=0.7pt#;
 finesymbolwidth# = 0.4pt#;
 gridwidth#  = if gridfont: 0.3pt# else: 0pt# fi; 
 overlinewd# = if gridfont: 1.5pt# else: 0.8pt# fi; 
 
eraserwidth# = 3pt#;
wrapturngap# = 2pt#;

 o#:=0.4pt#; %Vertical overshoot
 ho#:=o#;    %Horizontal overshoot

% Vertical gaps
standardgap# = if gridfont: 3pt# else: 2.5pt# fi;
smallgap#    = if gridfont: 2.5pt# else: 2pt# fi;
mingap#      = if gridfont: 1.2pt# else: 1pt# fi;

botcableheight# - symbolwidth#/2 = (-dp# + smallgap#);
topcableheight# + symbolwidth#/2 = (ht# - smallgap#);

cablevertgap# = 3symbolwidth#;
cablebargap# = 4pt#;
cableslant# = 4pt#;

if known topgap#: else: topgap# = standardgap#; fi
if known bottomgap#: else: bottomgap# = standardgap#; fi
 
cableextend# := 0pt#;
% If your software is prone to leaving little gaps between the nogrid 
% cable connectors, or in wide increases and decreases, you might want 
% to make this nonzero.

if gridfont:
purlextend# := 0pt#;
else:
purlextend# := 0.2pt#;
fi

% Purlextend affects how far outside their box the purl background goes.
%
% This is largely irrelevant when printing, 
% but it makes the PDFs look much better.
%
% If you do a Knuth-esque bitmap-font customization to your
% particular printer, this is one parameter you *have* to fiddle with.

define_pixels(wd,ht,dp);
define_blacker_pixels(cableextend,purlextend,gridwidth,symbolwidth, 
   purl_symbolwidth, finesymbolwidth, overlinewidth);
define_pixels(eraserwidth,wrapturngap);
define_corrected_pixels(o,ho);
define_pixels(standardgap,smallgap,mingap,topgap,bottomgap,
	cablevertgap,cablebargap,cableslant, botcableheight,topcableheight);

pickup pencircle scaled symbolwidth; symbol_pen := savepen; 
pickup pencircle scaled finesymbolwidth; fine_pen := savepen; 
pickup pencircle scaled purl_symbolwidth; purl_symbol_pen := savepen; 
pickup pencircle scaled eraserwidth; eraser_pen := savepen; 

offset = (topgap-bottomgap)/2;
small_topgap   	= topgap + smallgap-standardgap;
small_bottomgap = bottomgap + smallgap-standardgap;
min_topgap   	= topgap + mingap-standardgap;
min_bottomgap   = bottomgap + mingap-standardgap;

standardheight := ht+dp-topgap-bottomgap;
biggerheight := ht+dp-small_topgap-small_bottomgap;

font_size 10pt#;
 
font_slant := 0pt#; % fontdimen 1
font_normal_space := 0pt#; % fontdimen 2
font_normal_stretch := 0pt#; % fontdimen 3
font_normal_shrink := 0pt#; % fontdimen 4
font_x_height := ht#; % fontdimen 5
font_quad := wd#; % fontdimen 6
font_extra_space := 0pt#; % fontdimen 7

fontdimen 8:  % Font dimensions 8+ listed here
dp#, % dimen 8: depth
% width is not needed because it is quad (dimen 6)
% height is not needed because it is xheight (dimen 5)
ht#+dp#, % dimen 9: height+depth (LaTeX height)
gridwidth#, % dimen 10: grid width
overlinewd#, % dimen 11: overline/bar width
(ht#+dp#)/8, % dimen 12: raise/lower symbols in narrow increases
(topgap#-bottomgap#), % dimen 13: vertical offset
purlextend#; % dimen 14: purl box outlap

if known incrwidthdefined: else:
	def incrwidth (expr stsin, stsout) = 1*wd# enddef;
	def decrwidth (expr stsin, stsout) = 1*wd# enddef;
fi
Vwidth := standardheight; % Used twice: v and y
Wwidth := biggerheight;   % Used for make 3 from 1
wideincline := 2symbolwidth;
wideinctip := 0.3symbolwidth;

symbolmaxwd# = 82.244pt# - max(2purlextend#,gridwidth#);