| 1 |
% Date: 2019/04/05 |
| 2 |
|
| 3 |
picture symbolpic[]; |
| 4 |
|
| 5 |
beginchar(5,wd#,ht#,dp#); "Top and bottom outlines"; |
| 6 |
pickup pensquare scaled gridwidth; |
| 7 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 8 |
draw (0,-d)--(w,-d); draw (0,h)--(w,h); |
| 9 |
fi |
| 10 |
endchar; |
| 11 |
|
| 12 |
beginchar(6,0,ht#,dp#); "Vertical grid line"; |
| 13 |
pickup pensquare scaled gridwidth; |
| 14 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 15 |
draw (0,-d)--(0,h); |
| 16 |
fi |
| 17 |
endchar; |
| 18 |
|
| 19 |
code := 127; |
| 20 |
|
| 21 |
beginchar("-",wd#,ht#,dp#); "A knit stitch"; |
| 22 |
charbox; endchar; |
| 23 |
beginchar("=",wd#,ht#,dp#); "A purl stitch"; |
| 24 |
purlbox; endchar; |
| 25 |
beginchar(".",incrwidth(0,0),ht#,dp#); "No stitch"; |
| 26 |
fill (0.5(w-standardheight),-d+bottomgap) -- |
| 27 |
(0.5(w-standardheight),h-topgap) -- |
| 28 |
(0.5(w+standardheight),h-topgap) -- |
| 29 |
(0.5(w+standardheight),-d+bottomgap) -- cycle; |
| 30 |
symbolpic0 := currentpicture; |
| 31 |
charbox; endchar; |
| 32 |
beginchar(",",incrwidth(0,0),ht#,dp#); "Purl no stitch"; |
| 33 |
currentpicture := symbolpic0; |
| 34 |
purlbox; endchar; |
| 35 |
|
| 36 |
% Cables |
| 37 |
|
| 38 |
cablelinewidth#:=0.4pt#; |
| 39 |
define_blacker_pixels(cablelinewidth); |
| 40 |
pickup pencircle scaled cablelinewidth; cable_pen := savepen; |
| 41 |
|
| 42 |
% The one-letter cells |
| 43 |
|
| 44 |
beginchar("p",wd#,ht#,dp#); "Purl cable background"; |
| 45 |
currentpicture := errorsymbol1; |
| 46 |
purlbox; endchar; |
| 47 |
beginchar("P",wd#,ht#,dp#); "Purl cable foreground"; |
| 48 |
currentpicture := errorsymbol1; |
| 49 |
purlbox; endchar; |
| 50 |
beginchar("k",wd#,ht#,dp#); "Knit cable background"; |
| 51 |
currentpicture := errorsymbol1; |
| 52 |
charbox; endchar; |
| 53 |
beginchar("K",wd#,ht#,dp#); "Knit cable foreground"; |
| 54 |
currentpicture := errorsymbol1; |
| 55 |
charbox; endchar; |
| 56 |
beginchar("g",wd#,ht#,dp#); "Purl cable background"; |
| 57 |
currentpicture := errorsymbol1; |
| 58 |
purlbox; endchar; |
| 59 |
beginchar("G",wd#,ht#,dp#); "Purl cable foreground"; |
| 60 |
currentpicture := errorsymbol1; |
| 61 |
purlbox; endchar; |
| 62 |
beginchar("c",wd#,ht#,dp#); "Knit cable background"; |
| 63 |
currentpicture := errorsymbol1; |
| 64 |
charbox; endchar; |
| 65 |
beginchar("C",wd#,ht#,dp#); "Knit cable foreground"; |
| 66 |
currentpicture := errorsymbol1; |
| 67 |
charbox; endchar; |
| 68 |
beginchar("d",wd#,ht#,dp#); "White knit cable background"; |
| 69 |
currentpicture := errorsymbol1; |
| 70 |
charbox; endchar; |
| 71 |
beginchar("D",wd#,ht#,dp#); "White knit cable foreground"; |
| 72 |
currentpicture := errorsymbol1; |
| 73 |
charbox; endchar; |
| 74 |
beginchar("n",wd#,ht#,dp#); "Odd knit cable background"; |
| 75 |
currentpicture := errorsymbol1; |
| 76 |
charbox; endchar; |
| 77 |
beginchar("N",wd#,ht#,dp#); "Odd knit cable foreground"; |
| 78 |
currentpicture := errorsymbol1; |
| 79 |
charbox; endchar; |
| 80 |
beginchar("e",wd#,ht#,dp#); "Odd twist"; |
| 81 |
currentpicture := errorsymbol1; |
| 82 |
charbox; endchar; |
| 83 |
beginchar("o",wd#,ht#,dp#); "Odd twist"; |
| 84 |
currentpicture := errorsymbol1; |
| 85 |
charbox; endchar; |
| 86 |
|
| 87 |
% Horizontal cables |
| 88 |
|
| 89 |
horizcablegap# := 0.3 wd#; |
| 90 |
define_pixels(horizcablegap); |
| 91 |
|
| 92 |
beginchar("+",wd#,ht#,dp#); "Left end of a horizontal cable"; |
| 93 |
charbox; |
| 94 |
pickup pensquare scaled cablelinewidth; |
| 95 |
x1=x4=horizcablegap; x2=x3=w; bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; |
| 96 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 97 |
draw lft z3--rt z4; draw rt z1--lft z2; draw rt z4--rt z1; |
| 98 |
fi |
| 99 |
if fonttype = purltype: |
| 100 |
fill (0,-d)--(w,-d)--z2--z1--z4--z3--(w,h)--(0,h)--cycle; |
| 101 |
fi |
| 102 |
symbolpic0 := currentpicture; |
| 103 |
endchar; |
| 104 |
|
| 105 |
midhoriz := 20; |
| 106 |
righthoriz := 21; |
| 107 |
specialhoriz := ASCII"/"; |
| 108 |
|
| 109 |
beginchar(midhoriz,wd#,ht#,dp#); "Middle of a horizontal cable"; |
| 110 |
charbox; |
| 111 |
pickup pensquare scaled cablelinewidth; |
| 112 |
x1=x4=gridwidth/2; x2=x3=w-gridwidth/2; bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; |
| 113 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 114 |
draw rt z1--lft z2; draw lft z3--rt z4; |
| 115 |
fi |
| 116 |
if fonttype = purltype: |
| 117 |
fill z1--z2--(w,-d)--(0,-d)--cycle; |
| 118 |
fill z4--z3--(w,h)--(0,h)--cycle; |
| 119 |
fi |
| 120 |
labels(1,2,3,4); |
| 121 |
endchar; |
| 122 |
|
| 123 |
beginchar(specialhoriz,wd#,ht#,dp#); "Special horizontal cable"; |
| 124 |
charbox; |
| 125 |
pickup pensquare scaled cablelinewidth; |
| 126 |
x1=x4=gridwidth/2; x2=x3=w-gridwidth/2; |
| 127 |
bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; |
| 128 |
|
| 129 |
x5=x6; x7=x8; x7-x5 = y3-y2; 0.5[x7,x5]=0.5w; |
| 130 |
y5=y7=-d+gridwidth/2; y6=y8=h-gridwidth/2; |
| 131 |
|
| 132 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 133 |
draw top z5--bot z6; draw top z7--bot z8; |
| 134 |
draw rt z1--lft (x5,y2); |
| 135 |
draw rt (x7,y2)--lft z2; |
| 136 |
draw lft z3--rt(x7,y3); |
| 137 |
draw lft(x5,y4)--rt z4; |
| 138 |
fi |
| 139 |
|
| 140 |
if fonttype = purltype: |
| 141 |
fill (x1,y5)--z1--(x5,y1)--z5--cycle; |
| 142 |
fill (x2,y7)--z2--(x7,y2)--z7--cycle; |
| 143 |
fill (x3,y8)--z3--(x8,y3)--z8--cycle; |
| 144 |
fill (x4,y6)--z4--(x6,y4)--z6--cycle; |
| 145 |
fi |
| 146 |
labels(1,2,3,4,5,6,7,8); |
| 147 |
endchar; |
| 148 |
|
| 149 |
|
| 150 |
beginchar(righthoriz,if fonttype = counttype: 0 else: wd# fi,ht#,dp#); "Right end of a horizontal cable"; |
| 151 |
fliphoriz(symbolpic0)(currentpicture); |
| 152 |
endchar; |
| 153 |
|
| 154 |
ligtable "+": specialhoriz: |
| 155 |
"+" |=: righthoriz; |
| 156 |
ligtable righthoriz: |
| 157 |
"+" |=: righthoriz, |
| 158 |
specialhoriz =:| midhoriz, |
| 159 |
righthoriz =:| midhoriz; |
| 160 |
|
| 161 |
% Setup for the standard cables |
| 162 |
|
| 163 |
numeric cableleft[][][]; numeric cableright[][][]; |
| 164 |
numeric whitecableleft[][][]; numeric whitecableright[][][]; |
| 165 |
numeric twistleft[][]; numeric twistright[][]; |
| 166 |
numeric revcableleft[][]; numeric revcableright[][]; |
| 167 |
numeric topcableleft[][]; numeric topcableright[][]; |
| 168 |
numeric botcableleft[][]; numeric botcableright[][]; |
| 169 |
|
| 170 |
for sts = 2 upto 3: |
| 171 |
cableright[0][sts][0] := incr code; |
| 172 |
beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" cable background stitches"; |
| 173 |
addto currentpicture also errorsymbol[sts]; |
| 174 |
charbox; endchar; |
| 175 |
|
| 176 |
cableleft[sts][0][0] := incr code; |
| 177 |
beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" cable foreground stitches"; |
| 178 |
addto currentpicture also errorsymbol[sts]; |
| 179 |
charbox; endchar; |
| 180 |
|
| 181 |
revcableright[0][sts] := incr code; |
| 182 |
beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" twist background stitches"; |
| 183 |
addto currentpicture also errorsymbol[sts]; |
| 184 |
purlbox; endchar; |
| 185 |
|
| 186 |
revcableleft[sts][0] := incr code; |
| 187 |
beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" twist foreground stitches"; |
| 188 |
addto currentpicture also errorsymbol[sts]; |
| 189 |
purlbox; endchar; |
| 190 |
endfor |
| 191 |
|
| 192 |
% Draw the cables |
| 193 |
|
| 194 |
if known slantcutoff: else: slantcutoff = 0; fi |
| 195 |
|
| 196 |
for backsts = 1 upto 3: |
| 197 |
for frontsts = 1 upto 3: |
| 198 |
for midsts = 0 upto if frontsts = backsts: if frontsts < 3: frontsts else: 0 fi else: 0 fi: |
| 199 |
|
| 200 |
|
| 201 |
cableleft[frontsts][backsts][midsts] = incr code; |
| 202 |
cableright[frontsts][backsts][midsts] = incr code; |
| 203 |
whitecableleft[frontsts][backsts][midsts] = incr code; |
| 204 |
whitecableright[frontsts][backsts][midsts] = incr code; |
| 205 |
|
| 206 |
if midsts = 0: |
| 207 |
topcableleft[frontsts][backsts] = incr code; |
| 208 |
topcableright[frontsts][backsts] = incr code; |
| 209 |
botcableleft[frontsts][backsts] = incr code; |
| 210 |
botcableright[frontsts][backsts] = incr code; |
| 211 |
twistleft[frontsts][backsts] = incr code; |
| 212 |
twistright[frontsts][backsts] = incr code; |
| 213 |
revcableleft[frontsts][backsts] = incr code; |
| 214 |
revcableright[frontsts][backsts] = incr code; |
| 215 |
fi |
| 216 |
|
| 217 |
symbolpic0 := nullpicture; |
| 218 |
symbolpic1 := nullpicture; |
| 219 |
symbolpic2 := nullpicture; |
| 220 |
|
| 221 |
totsts := frontsts + backsts + midsts; |
| 222 |
|
| 223 |
if (frontsts+backsts+midsts)*wd# < symbolmaxwd#: |
| 224 |
|
| 225 |
beginchar(cableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); |
| 226 |
% Cable/cable front |
| 227 |
"Cable " & decimal(frontsts) & " over " &decimal(backsts) & " over " &decimal(midsts); |
| 228 |
|
| 229 |
frontstroke := cablelinewidth * ((backsts+midsts)++1); |
| 230 |
backstroke := cablelinewidth * ((frontsts+midsts)++1)/2; |
| 231 |
|
| 232 |
charbox; % Have to do it here so the grid type fonts have stuff |
| 233 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 234 |
|
| 235 |
% Define top and bottom points |
| 236 |
for k=0 upto totsts: |
| 237 |
z.bot[k] = (k*wd,-d); |
| 238 |
z.top[k] = (k*wd,h); |
| 239 |
penpos.bot[k] (frontstroke, 0); |
| 240 |
penpos.top[k] (frontstroke, 0); |
| 241 |
endfor |
| 242 |
|
| 243 |
for k=0 upto totsts: |
| 244 |
labels(bot[k],top[k],bot[k]l,bot[k]r,top[k]l,top[k]r); |
| 245 |
endfor |
| 246 |
|
| 247 |
% Draw the lines on the front cable |
| 248 |
if slantcutoff > (backsts+midsts-1): |
| 249 |
for k=1 upto frontsts-1: |
| 250 |
penstroke z.top[k]e -- z.bot[k+backsts+midsts]e; |
| 251 |
endfor |
| 252 |
fi |
| 253 |
|
| 254 |
% Draw the left and right lines of the front cable |
| 255 |
pair temp; |
| 256 |
temp = (0,whatever); |
| 257 |
temp = whatever[z.top0l,z.bot[backsts+midsts]l]; |
| 258 |
|
| 259 |
fill z.top0r--z.bot[backsts+midsts]r -- z.bot[backsts+midsts]l--temp--z.top0--cycle; |
| 260 |
|
| 261 |
pair temp; |
| 262 |
temp = (w,whatever); |
| 263 |
temp = whatever[z.bot[totsts]r,z.top[frontsts]r]; |
| 264 |
|
| 265 |
fill z.top[frontsts]r--z.top[frontsts]l--z.bot[totsts]l --z.bot[totsts]--temp--cycle; |
| 266 |
|
| 267 |
symbolpic1 := currentpicture; |
| 268 |
% Save this pic for twist front |
| 269 |
|
| 270 |
% Draw the back lines |
| 271 |
pair slip; |
| 272 |
slip = whatever[(-backstroke,0),(frontsts+midsts,1)+(-backstroke,0)]; |
| 273 |
slip = whatever * (-backsts,1); |
| 274 |
|
| 275 |
% Define some more points |
| 276 |
for k=0 upto backsts: |
| 277 |
z.ur[k] = whatever [z.top0,z.bot[backsts+midsts]]; |
| 278 |
z.ur[k] = whatever [z.bot[k],z.top[frontsts+midsts+k]]; |
| 279 |
z.ll[k] = whatever [z.bot[totsts],z.top[frontsts]]; |
| 280 |
z.ll[k] = whatever [z.bot[k],z.top[frontsts+midsts+k]]; |
| 281 |
endfor |
| 282 |
|
| 283 |
% Top back lines |
| 284 |
fill z.top[totsts]+(-backstroke,0) -- z.top[totsts] -- z.top[totsts]+(0,-ypart(slip)) -- z.ll[backsts]-slip -- z.ll[backsts]+slip --cycle; |
| 285 |
|
| 286 |
if midsts > 0: |
| 287 |
fill z.top[frontsts+midsts]+(-backstroke,0) -- z.top[frontsts+midsts]+(backstroke,0) -- z.ll[0]-slip -- z.ll[0]+slip --cycle; |
| 288 |
fi |
| 289 |
|
| 290 |
if slantcutoff > (frontsts+midsts-1): |
| 291 |
for k=1 upto backsts-1: |
| 292 |
fill z.top[frontsts+midsts+k]+(-backstroke,0) -- z.top[frontsts+midsts+k]+(backstroke,0) -- z.ll[k]-slip -- z.ll[k]+slip --cycle; |
| 293 |
endfor |
| 294 |
fi |
| 295 |
|
| 296 |
symbolpic2 := currentpicture; |
| 297 |
|
| 298 |
% Bottom back lines |
| 299 |
fill z.bot[0]+(backstroke,0) -- z.bot[0] -- z.bot[0]+(0,ypart(slip)) -- z.ur[0]+slip -- z.ur[0]-slip --cycle; |
| 300 |
|
| 301 |
if midsts > 0: |
| 302 |
fill z.bot[backsts]+(backstroke,0) -- z.bot[backsts]-(backstroke,0) -- z.ur[backsts]+slip -- z.ur[backsts]-slip --cycle; |
| 303 |
fi |
| 304 |
|
| 305 |
if slantcutoff > (frontsts+midsts-1): |
| 306 |
for k=1 upto backsts-1: |
| 307 |
fill z.bot[k]+(backstroke,0) -- z.bot[k]-(backstroke,0) -- z.ur[k]+slip -- z.ur[k]-slip --cycle; |
| 308 |
endfor |
| 309 |
fi |
| 310 |
|
| 311 |
fi |
| 312 |
|
| 313 |
if fonttype = purltype: |
| 314 |
z.L = whatever[(0,-d),((frontsts+midsts)*wd,h)]; |
| 315 |
z.L = whatever[(0,h),((backsts+midsts)*wd,-d)]; |
| 316 |
z.R = whatever[(w,-d),(w-(backsts+midsts)*wd,h)]; |
| 317 |
z.R = whatever[(w,h),(w-(frontsts+midsts)*wd,-d)]; |
| 318 |
|
| 319 |
if midsts = 0: else: |
| 320 |
z.top1 = (frontsts*wd,h); z.top2 = ((frontsts+midsts)*wd,h); |
| 321 |
z.bot1 = (frontsts*wd,-d); z.bot2 = ((frontsts+midsts)*wd,-d); |
| 322 |
z.top3 = whatever[z.top1,(w,-d)]; |
| 323 |
z.top3 = whatever[z.top2,(0,-d)]; |
| 324 |
z.bot3 = whatever[z.bot1,(w,h)]; |
| 325 |
z.bot3 = whatever[z.bot2,(0,h)]; |
| 326 |
fill z.top1 -- z.top2 -- z.top3 -- cycle; |
| 327 |
fill z.bot1 -- z.bot2 -- z.bot3 -- cycle; |
| 328 |
fi |
| 329 |
|
| 330 |
fill (0,-d) -- z.L -- (0,h) --cycle; |
| 331 |
fill (w,-d) -- z.R -- (w,h) --cycle; |
| 332 |
fi |
| 333 |
symbolpic0 := currentpicture; |
| 334 |
endchar; |
| 335 |
beginchar(cableright[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); |
| 336 |
"Cable right " & decimal(frontsts) & " over " &decimal(backsts); |
| 337 |
currentpicture := symbolpic0 reflectedabout ((w/2,0),(w/2,h)); |
| 338 |
endchar; |
| 339 |
beginchar(whitecableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); |
| 340 |
"White cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 341 |
if fonttype <> purltype: currentpicture := symbolpic0; fi |
| 342 |
endchar; |
| 343 |
beginchar(whitecableright[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); |
| 344 |
"White cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 345 |
if fonttype <> purltype: currentpicture := symbolpic0 reflectedabout ((w/2,0),(w/2,h)); fi |
| 346 |
endchar; |
| 347 |
|
| 348 |
if midsts = 0: |
| 349 |
|
| 350 |
beginchar(twistleft[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 351 |
% Twist/twist front |
| 352 |
"Twist " & decimal(frontsts) & " over " &decimal(backsts); |
| 353 |
charbox; |
| 354 |
if fonttype <> purltype: |
| 355 |
currentpicture := symbolpic1; |
| 356 |
% Draw some missing lines |
| 357 |
for k=1 upto backsts-1: |
| 358 |
z.bot[k] = (k*wd,-d); |
| 359 |
x.slant.bot[k] = k*wd; |
| 360 |
z.slant.bot[k] = whatever[(0,h),(backsts*wd,-d)]; |
| 361 |
draw z.bot[k]--z.slant.bot[k]; |
| 362 |
|
| 363 |
z.top[k] = ((frontsts+k)*wd,h); |
| 364 |
x.slant.top[k] = (frontsts+k)*wd; |
| 365 |
z.slant.top[k] = whatever[(frontsts*wd,h),(w,-d)]; %whatever[(w,-d),(w-backsts*wd,h)]; |
| 366 |
draw z.top[k]--z.slant.top[k]; |
| 367 |
endfor |
| 368 |
else: |
| 369 |
fill (0,h)--(wd*backsts,-d)--(0,-d)--cycle; % Bottom triangle |
| 370 |
fill (w,-d)--(wd*frontsts,h)--(w,h)--cycle; % Top triangle |
| 371 |
fi |
| 372 |
symbolpic1 := currentpicture; |
| 373 |
endchar; |
| 374 |
beginchar(twistright[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 375 |
"Twist " & decimal(frontsts) & " over " &decimal(backsts); |
| 376 |
currentpicture := symbolpic1 reflectedabout ((w/2,0),(w/2,h)); |
| 377 |
endchar; |
| 378 |
|
| 379 |
beginchar(topcableleft[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 380 |
% Twist/twist front |
| 381 |
"Cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 382 |
z.R = whatever[(w,-d),(w-(backsts+midsts)*wd,h)]; |
| 383 |
z.R = whatever[(w,h),(w-(frontsts+midsts)*wd,-d)]; |
| 384 |
charbox; |
| 385 |
if fonttype <> purltype: currentpicture := symbolpic2; |
| 386 |
else: |
| 387 |
fill (0,h)--(wd*backsts,-d)--(0,-d)--cycle; % Bottom left triangle |
| 388 |
fill (w,-d) -- z.R -- (w,h) --cycle; % Right triangle |
| 389 |
fi |
| 390 |
symbolpic2 := currentpicture; |
| 391 |
endchar; |
| 392 |
beginchar(topcableright[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 393 |
"Cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 394 |
currentpicture := symbolpic2 reflectedabout ((w/2,0),(w/2,h)); |
| 395 |
endchar; |
| 396 |
beginchar(botcableleft[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 397 |
"Cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 398 |
currentpicture := symbolpic2 rotatedaround ((w/2,(h-d)/2),180); |
| 399 |
endchar; |
| 400 |
beginchar(botcableright[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 401 |
"Cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 402 |
currentpicture := symbolpic2 reflectedabout ((0,(h-d)/2),(w,(h-d)/2)); |
| 403 |
endchar; |
| 404 |
|
| 405 |
beginchar(revcableleft[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 406 |
% Reverse cable/twist back |
| 407 |
"Reverse cable left " & decimal(frontsts) & " over " &decimal(backsts); |
| 408 |
if fonttype <> purltype: |
| 409 |
currentpicture := symbolpic0; |
| 410 |
else: purlbox; fi |
| 411 |
endchar; |
| 412 |
beginchar(revcableright[frontsts][backsts],totsts * wd#,ht#,dp#); |
| 413 |
"Reverse cable " & decimal(frontsts) & " over " &decimal(backsts); |
| 414 |
if fonttype <> purltype: |
| 415 |
currentpicture := symbolpic0 reflectedabout ((w/2,0),(w/2,h)); |
| 416 |
else: purlbox; fi |
| 417 |
endchar; |
| 418 |
fi |
| 419 |
|
| 420 |
else: |
| 421 |
|
| 422 |
beginchar(cableleft[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; |
| 423 |
beginchar(cableright[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; |
| 424 |
beginchar(whitecableleft[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; |
| 425 |
beginchar(whitecableright[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; |
| 426 |
|
| 427 |
if midsts = 0: |
| 428 |
beginchar(twistleft[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 429 |
beginchar(twistright[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 430 |
beginchar(topcableleft[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 431 |
beginchar(topcableright[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 432 |
beginchar(botcableleft[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 433 |
beginchar(botcableright[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 434 |
beginchar(revcableleft[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 435 |
beginchar(revcableright[frontsts][backsts],0pt#,ht#,dp#); endchar; |
| 436 |
|
| 437 |
fi |
| 438 |
|
| 439 |
fi |
| 440 |
|
| 441 |
endfor endfor endfor |
| 442 |
|
| 443 |
% Ligatures to let kkKK turn into a cable |
| 444 |
|
| 445 |
if fonttype <> counttype: |
| 446 |
|
| 447 |
cableright[0][1][0] := ASCII"k"; |
| 448 |
cableleft[1][0][0] := ASCII"K"; |
| 449 |
revcableright[0][1] := ASCII"p"; |
| 450 |
revcableleft[1][0] := ASCII"P"; |
| 451 |
|
| 452 |
ligtable "c": |
| 453 |
"k" =: cableright[0][1+1][0], |
| 454 |
"c" =: cableright[0][1+1][0], |
| 455 |
"p" =: cableright[1][1][1], |
| 456 |
"K" =: cableright[1][1][0], |
| 457 |
"D" =: whitecableright[1][1][0], |
| 458 |
"N" =: topcableright[1][1]; |
| 459 |
ligtable "C": |
| 460 |
"K" =: cableleft[1+1][0][0], |
| 461 |
"C" =: cableleft[1+1][0][0], |
| 462 |
"p" =: twistleft[1][1], |
| 463 |
"k" =: cableleft[1][1][0], |
| 464 |
"d" =: whitecableleft[1][1][0], |
| 465 |
"n" =: topcableleft[1][1], |
| 466 |
"e" =: botcableleft[1][1], |
| 467 |
"o" =: botcableleft[1][1]; |
| 468 |
ligtable "g": |
| 469 |
"p" =: revcableright[0][1+1], |
| 470 |
"g" =: revcableright[0][1+1], |
| 471 |
"K" =: twistright[1][1], |
| 472 |
"P" =: revcableright[1][1], |
| 473 |
"N" =: botcableright[1][1]; |
| 474 |
ligtable "G": |
| 475 |
"P" =: revcableleft[1+1][0], |
| 476 |
"G" =: revcableleft[1+1][0], |
| 477 |
"p" =: revcableleft[1][1]; |
| 478 |
|
| 479 |
for sts = 1 upto 3: |
| 480 |
ligtable cableright[0][sts][0]: |
| 481 |
if sts < 3: |
| 482 |
"k" =: cableright[0][sts+1][0], |
| 483 |
"c" =: cableright[0][sts+1][0], |
| 484 |
"p" =: cableright[sts][sts][1], |
| 485 |
fi |
| 486 |
"K" =: cableright[1][sts][0], |
| 487 |
"D" =: whitecableright[1][sts][0], |
| 488 |
"N" =: topcableright[1][sts]; |
| 489 |
ligtable cableleft[sts][0][0]: |
| 490 |
if sts < 3: |
| 491 |
"K" =: cableleft[sts+1][0][0], |
| 492 |
"C" =: cableleft[sts+1][0][0], |
| 493 |
fi |
| 494 |
"p" =: twistleft[sts][1], |
| 495 |
"k" =: cableleft[sts][1][0], |
| 496 |
"d" =: whitecableleft[sts][1][0], |
| 497 |
"n" =: topcableleft[sts][1], |
| 498 |
"e" =: botcableleft[sts][1], |
| 499 |
"o" =: botcableleft[sts][1]; |
| 500 |
ligtable revcableright[0][sts]: |
| 501 |
if sts < 3: |
| 502 |
"p" =: revcableright[0][sts+1], |
| 503 |
"g" =: revcableright[0][sts+1], |
| 504 |
fi |
| 505 |
"K" =: twistright[1][sts], |
| 506 |
"P" =: revcableright[1][sts], |
| 507 |
"N" =: botcableright[1][sts]; |
| 508 |
ligtable revcableleft[sts][0]: |
| 509 |
if sts < 3: |
| 510 |
"P" =: revcableleft[sts+1][0], |
| 511 |
"G" =: revcableleft[sts+1][0], |
| 512 |
fi |
| 513 |
"p" =: revcableleft[sts][1]; |
| 514 |
|
| 515 |
endfor |
| 516 |
|
| 517 |
for sts = 1 upto 2: |
| 518 |
ligtable cableleft[sts][sts][1]: |
| 519 |
if sts > 1: "p" =: cableleft[sts][sts][2], fi |
| 520 |
"k" =: cableleft[sts][sts][1], |
| 521 |
"d" =: whitecableleft[sts][sts][1]; |
| 522 |
ligtable cableright[sts][sts][1]: |
| 523 |
if sts > 1: "p" =: cableright[sts][sts][2], fi |
| 524 |
"K" =: cableright[sts][sts][1], |
| 525 |
"D" =: whitecableright[sts][sts][1]; |
| 526 |
ligtable whitecableleft[sts][sts][1]: |
| 527 |
"d" =: whitecableleft[sts][sts][1]; |
| 528 |
ligtable whitecableright[sts][sts][1]: |
| 529 |
"D" =: whitecableright[sts][sts][1]; |
| 530 |
endfor |
| 531 |
|
| 532 |
if 6wd# < symbolmaxwd#: |
| 533 |
ligtable cableleft[2][2][2]: |
| 534 |
"k" =: cableleft[2][2][2], |
| 535 |
"d" =: whitecableleft[2][2][2]; |
| 536 |
ligtable cableright[2][2][2]: |
| 537 |
"K" =: cableright[2][2][2], |
| 538 |
"D" =: whitecableright[2][2][2]; |
| 539 |
ligtable whitecableleft[2][2][2]: |
| 540 |
"d" =: whitecableleft[2][2][2]; |
| 541 |
ligtable whitecableright[2][2][2]: |
| 542 |
"D" =: whitecableright[2][2][2]; |
| 543 |
fi |
| 544 |
|
| 545 |
for backsts = 1 upto 3: |
| 546 |
for frontsts = 1 upto 3: |
| 547 |
|
| 548 |
if frontsts < 3: |
| 549 |
ligtable cableright[frontsts][backsts][0]: |
| 550 |
"K" =: cableright[frontsts+1][backsts][0], |
| 551 |
"N" =: topcableright[frontsts+1][backsts], |
| 552 |
"D" =: whitecableright[frontsts+1][backsts][0]; |
| 553 |
ligtable whitecableright[frontsts][backsts][0]: |
| 554 |
"D" =: whitecableright[frontsts+1][backsts][0]; |
| 555 |
ligtable topcableright[frontsts][backsts]: |
| 556 |
"N" =: topcableright[frontsts+1][backsts]; |
| 557 |
ligtable botcableright[frontsts][backsts]: |
| 558 |
"N" =: botcableright[frontsts+1][backsts]; |
| 559 |
ligtable twistright[frontsts][backsts]: |
| 560 |
"K" =: twistright[frontsts+1][backsts], |
| 561 |
"N" =: botcableright[frontsts+1][backsts]; |
| 562 |
ligtable revcableright[frontsts][backsts]: |
| 563 |
"P" =: revcableright[frontsts+1][backsts]; |
| 564 |
fi |
| 565 |
|
| 566 |
if backsts < 3: |
| 567 |
ligtable cableleft[frontsts][backsts][0]: |
| 568 |
"k" =: cableleft[frontsts][backsts+1][0], |
| 569 |
"n" =: topcableleft[frontsts][backsts+1], |
| 570 |
"d" =: whitecableleft[frontsts][backsts+1][0]; |
| 571 |
ligtable whitecableleft[frontsts][backsts][0]: |
| 572 |
"d" =: whitecableleft[frontsts][backsts+1][0]; |
| 573 |
ligtable topcableleft[frontsts][backsts]: |
| 574 |
"n" =: topcableleft[frontsts][backsts+1]; |
| 575 |
ligtable botcableleft[frontsts][backsts]: |
| 576 |
"e" =: botcableleft[frontsts][backsts+1], |
| 577 |
"o" =: botcableleft[frontsts][backsts+1]; |
| 578 |
ligtable twistleft[frontsts][backsts]: |
| 579 |
if frontsts < 3: if backsts <= frontsts: |
| 580 |
"k" =: cableleft[frontsts][frontsts][backsts], |
| 581 |
"d" =: whitecableleft[frontsts][frontsts][backsts], |
| 582 |
fi fi |
| 583 |
"e" =: botcableleft[frontsts][backsts+1], |
| 584 |
"o" =: botcableleft[frontsts][backsts+1], |
| 585 |
"p" =: twistleft[frontsts][backsts+1]; |
| 586 |
ligtable revcableleft[frontsts][backsts]: |
| 587 |
"p" =: revcableleft[frontsts][backsts+1]; |
| 588 |
fi |
| 589 |
|
| 590 |
endfor |
| 591 |
endfor |
| 592 |
|
| 593 |
fi |