summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/public/knitting/knit_nogrid_cables.mf
blob: a99f64d9c6626f5bababc1b7e53b00dfc1578613 (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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
% Date: 2019/04/05

code := 127;

if known debugcables: else: boolean debugcables; debugcables = true; fi
  
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;
path purlbar;  
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;
beginchar(",",incrwidth(0,0),ht#,dp#); "No stitch";
  purlbox;
  endchar;
beginchar(".",incrwidth(0,0),ht#,dp#); "No stitch";
  charbox;
  endchar;

%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;

%if debugcables:
kleft := incr code;
Kleft := incr code;
pleft := incr code;
Pleft := incr code;
nleft := incr code;
eleft := incr code;
Nleft := incr code;
dleft := incr code;
oleft := incr code;
Dleft := incr code;
%fi

% Cable background/foreground blocks (empty cables)
cablebgblock := 255;
cablefgblock := 254;
cablebgblockright := incr code;
cablefgblockright := incr code;
cablebgblockleft := incr code;
cablefgblockleft := incr code;

% Grid outlines and empty cables
 left_cable_grid := incr code;
  mid_cable_grid := incr code;
right_cable_grid_bg := incr code;
right_cable_grid_fg := incr code;
 left_cable_grid_rt := incr code;
  mid_cable_grid_rt := incr code;
right_cable_grid_rt := incr code;
	
% Empty boxes  
if gridfont:
	noknitleft := incr code;
	noknitmid  := incr code;
	noknitright:= incr code;
	nopurlleft := incr code;
	nopurlmid  := incr code;
	nopurlright:= incr code;

	beginchar(noknitleft, if fonttype = counttype: 0 else: wd# fi, ht#, dp#); "Left no stitch";
		leftgrid_charbox;
		endchar;
	beginchar(noknitmid, if fonttype = counttype: 0 else: wd# fi, ht#, dp#); "Middle no stitch";
		topbotgrid_charbox;
		endchar;
	beginchar(noknitright, if fonttype = counttype: 0 else: wd# fi, ht#, dp#); "Right no stitch";
		rightgrid_charbox;
		endchar;
		
	beginchar(nopurlleft, if fonttype = counttype: 0 else: wd# fi, ht#, dp#); "Left no stitch";
		leftgrid_charbox; 
		if fonttype = purltype:
			fill 
			( 0,-d)--
			(w+nogrid_purlextend,-d)--
			(w+nogrid_purlextend, h)--
			( 0, h)--cycle;
		fi
		endchar;
	beginchar(nopurlmid, if fonttype = counttype: 0 else: wd# fi, ht#, dp#); "Middle no stitch";
		topbotgrid_charbox;
		if fonttype = purltype:
			fill 
			( -nogrid_purlextend,-d)--
			(w+nogrid_purlextend,-d)--
			(w+nogrid_purlextend, h)--
			( -nogrid_purlextend, h)--cycle;
		fi
		endchar;
	beginchar(nopurlright, if fonttype = counttype: 0 else: wd# fi, ht#, dp#); "Right no stitch";
		rightgrid_charbox;
		if fonttype = purltype:
			fill 
			( -nogrid_purlextend,-d)--
			(w,-d)--
			(w, h)--
			( -nogrid_purlextend, h)--cycle;
		fi
		endchar;
		
	ligtable ".": "." =:| noknitleft;
	ligtable noknitleft:  "." |=:  noknitright;
	ligtable noknitright: "."  =:| noknitmid;
	ligtable noknitmid:   "." |=:  noknitright;

	ligtable ",": "," =:| nopurlleft;
	ligtable nopurlleft:  "," |=:  nopurlright;
	ligtable nopurlright: ","  =:| nopurlmid;
	ligtable nopurlmid:   "," |=:  nopurlright;
fi

% Cable background blocks

beginchar(cablebgblock, wd#, ht#, dp#); 
	addto currentpicture also errorsymbol1;
	endchar;
beginchar(cablefgblock, wd#, ht#, dp#); 
	addto currentpicture also errorsymbol1;
	endchar;
beginchar(cablebgblockright, wd#, ht#, dp#); endchar;
beginchar(cablefgblockright, wd#, ht#, dp#); endchar;
beginchar(cablebgblockleft, wd#, ht#, dp#); endchar;
beginchar(cablefgblockleft, wd#, ht#, dp#); endchar;

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

cabletopleft := 15;
cablebotleft := 16;
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;
  leftgrid_charbox; endchar;  
  
beginchar(midhoriz,wd#,ht#,dp#); "Middle of a horizontal cable";  
  currentpicture := symbolpic0;
  topbotgrid_charbox; endchar;  
beginchar(righthoriz,if fonttype = counttype: 0 else: wd# fi,ht#,dp#); "Right end of a horizontal cable";  
  currentpicture := symbolpic0;
  rightgrid_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); 
  topbotgrid_charbox; endchar;  
 
beginchar("k",wd#,ht#,dp#); "Knit cable background";
  pickup symbol_pen;
  %if gridfont:
  %drawdot (w/2, 0.5[botcableheight+cablevertgap,h-topgap]);
  %else:
  draw top (w/2, botcableheight+cablevertgap)--bot(w/2,h-topgap);
  %fi
  charbox;
  symbolpic0 := currentpicture;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar("c",wd#,ht#,dp#); "Knit cable background";
  currentpicture := symbolpic0;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar(kleft,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;
  %if gridfont:
  %drawdot (w/2, 0.5[botcableheight+cablevertgap,h-topgap]);
  %else:
  draw purlbar;
  %fi
  charbox; purlfill;
  symbolpic0 := currentpicture;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar("g",wd#,ht#,dp#); "Purl cable background";
  currentpicture := symbolpic0;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar(pright,wd#,ht#,dp#); "Purl cable background";
  currentpicture := symbolpic0;
  endchar;
beginchar(pleft,wd#,ht#,dp#); "Purl cable background";
  currentpicture := symbolpic0;
  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;
  addto currentpicture also errorsymbol1;
 endchar;
beginchar(nright,incrwidth(0,1),ht#,dp#); "Back make one";  
  currentpicture := symbolpic0; endchar;
beginchar(nleft,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);
   charbox; purlfill;
   symbolpic0:=currentpicture;
  addto currentpicture also errorsymbol1;
endchar;
beginchar(eright,incrwidth(0,1),ht#,dp#); "Back purlwise make one";  
  currentpicture := symbolpic0;
endchar;
beginchar(eleft,incrwidth(0,1),ht#,dp#); "Back purlwise make one";  
  currentpicture := symbolpic0;
endchar;

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

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

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

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


beginchar("K",wd#,ht#,dp#); "Knit cable foreground";
  pickup symbol_pen;
  %if gridfont:
  %drawdot (w/2, 0.5[-d+bottomgap,topcableheight-cablevertgap]);
  %else:
  draw top (w/2, -d+bottomgap)--bot(w/2,topcableheight-cablevertgap);
  %fi
  charbox; 
  symbolpic0 := currentpicture;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar("C",wd#,ht#,dp#); "Knit cable foreground";
  currentpicture := symbolpic0;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar(Kright,wd#,ht#,dp#); "Knit cable foreground";
  currentpicture := symbolpic0;
  endchar;
beginchar(Kleft,wd#,ht#,dp#); "Knit cable foreground";
  currentpicture := symbolpic0;
  endchar;

beginchar("P",wd#,ht#,dp#); "Purl cable foreground";
  %if gridfont:
  %pickup dot_pen;
  %drawdot (w/2, 0.5[-d+bottomgap,topcableheight-cablevertgap]);
  %else:
  pickup symbol_pen;
  draw purlbar;
  %fi
  charbox; purlfill; 
  symbolpic0 := currentpicture;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar("G",wd#,ht#,dp#); "Purl cable foreground";
  currentpicture := symbolpic0;
  addto currentpicture also errorsymbol1;
  endchar;
beginchar(Pright,wd#,ht#,dp#); "Purl cable foreground";
  currentpicture := symbolpic0;
  endchar;
beginchar(Pleft,wd#,ht#,dp#); "Purl cable foreground";
  currentpicture := symbolpic0;
  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 gridfont:
beginchar(left_cable_grid,wd#,ht#,dp#); "Left-end cable outlines";
	leftgrid_charbox; endchar;
beginchar(mid_cable_grid,wd#,ht#,dp#); "Cable outlines";
	topbotgrid_charbox; endchar;
beginchar(mid_cable_grid_rt,wd#,ht#,dp#); "Cable outlines";
	topbotgrid_charbox; endchar;
beginchar(right_cable_grid_bg,wd#,ht#,dp#); "Right-end cable outlines";
	rightgrid_charbox; endchar;
beginchar(right_cable_grid_fg,wd#,ht#,dp#); "Right-end cable outlines";
	rightgrid_charbox; endchar;
beginchar(right_cable_grid_rt,wd#,ht#,dp#); "Right-end cable outlines";
	rightgrid_charbox; endchar;
fi

if fonttype = gridtype:
ligtable
"k": 
"p": 
"c":
"g":
"o":
"e":
"n":
"d":
cablebgblock:
	"k" |=: right_cable_grid_bg,
	"c" |=: right_cable_grid_bg,
	"n" |=: right_cable_grid_bg,
	"d" |=: right_cable_grid_bg,
	"p" |=: right_cable_grid_bg,
	"g" |=: right_cable_grid_bg,
	"e" |=: right_cable_grid_bg,
	"o" |=: right_cable_grid_bg,
	cablebgblock |=: right_cable_grid_bg,
	"K" |=: right_cable_grid_rt,
	"P" |=: right_cable_grid_rt,
	"C" |=: right_cable_grid_rt,
	"G" |=: right_cable_grid_rt,
	"N" |=: right_cable_grid_rt,
	"D" |=: right_cable_grid_rt,
	cablefgblock |=: right_cable_grid_rt,
	right_cable_grid_rt =:| left_cable_grid,
	right_cable_grid_bg =:| left_cable_grid;
	
ligtable
"K": 
"P": 
"C":
"G":
"N":
"D":
cablefgblock:
	"k" |=: right_cable_grid_rt,
	"c" |=: right_cable_grid_rt,
	"n" |=: right_cable_grid_rt,
	"d" |=: right_cable_grid_rt,
	"p" |=: right_cable_grid_rt,
	"g" |=: right_cable_grid_rt,
	"e" |=: right_cable_grid_rt,
	"o" |=: right_cable_grid_rt,
	cablebgblock |=: right_cable_grid_rt,
	"K" |=: right_cable_grid_fg,
	"P" |=: right_cable_grid_fg,
	"C" |=: right_cable_grid_fg,
	"G" |=: right_cable_grid_fg,
	"N" |=: right_cable_grid_fg,
	"D" |=: right_cable_grid_fg,
	cablefgblock |=: right_cable_grid_fg,
	right_cable_grid_rt =:| left_cable_grid,
	right_cable_grid_fg =:| left_cable_grid;
	
ligtable
right_cable_grid_fg:
	"k" |=: right_cable_grid_rt,
	"n" |=: right_cable_grid_rt,
	"d" |=: right_cable_grid_rt,
	"p" |=: right_cable_grid_rt,
	"e" |=: right_cable_grid_rt,
	"o" |=: right_cable_grid_rt,
	cablebgblock |=: right_cable_grid_rt,
	"K" |=: right_cable_grid_fg,
	"P" |=: right_cable_grid_fg,
	"C" |=: right_cable_grid_fg,
	"G" |=: right_cable_grid_fg,
	"N" |=: right_cable_grid_fg,
	"D" |=: right_cable_grid_fg,
	cablefgblock |=: right_cable_grid_fg,
	right_cable_grid_rt =:| mid_cable_grid,
	right_cable_grid_fg =:| mid_cable_grid;
ligtable
right_cable_grid_bg:
	"k" |=: right_cable_grid_bg,
	"c" |=: right_cable_grid_bg,
	"n" |=: right_cable_grid_bg,
	"d" |=: right_cable_grid_bg,
	"p" |=: right_cable_grid_bg,
	"g" |=: right_cable_grid_bg,
	"e" |=: right_cable_grid_bg,
	"o" |=: right_cable_grid_bg,
	cablebgblock |=: right_cable_grid_bg,
	"K" |=: right_cable_grid_rt,
	"P" |=: right_cable_grid_rt,
	"N" |=: right_cable_grid_rt,
	"D" |=: right_cable_grid_rt,
	cablefgblock |=: right_cable_grid_rt,
	right_cable_grid_rt =:| mid_cable_grid,
	right_cable_grid_bg =:| mid_cable_grid;
ligtable
right_cable_grid_rt:
	"k" |=: right_cable_grid_rt,
	"n" |=: right_cable_grid_rt,
	"d" |=: right_cable_grid_rt,
	"p" |=: right_cable_grid_rt,
	"e" |=: right_cable_grid_rt,
	"o" |=: right_cable_grid_rt,
	cablebgblock |=: right_cable_grid_rt,
	"K" |=: right_cable_grid_rt,
	"P" |=: right_cable_grid_rt,
	"N" |=: right_cable_grid_rt,
	"D" |=: right_cable_grid_rt,
	cablefgblock |=: right_cable_grid_rt,
	right_cable_grid_rt =:| mid_cable_grid;
fi

if fonttype = foretype:

for leftglyph = "k", "p", "o", "e", "n", "d", "c", "g", "cablebgblock":
	if leftglyph = "cablebgblock":
	leftglyphlig := cablebgblockleft;
	elseif leftglyph = "c":
	leftglyphlig := kleft;
	elseif leftglyph = "g":
	leftglyphlig := pleft;
	else:	
	leftglyphlig := scantokens (leftglyph & "left");
	fi
ligtable if leftglyph = "cablebgblock": cablebgblock else: leftglyph fi: 
	"k" |=:| cablebotleft,
	"c" |=:| cablebotleft,
	"n" |=:| cablebotleft,
	"d" |=:| cablebotleft,
	"p" |=:| cablebotleft,
	"g" |=:| cablebotleft,
	"e" |=:| cablebotleft,
	"o" |=:| cablebotleft,
	cablebgblock |=:| cablebotleft,
	"K" |=:| rightslash,
	"P" |=:| rightslash,
	"N" |=:| rightslash,
	"D" |=:| rightslash,
	cablefgblock |=:| rightslash,
	rightslash |=:| cableleftslash,
	cablebotleft =:| leftglyphlig,
	cableleftslash =:| leftglyphlig;
endfor

for leftglyph = "K", "P", "C", "G", "N", "D", "cablefgblock":
	if leftglyph = "cablefgblock":
	leftglyphlig := cablefgblockleft;
	elseif leftglyph = "C":
	leftglyphlig := Kleft;
	elseif leftglyph = "G":
	leftglyphlig := Pleft;
	else:	
	leftglyphlig := scantokens (leftglyph & "left");
	fi
ligtable if leftglyph = "cablefgblock": cablefgblock else: leftglyph fi: 
	"K" |=:| cabletopleft,
	"P" |=:| cabletopleft,
	"G" |=:| cabletopleft,
	"C" |=:| cabletopleft,
	"N" |=:| cabletopleft,
	"D" |=:| cabletopleft,
	cablefgblock |=:| cabletopleft,
	"k" |=:| leftslash,
	"p" |=:| leftslash,
	"o" |=:| leftslash,
	"e" |=:| leftslash,
	"n" |=:| leftslash,
	"d" |=:| leftslash,
	cablebgblock |=:| leftslash,
	leftslash |=:| cableleftbackslash,
	cabletopleft =:| leftglyphlig,
	cableleftbackslash =:| leftglyphlig;
endfor
		
ligtable
Kright:
Pright:
Nright:
Dright:
cablefgblockright:
	"K" |=: Kright,
	Kright |=:| cabletopright,
	"P" |=: Pright,
	Pright |=:| cabletopright,
	"N" |=: Nright,
	Nright |=:| cabletopright,
	"D" |=: Dright,
	Dright |=:| cabletopright,
	cablefgblock |=: cablefgblockright,
	cablefgblockright |=:| cabletopright;
	
ligtable
kright:
pright:
oright:
eright:
nright:
dright:
cablebgblockright:
	"k" |=: kright,
	        kright |=:| cablebotright,
	"p" |=: pright,
	        pright |=:| cablebotright,
	"o" |=: oright,
      	    oright |=:| cablebotright,
	"e" |=: eright,
	        eright |=:| cablebotright,
	"n" |=: nright,
	        nright |=:| cablebotright,
	"d" |=: dright,
	        dright |=:| cablebotright,
	cablebgblock |=: cablebgblockright,
	        cablebgblockright |=:| cablebotright;
	
ligtable rightslash:  
   "K" |=: Kright,
           Kright |=:| cablerightslash,
   "P" |=: Pright,
           Pright |=:| cablerightslash,
   "N" |=: Nright,
           Nright |=:| cablerightslash,
   "D" |=: Dright,
           Dright |=:| cablerightslash,
   cablefgblock |=: cablefgblockright,
           cablefgblockright |=:| cablerightslash;
ligtable leftslash: 
	"k" |=: kright,
	"p" |=: pright,
	"o" |=: oright,
	"e" |=: eright,
	"n" |=: nright,
	"d" |=: dright,
	cablebgblock |=: cablebgblockright,
	kright |=:| cablerightbackslash,
	nright |=:| cablerightbackslash,
	dright |=:| cablerightbackslash,
	pright |=:| cablerightbackslash,
	eright |=:| cablerightbackslash,
	oright |=:| cablerightbackslash,
	cablebgblockright |=:| cablerightbackslash;
	
fi