summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/public/knitting/knit_nogrid_cables.mf
blob: 126d1f28176b827dc460ff94d1766b5e08f20922 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
% Date: 2010/08/10

beginchar(",",incrwidth(0,0),ht#,dp#); "No stitch";
  purlbox;
  endchar;
beginchar(".",incrwidth(0,0),ht#,dp#); "No stitch";
  endchar;
  
  path purlbar;
  
beginchar("-",wd#,ht#,dp#); "A knit stitch";
  pickup symbol_pen;
  draw bot (w/2,h-topgap+o) -- top (w/2, -d+bottomgap-o);
  charbox; endchar;
beginchar("=",wd#,ht#,dp#); "A purl stitch";
  pickup symbol_pen;
  lft x1-rt x2 = 0.7standardheight; x1+x2=w; y1=y2=0.5[h,-d];
  purlbar = z1--z2;
  draw purlbar;
  purlbox; endchar;
  
code := 127;
  
%Cables

kright := incr code;
Kright := incr code;
pright := incr code;
Pright := incr code;
nright := incr code;
eright := incr code;
Nright := incr code;
dright := incr code;
oright := incr code;
Dright := incr code;

midhoriz := 20;
righthoriz := 21;
specialhoriz := ASCII"/";

cabletopleft := 5;
cablebotleft := 6;
cabletopright:= 7;
cablebotright:= 8;

cableleftslash := 9;
cableleftbackslash := 10;
cablerightslash := 11;
cablerightbackslash := 12;

leftslash := 13;
rightslash := 14;
	
beginchar("+",wd#,ht#,dp#); "Horizontal cable";  
  pickup symbol_pen;
	HCtop = (h-d)/2 + 0.2standardheight;
	HCbot = (h-d)/2 - 0.2standardheight;
	HCttop = bot (h-d)/2 + 0.5standardheight + o;
	HCbbot = top (h-d)/2 - 0.5standardheight - o;
	y.ul = y.ur = HCtop;
	y.ll = y.lr = HCbot;
	x.ul = x.ll = w-x.ur = w-x.lr;
	x.ur-x.ul = (ht+dp)-2smallgap;
  symbolpath0 := z.ul--z.ur;
  symbolpath1 := z.ll--z.lr;  
  draw symbolpath0; draw symbolpath1;
  symbolpic0 := currentpicture;
  charbox; endchar;  
  
%beginchar(midhoriz,wd#,ht#,dp#); "Middle of a horizontal cable";  
%  currentpicture := symbolpic0;
%  charbox; endchar;  
%beginchar(righthoriz,wd#,ht#,dp#); "Right end of a horizontal cable";  
%  currentpicture := symbolpic0;
%  charbox; endchar;  
%  
%ligtable "+": specialhoriz:
% 	"+" |=: righthoriz;
%ligtable righthoriz:
%	"+" |=: righthoriz,
%	specialhoriz =:| midhoriz,
%	righthoriz =:| midhoriz;

beginchar(specialhoriz,wd#,ht#,dp#); "Special horizontal cable";  
  pickup symbol_pen;
	specialspread = 1.5symbolwidth;
	y.ul = y.ur = HCtop;
	y.ll = y.lr = HCbot;
	x.ul = x.ll = w-x.ur = w-x.lr;
	x.ur-x.ul = (ht+dp)-2smallgap;
  draw rt (w/2+specialspread,y.ur)--z.ur;
  draw rt (w/2+specialspread,y.lr)--z.lr;  
  draw lft (w/2-specialspread,y.ur)--z.ul;
  draw lft (w/2-specialspread,y.lr)--z.ll;  
  draw (w/2+specialspread,HCttop)--(w/2+specialspread,HCbbot);  
  draw (w/2-specialspread,HCttop)--(w/2-specialspread,HCbbot); 
  charbox; endchar;  
 
beginchar("k",wd#,ht#,dp#); "Knit cable background";
  pickup symbol_pen;
  draw top (w/2, botcableheight+cablevertgap)--bot(w/2,h-topgap);
  charbox;
  symbolpic0 := currentpicture;
  endchar;
beginchar("c",wd#,ht#,dp#); "Knit cable background";
  currentpicture := symbolpic0;
  endchar;
beginchar(kright,wd#,ht#,dp#); "Knit cable background";
  currentpicture := symbolpic0;
  endchar;

beginchar("p",wd#,ht#,dp#); "Purl cable background";
  pickup symbol_pen;
  draw purlbar;
  purlbox; 
  symbolpic0 := currentpicture;
  endchar;
beginchar("g",wd#,ht#,dp#); "Purl cable background";
  currentpicture := symbolpic0;
  purlbox; 
  endchar;
beginchar(pright,wd#,ht#,dp#); "Purl cable background";
  currentpicture := symbolpic0;
  purlbox;
  endchar;

beginchar("n",incrwidth(0,1),ht#,dp#); "Back make one";  
   pickup symbol_pen;
   drawM(h-topgap, botcableheight+cablevertgap, 0.5wd,symbolwidth);
   charbox;
   symbolpic0:=currentpicture;
 endchar;
beginchar(nright,incrwidth(0,1),ht#,dp#); "Back make one";  
  currentpicture := symbolpic0; endchar;

beginchar("e",incrwidth(0,1),ht#,dp#); "Back purlwise make one";  
   pickup purl_symbol_pen;
   drawM(h-topgap, botcableheight+cablevertgap, 0.5wd,purl_symbolwidth);
   symbolpic0:=currentpicture; purlbox;
endchar;
beginchar(eright,incrwidth(0,1),ht#,dp#); "Back purlwise make one";  
  currentpicture := symbolpic0;
  purlbox;
endchar;

beginchar("N",incrwidth(0,1),ht#,dp#); "Front make one";  
   pickup symbol_pen;
   drawM(topcableheight-cablevertgap, -d+bottomgap, 0.5wd,symbolwidth);
   symbolpic0 := currentpicture;
charbox; endchar;
beginchar(Nright,incrwidth(0,1),ht#,dp#); "Front make one";  
  currentpicture := symbolpic0;
charbox; endchar;

beginchar("d",decrwidth(2,1),ht#,dp#); "Back decrease";  
   pickup symbol_pen;
   drawSSK(h-topgap, botcableheight+cablevertgap);
   charbox; symbolpic0:=currentpicture;
endchar;
beginchar(dright,decrwidth(2,1),ht#,dp#); "Back decrease";  
  fliphoriz(symbolpic0)(currentpicture); endchar;

beginchar("o",decrwidth(2,1),ht#,dp#); "Back purl decrease";  
   pickup purl_symbol_pen;
   drawSSK(h-topgap, botcableheight+cablevertgap);
  symbolpic0:=currentpicture; purlbox; 
endchar;
beginchar(oright,decrwidth(2,1),ht#,dp#); "Back purl decrease";  
  fliphoriz(symbolpic0)(currentpicture); 
  purlbox;
  endchar;

beginchar("D",decrwidth(2,1),ht#,dp#); "Front decrease";  
   pickup symbol_pen;
   drawSSK(topcableheight-cablevertgap,-d+bottomgap);
   charbox; symbolpic0:=currentpicture;
endchar;
beginchar(Dright,decrwidth(2,1),ht#,dp#); "Front decrease";  
  fliphoriz(symbolpic0)(currentpicture); endchar;


beginchar("K",wd#,ht#,dp#); "Knit cable foreground";
  pickup symbol_pen;
  draw top (w/2, -d+bottomgap)--bot(w/2,topcableheight-cablevertgap);
  charbox; 
  symbolpic0 := currentpicture;
  endchar;
beginchar("C",wd#,ht#,dp#); "Knit cable foreground";
  currentpicture := symbolpic0;
  endchar;
beginchar(Kright,wd#,ht#,dp#); "Knit cable foreground";
  currentpicture := symbolpic0;
  endchar;

beginchar("P",wd#,ht#,dp#); "Purl cable foreground";
  pickup symbol_pen;
  draw purlbar;
  purlbox; 
  symbolpic0 := currentpicture;
  endchar;
beginchar("G",wd#,ht#,dp#); "Purl cable foreground";
  currentpicture := symbolpic0;
  endchar;
beginchar(Pright,wd#,ht#,dp#); "Purl cable foreground";
  currentpicture := symbolpic0;
  purlbox;
  endchar;

beginchar("_",0,ht#,dp#); "Cable bottom connector";
  pickup symbol_pen;
  x2 - x1 = 2wd - cablebargap; 
  0.5[x1,x2]=0;
  y1=y2=botcableheight; draw z1--z2;
  endchar;
beginchar("^",0,ht#,dp#); "Cable top connector";
  pickup symbol_pen;
  x2 - x1 = 2wd - cablebargap;
  0.5[x1,x2]=0;
  y1=y2=topcableheight; draw z1--z2;
%  pickup pensquare scaled symbolwidth;
%  draw rt (-wd/2,topcableheight) -- lft (wd/2,topcableheight);
  endchar;

beginchar(rightslash,0,ht#,dp#); "Cable right slant connector";
  pickup symbol_pen;
  x4 - x3 = cableslant; 0.5[x3,x4]=0;
  y3=botcableheight; y4=topcableheight;
  draw z3--z4;
  symbolpic0 := currentpicture;
   endchar;
      
beginchar(leftslash,0,ht#,dp#); "Cable left slant connector";
  pickup symbol_pen;
  x3 - x4 = cableslant; 0.5[x3,x4]=0;
  y3=botcableheight; y4=topcableheight;
  draw z3--z4;
  symbolpic0 := currentpicture;
   endchar;
   

beginchar(cabletopleft,0,ht#,dp#); "Cable top left connector";
  pickup pensquare scaled symbolwidth;
  rt x2 - lft x1 = wd+2cableextend; lft x1 = -wd + cablebargap/2;
  y1=y2=topcableheight;
  symbolpath0 := z1--z2;
  draw symbolpath0;
  symbolpic0 := currentpicture;
   endchar;
beginchar(cabletopright,0,ht#,dp#); "Cable top right connector";
  currentpicture := symbolpic0 reflectedabout ((0,0),(0,h));
   endchar;
beginchar(cablebotleft,0,ht#,dp#); "Cable bot left connector";
  pickup pensquare scaled symbolwidth;
  y1=y2=botcableheight;
  x1 = xpart (point 0 of symbolpath0);
  x2 = xpart (point 1 of symbolpath0);
  draw z1--z2;
  symbolpic0 := currentpicture;
   endchar;
beginchar(cablebotright,0,ht#,dp#); "Cable bot right connector";
  currentpicture := symbolpic0 reflectedabout ((0,0),(0,h));
   endchar;

beginchar(cableleftslash,0,ht#,dp#); "Cable slash connector";
  pickup pensquare scaled symbolwidth;
  y1 = y2 = botcableheight;
  rt x1 = - cableslant/2; lft x2 = -wd + cablebargap/2;
  draw z1--z2;
  symbolpic0 := currentpicture;
   endchar;
beginchar(cablerightbackslash,0,ht#,dp#); "Cable slash connector";
  currentpicture := symbolpic0 reflectedabout ((0,0),(0,h));
   endchar;
beginchar(cableleftbackslash,0,ht#,dp#); "Cable slash connector";
  pickup pensquare scaled symbolwidth;
  y1 = y2 = topcableheight;
  rt x1 = - cableslant/2; lft x2 = -wd + cablebargap/2;
  draw z1--z2;
  symbolpic0 := currentpicture;
   endchar;
beginchar(cablerightslash,0,ht#,dp#); "Cable slash connector";
  currentpicture := symbolpic0 reflectedabout ((0,0),(0,h));
   endchar;

if fonttype = foretype:

ligtable 
"k": 
"p": 
"c":
"g":
"o":
"e":
"n":
"d":
	"k" |=:| cablebotleft,
	"c" |=:| cablebotleft,
	"n" |=:| cablebotleft,
	"d" |=:| cablebotleft,
	"p" |=:| cablebotleft,
	"g" |=:| cablebotleft,
	"e" |=:| cablebotleft,
	"o" |=:| cablebotleft,
	"K" |=:| rightslash,
	"P" |=:| rightslash,
	"N" |=:| rightslash,
	"D" |=:| rightslash,
	rightslash |=:| cableleftslash;
	
ligtable 
"K": 
"P": 
"C":
"G":
"N":
"D":
	"K" |=:| cabletopleft,
	"P" |=:| cabletopleft,
	"G" |=:| cabletopleft,
	"C" |=:| cabletopleft,
	"N" |=:| cabletopleft,
	"D" |=:| cabletopleft,
	"k" |=:| leftslash,
	"p" |=:| leftslash,
	"o" |=:| leftslash,
	"e" |=:| leftslash,
	"n" |=:| leftslash,
	"d" |=:| leftslash,
	leftslash |=:| cableleftbackslash;
	
ligtable
Kright:
Pright:
Nright:
Dright:
	"K" |=: Kright,
	Kright |=:| cabletopright,
	"P" |=: Pright,
	Pright |=:| cabletopright,
	"N" |=: Nright,
	Nright |=:| cabletopright,
	"D" |=: Dright,
	Dright |=:| cabletopright;
	
ligtable
kright:
pright:
oright:
eright:
nright:
dright:
	"k" |=: kright,
	        kright |=:| cablebotright,
	"p" |=: pright,
	        pright |=:| cablebotright,
	"o" |=: oright,
      	    oright |=:| cablebotright,
	"e" |=: eright,
	        eright |=:| cablebotright,
	"n" |=: nright,
	        nright |=:| cablebotright,
	"d" |=: dright,
	        dright |=:| cablebotright;
	
ligtable rightslash:  
   "K" |=: Kright,
           Kright |=:| cablerightslash,
   "P" |=: Pright,
           Pright |=:| cablerightslash,
   "N" |=: Nright,
           Nright |=:| cablerightslash,
   "D" |=: Dright,
           Dright |=:| cablerightslash;
ligtable leftslash: 
	"k" |=: kright,
	"p" |=: pright,
	"o" |=: oright,
	"e" |=: eright,
	"n" |=: nright,
	"d" |=: dright,
	kright |=:| cablerightbackslash,
	nright |=:| cablerightbackslash,
	dright |=:| cablerightbackslash,
	pright |=:| cablerightbackslash,
	eright |=:| cablerightbackslash,
	oright |=:| cablerightbackslash;
	
fi