| 1 |
% Date: 2019/04/05 |
| 2 |
|
| 3 |
% Don't flash pictures of the characters as you draw them. |
| 4 |
% This is dizzying, and UNIX can't do it anyway. |
| 5 |
displaying := 0; |
| 6 |
|
| 7 |
% If you want actual documentation, say |
| 8 |
% "mf knitnn" and then |
| 9 |
% "gftodvi knitnn.2602gf" and then |
| 10 |
% "dvipdfm knitnn" |
| 11 |
% at a command prompt in the directory containing this file. |
| 12 |
% This will give you a PDF with big pictures of all the characters in |
| 13 |
% the font with the important points labeled. |
| 14 |
|
| 15 |
if known ps_output: |
| 16 |
font_coding_scheme := "T1-WGL4.enc"; |
| 17 |
fi |
| 18 |
|
| 19 |
def purlfill = |
| 20 |
if fonttype = purltype: |
| 21 |
fill |
| 22 |
( -purlextend,-d-purlextend)-- |
| 23 |
(w+purlextend,-d-purlextend)-- |
| 24 |
(w+purlextend, h+purlextend)-- |
| 25 |
( -purlextend, h+purlextend)--cycle; |
| 26 |
fi |
| 27 |
enddef; |
| 28 |
|
| 29 |
purltype = 0; |
| 30 |
gridtype = 1; |
| 31 |
foretype = 2; |
| 32 |
bothtype = 3; % Both the grid and the symbols |
| 33 |
counttype = 4; |
| 34 |
|
| 35 |
if fonttype = counttype: |
| 36 |
% extra_endchar := extra_endchar & " pickup pencircle scaled 0.2pt; if w>0: draw (0,-d)--(0,h); draw (w,-d)--(w,h); fi "; |
| 37 |
fi |
| 38 |
|
| 39 |
def nogrid_charbox = |
| 40 |
if (fonttype = purltype) or (fonttype = gridtype): |
| 41 |
currentpicture := nullpicture; |
| 42 |
fi |
| 43 |
enddef; |
| 44 |
|
| 45 |
def leftgrid_charbox = |
| 46 |
if (fonttype = purltype): currentpicture := nullpicture; fi |
| 47 |
if (fonttype = gridtype): currentpicture := nullpicture; fi |
| 48 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 49 |
pickup pensquare scaled gridwidth; |
| 50 |
draw lft (w,h)--(0,h); |
| 51 |
draw (0,h)--(0,-d); |
| 52 |
draw (0,-d)--lft (w,-d); |
| 53 |
fi |
| 54 |
enddef; |
| 55 |
|
| 56 |
def rightgrid_charbox = |
| 57 |
if (fonttype = purltype): currentpicture := nullpicture; fi |
| 58 |
if (fonttype = gridtype): currentpicture := nullpicture; fi |
| 59 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 60 |
pickup pensquare scaled gridwidth; |
| 61 |
draw (w,h)--rt (0,h); |
| 62 |
draw (w,h)--(w,-d); |
| 63 |
draw rt (0,-d)--(w,-d); |
| 64 |
fi |
| 65 |
enddef; |
| 66 |
|
| 67 |
def topbotgrid_charbox = |
| 68 |
if (fonttype = purltype): currentpicture := nullpicture; fi |
| 69 |
if (fonttype = gridtype): currentpicture := nullpicture; fi |
| 70 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 71 |
pickup pensquare scaled gridwidth; |
| 72 |
draw (w,h)--(0,h); |
| 73 |
draw (0,-d)--(w,-d); |
| 74 |
fi |
| 75 |
enddef; |
| 76 |
|
| 77 |
if gridfont: |
| 78 |
def charbox = |
| 79 |
if fonttype = purltype: |
| 80 |
currentpicture := nullpicture; |
| 81 |
fi |
| 82 |
if fonttype = gridtype: currentpicture := nullpicture; fi |
| 83 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 84 |
pickup pencircle scaled gridwidth; |
| 85 |
fill (-gridwidth/2,-d-gridwidth/2)--(w+gridwidth/2,-d-gridwidth/2)-- |
| 86 |
(w+gridwidth/2,h+gridwidth/2)--(-gridwidth/2,h+gridwidth/2)--cycle; |
| 87 |
if (w>0): |
| 88 |
unfill (gridwidth/2,-d+gridwidth/2)--(w-gridwidth/2,-d+gridwidth/2)-- |
| 89 |
(w-gridwidth/2,h-gridwidth/2)--(gridwidth/2,h-gridwidth/2)--cycle; |
| 90 |
fi |
| 91 |
fi |
| 92 |
enddef; |
| 93 |
else: |
| 94 |
def charbox = nogrid_charbox enddef; |
| 95 |
fi |
| 96 |
|
| 97 |
def purlbox = charbox; purlfill; enddef; |
| 98 |
|
| 99 |
% We don't need any symbols in the counting fonts because we will never |
| 100 |
% actually show them and clearing them saves a bit of disk space. |
| 101 |
if fonttype = counttype: |
| 102 |
def charbox = currentpicture := nullpicture; enddef; |
| 103 |
def purlbox = currentpicture := nullpicture; enddef; |
| 104 |
fi |
| 105 |
|
| 106 |
picture symbolpic[]; |
| 107 |
path symbolpath[]; |
| 108 |
|
| 109 |
def fliphoriz(text beginning, ending) = |
| 110 |
ending := (beginning) reflectedabout ((.5w,0),(.5w,h)); |
| 111 |
enddef; |
| 112 |
def flipvert(text beginning, ending) = |
| 113 |
ending := (beginning) reflectedabout ((0,(h-d)/2),(w,(h-d)/2)); |
| 114 |
ending := (ending) shifted (0,bottomgap-topgap); |
| 115 |
enddef; |
| 116 |
|
| 117 |
pair arrowpoint; |
| 118 |
|
| 119 |
def definearrow(text thepath, arrowlength, endpath) = |
| 120 |
|
| 121 |
arrowpoint := point infinity of thepath; |
| 122 |
arrowdir := angle(direction infinity of thepath); |
| 123 |
endpath := arrowpoint + ((1,0) rotated (arrowdir+150) scaled arrowlength) |
| 124 |
--arrowpoint + ((1,0) rotated arrowdir scaled 0.5symbolwidth) |
| 125 |
--arrowpoint + ((1,0) rotated (arrowdir-150) scaled arrowlength) |
| 126 |
; |
| 127 |
enddef; |
| 128 |
|
| 129 |
% Error symbols (glyphs that should not happen) |
| 130 |
|
| 131 |
if known debugcables: else: boolean debugcables; debugcables = true; fi |
| 132 |
|
| 133 |
picture errorsymbol[]; |
| 134 |
for k=1,2,3: |
| 135 |
errorsymbol[k] = nullpicture; |
| 136 |
endfor |
| 137 |
if debugcables: |
| 138 |
errorslashes = 4; |
| 139 |
if (fonttype=foretype) or (fonttype=bothtype): |
| 140 |
for j=1,2,3: |
| 141 |
for k=(1/errorslashes) step (1/errorslashes) until 0.99: |
| 142 |
addto errorsymbol[j] doublepath ((0,k[-dp,ht])--(k[wd,0],.001pt+ht)) withpen (pencircle scaled symbolwidth); |
| 143 |
addto errorsymbol[j] doublepath ((j*wd,k[-dp,ht])--(k[j*wd,(j-1)*wd],.001pt-dp)) withpen (pencircle scaled symbolwidth); |
| 144 |
endfor |
| 145 |
for k=0 step (1/errorslashes) until (j-1): |
| 146 |
addto errorsymbol[j] doublepath ((k*wd,-dp)--((k+1)*wd,ht)) withpen (pencircle scaled symbolwidth); |
| 147 |
endfor |
| 148 |
endfor |
| 149 |
fi |
| 150 |
fi |
| 151 |
|
| 152 |
% Arrow symbols |
| 153 |
|
| 154 |
beginchar("s",wd#,ht#,dp#); "Slip one left"; |
| 155 |
pickup symbol_pen; |
| 156 |
y1 = y2 = (h-d)/2-offset; |
| 157 |
0.5[x1,x2]=w/2; |
| 158 |
rt x2 - lft x1 = ht+dp-2*smallgap; |
| 159 |
symbolpath0 := z1--z2; |
| 160 |
definearrow(symbolpath0)((x2-x1)/3)(symbolpath1); |
| 161 |
draw symbolpath0; |
| 162 |
draw symbolpath1; |
| 163 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 164 |
charbox; endchar; |
| 165 |
|
| 166 |
beginchar("S",wd#,ht#,dp#); "Slip one right"; |
| 167 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 168 |
charbox; endchar; |
| 169 |
|
| 170 |
beginchar("[",wd#,ht#,dp#); "Slip one left knitwise"; |
| 171 |
pickup symbol_pen; |
| 172 |
y1 = y2 = (h-d)/2-offset; |
| 173 |
0.5[x1,x2]=w/2; |
| 174 |
rt x2 - lft x1 = ht+dp-2*0.3[smallgap,mingap]; |
| 175 |
symbolpath0 := z1--z2; |
| 176 |
definearrow(symbolpath0)((x2-x1)/3)(symbolpath1); |
| 177 |
draw symbolpath0; |
| 178 |
draw symbolpath1; |
| 179 |
0.5[y3,y4] = y1; |
| 180 |
0.5[x3,x4] = 0.5[lft x1, lft xpart point 0 of symbolpath1]; |
| 181 |
z4 = z3+whatever*(1,2); |
| 182 |
y4-y3 = 1.5 ypart (point 2 of symbolpath1 - point 0 of symbolpath1); |
| 183 |
draw z3--z4; |
| 184 |
labels(1,2,3,4); |
| 185 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 186 |
charbox; endchar; |
| 187 |
|
| 188 |
beginchar("]",wd#,ht#,dp#); "Slip one right knitwise"; |
| 189 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 190 |
flipvert(currentpicture)(currentpicture); |
| 191 |
charbox; endchar; |
| 192 |
|
| 193 |
|
| 194 |
beginchar("h",decrwidth(1,0),ht#,dp#); "Drop stitch"; |
| 195 |
pickup symbol_pen; |
| 196 |
y1 = bot h-small_topgap; |
| 197 |
y2 = top -d+small_bottomgap; |
| 198 |
x1 = x2 =w/2; |
| 199 |
symbolpath0 := z1--z2; |
| 200 |
definearrow(symbolpath0)((y1-y2)/3)(symbolpath1); |
| 201 |
draw symbolpath0; |
| 202 |
draw symbolpath1; |
| 203 |
charbox; endchar; |
| 204 |
|
| 205 |
beginchar("H",incrwidth(0,1),ht#,dp#); "Up arrow"; |
| 206 |
pickup symbol_pen; |
| 207 |
y1 = bot h-small_topgap; |
| 208 |
y2 = top -d+small_bottomgap; |
| 209 |
x1 = x2 =w/2; |
| 210 |
symbolpath0 := z1--z2; |
| 211 |
definearrow(reverse symbolpath0)((y1-y2)/3)(symbolpath1); |
| 212 |
draw symbolpath0; |
| 213 |
draw symbolpath1; |
| 214 |
charbox; endchar; |
| 215 |
|
| 216 |
% Miscellaneous symbols |
| 217 |
|
| 218 |
beginchar("O",incrwidth(0,1),ht#,dp#); "Yarn over"; |
| 219 |
pickup symbol_pen; |
| 220 |
top z1 = (0.5w, h-topgap+o); |
| 221 |
bot z3 = (0.5w, bottomgap-d-o); |
| 222 |
x2-x4 = y1-y3; 0.5[x2,x4]=0.5w; |
| 223 |
y2 = y4 = 0.5[y1,y3]; |
| 224 |
penpos1(symbolwidth,90); |
| 225 |
penpos2(symbolwidth,0); |
| 226 |
penpos3(symbolwidth,270); |
| 227 |
penpos4(symbolwidth,180); |
| 228 |
penstroke z1e..z2e..z3e..z4e..cycle; |
| 229 |
purlbox; endchar; |
| 230 |
|
| 231 |
beginchar("@",wd#,ht#,dp#); "Bead"; |
| 232 |
pickup symbol_pen; |
| 233 |
z1 = (0.5w, 0.667h); |
| 234 |
z3 = (x1,-d+h-y1); |
| 235 |
x2-x4 = y1-y3; 0.5[x2,x4]=0.5w; |
| 236 |
y2 = y4 = 0.5[y1,y3]; |
| 237 |
fill z1..z2..z3..z4..cycle; |
| 238 |
unfill fullcircle scaled 0.3333(y1-y3) shifted 0.5[z1,z3]; |
| 239 |
charbox; endchar; |
| 240 |
|
| 241 |
beginchar(ditto,incrwidth(0,0),ht#,dp#); "Wrap and turn"; |
| 242 |
pickup symbol_pen; |
| 243 |
z0 = 0.4[z1,z3] = 0.5[z2,z4]; |
| 244 |
x3=x1=w/2; y2=y4; y3-y1=x4-x2; |
| 245 |
|
| 246 |
z5 = z3 + 1.5((x4-x2)/2,0); |
| 247 |
z6 = z5 + ((x4-x2)/2,0) rotated 150; |
| 248 |
z7 = z5 + ((x4-x2)/2,0) rotated -150; |
| 249 |
|
| 250 |
y6 = h-wrapturngap; |
| 251 |
y1 = -d+wrapturngap; |
| 252 |
|
| 253 |
top (1-2spiralgap)[z0,z3]+(whatever,symbolwidth) = bot z7; |
| 254 |
|
| 255 |
symbolpath0 := |
| 256 |
(1-2spiralgap)[z0,z2] |
| 257 |
..(1-2spiralgap)[z0,z3] |
| 258 |
..(1-spiralgap)[z0,z4] |
| 259 |
..z1 |
| 260 |
..z2 |
| 261 |
..z3{right}--z5; |
| 262 |
definearrow(symbolpath0)((x4-x2)/2)(symbolpath1); |
| 263 |
draw symbolpath0; |
| 264 |
draw symbolpath1; |
| 265 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 266 |
nogrid_charbox; endchar; |
| 267 |
beginchar(19,incrwidth(0,0),ht#,dp#); "Reverse wrap and turn"; |
| 268 |
fliphoriz(symbolpic0)(currentpicture); |
| 269 |
currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 270 |
nogrid_charbox; endchar; |
| 271 |
|
| 272 |
ligtable |
| 273 |
ditto: |
| 274 |
ditto =: 19; |
| 275 |
ligtable |
| 276 |
"-": |
| 277 |
"=": |
| 278 |
ditto |=: 19; |
| 279 |
|
| 280 |
|
| 281 |
def drawM(expr topheight, bottomheight, mwidth, penwidth) = |
| 282 |
pickup pensquare scaled penwidth; |
| 283 |
rt x3 - lft x1 = 1.43 (y7-y1) = mwidth; |
| 284 |
y1 = y2 = y3; |
| 285 |
bot y7 = y8 = y9; |
| 286 |
topheight - y7 = y1-bottomheight; |
| 287 |
y4 = y10; y5 = y6; |
| 288 |
y8 - y5 = 0.4(x2 - x1); |
| 289 |
y8 - y4 = 1.6(y8 - y5); |
| 290 |
x1 = x7; x5 = x2; x6 = x3; |
| 291 |
x4 - x1 = x10 - x2 = 0.3penwidth; |
| 292 |
x8 = 0.6[x1,x2]; x9 - x2 = x8 - x1; |
| 293 |
x3 - x2 = x2 - x1; |
| 294 |
x1 = w - x3; |
| 295 |
penpos1 (penwidth, 0); |
| 296 |
penpos7 (penwidth, 0); |
| 297 |
penpos5 (penwidth, 0); |
| 298 |
penpos6 (penwidth, 0); |
| 299 |
penpos2 (penwidth, 0); |
| 300 |
penpos3 (penwidth, 0); |
| 301 |
penpos4 (penwidth-2(x4-x1), 180); |
| 302 |
penpos10 (penwidth-2(x4-x1), 180); |
| 303 |
penpos8 (penwidth, 90); |
| 304 |
penpos9 (penwidth, 90); |
| 305 |
%draw z4{up}..z8{right}..z5{down}; draw z10{up}..z9{right}..z6{down}; |
| 306 |
penstroke z1e--z7e; |
| 307 |
penstroke z4e{up}..z8e..z5e{down}--z2e; penstroke z10e{up}..z9e..z6e{down}--z3e; |
| 308 |
labels(1,2,3,4,5,6,7,8,9,10,4l,4r); |
| 309 |
enddef; |
| 310 |
|
| 311 |
beginchar("*",wd#,ht#,dp#); "Special instructions"; |
| 312 |
pickup symbol_pen; |
| 313 |
top z1 = (w/2,h-topgap+o); |
| 314 |
bot z2 = (w/2, -d+bottomgap-o); |
| 315 |
z3 - z4 = (z1-z2) rotated 60; |
| 316 |
z5 - z6 = (z1-z2) rotated 120; |
| 317 |
0.5[z3,z4] = 0.5 [z5,z6] = 0.5[z1,z2]; |
| 318 |
for k=1,3,5: |
| 319 |
z[k]' = 0.25[z[k],z[k+1]]; |
| 320 |
0.5[z[k+1]',z[k]']=0.5[z1,z2]; |
| 321 |
z[k]'' = 0.5[z[k],z[k+1]]; |
| 322 |
penpos[k]'(symbolwidth, angle (z[k]-z[k+1])+90); |
| 323 |
penpos[k+1]'(symbolwidth, angle (z[k]-z[k+1])+90); |
| 324 |
penpos[k]''((1/sqrt(3))*symbolwidth, angle (z[k]-z[k+1])+90); |
| 325 |
draw z[k]--z[k]'; draw z[k+1]--z[k+1]'; |
| 326 |
penstroke z[k]'e{z[k+1]-z[k]}..z[k]''e..{z[k+1]-z[k]}z[k+1]'e; |
| 327 |
endfor |
| 328 |
charbox; endchar; |
| 329 |
|
| 330 |
%beginchar("a",wd#,ht#,dp#); "Small bobble"; |
| 331 |
% pickup symbol_pen; |
| 332 |
% top z1 = (0.5w, h-small_topgap+o); |
| 333 |
% bot z3 = (0.5w, small_bottomgap-d-o); |
| 334 |
% x2-x4 = y1-y3; 0.5[x2,x4]=0.5w; |
| 335 |
% y2 = y4 = 0.5[y1,y3]; |
| 336 |
% pickup pensquare scaled symbolwidth rotated 45; |
| 337 |
% draw z1--z2; draw z2--z3; draw z3--z4; draw z4--z1; |
| 338 |
% drawdot 0.5[z1,z3]; |
| 339 |
%charbox; endchar; |
| 340 |
beginchar(0,wd#,ht#,dp#); "Large bobble"; |
| 341 |
pickup symbol_pen; |
| 342 |
top z0 = (w/2, h-min_topgap) if offset=0: + (0,o) fi; |
| 343 |
bot z2 = (w/2, -d+min_bottomgap) if offset=0: - (0,o) fi; |
| 344 |
0.5[z1,z3] = 0.5[z0,z2]; |
| 345 |
z1-z3 = (z2-z0) rotated 90; |
| 346 |
draw z0..z1..z2..z3..cycle; |
| 347 |
charbox; endchar; |
| 348 |
|
| 349 |
|
| 350 |
def drawhat(expr linewd) = |
| 351 |
pickup symbol_pen; |
| 352 |
top z1 = (w/2, h-min_topgap+o); |
| 353 |
x3-x1 = x1-x2; y3=y2; |
| 354 |
x3-x2 = standardheight; |
| 355 |
y1-y3 = (x1-x2); |
| 356 |
z3l = z3 + ((linewd/2,0) rotated (angle (z1-z3)-90)); |
| 357 |
z3m = z3 + ((linewd/2,0) rotated (angle (z3-z1))); |
| 358 |
0.5[z3l,z3r] = z3; |
| 359 |
z2l = z2 + ((linewd/2,0) rotated (angle (z2-z1)-90)); |
| 360 |
z2m = z2 + ((linewd/2,0) rotated (angle (z2-z1))); |
| 361 |
0.5[z2l,z2r] = z2; |
| 362 |
z1r = z3r + whatever*(z1-z3); |
| 363 |
z1r = z2r + whatever*(z2-z1); |
| 364 |
z1l3-z1 = z3l-z3; |
| 365 |
z1l2-z1 = z2l-z2; |
| 366 |
fill z3l---z1l3..z1l2---z2l..z2m..z2r---z1r---z3r..z3m..cycle; |
| 367 |
enddef; |
| 368 |
|
| 369 |
% Increases and decreases |
| 370 |
|
| 371 |
beginchar(1,wd#,ht#,dp#); "Make 1 from N"; |
| 372 |
% Fontforge keeps mangling this symbol, so I'm doing it the slow, hard, but reliable way. |
| 373 |
drawhat(symbolwidth); |
| 374 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 375 |
charbox; endchar; |
| 376 |
beginchar(2,wd#,ht#,dp#); "Purl make 1 from N"; |
| 377 |
drawhat(purl_symbolwidth); |
| 378 |
symbolpic1 := currentpicture; symbolpicwd1 := w; |
| 379 |
purlbox; endchar; |
| 380 |
beginchar(3,wd#,ht#,dp#); "Make N from 1"; |
| 381 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 382 |
charbox; endchar; |
| 383 |
beginchar(4,wd#,ht#,dp#); "Purl make N from 1"; |
| 384 |
flipvert(symbolpic1)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd1)/2,0); |
| 385 |
purlbox; endchar; |
| 386 |
|
| 387 |
beginchar("U",incrwidth(0,1),ht#,dp#); "Cast on"; |
| 388 |
pickup symbol_pen; |
| 389 |
bot y1 = bot y3 = -d+bottomgap; |
| 390 |
x1 = 0; x3 = w; x2 = w/2; top y2 = h-topgap; |
| 391 |
draw z1{right}..z2{left}..z3{right}; |
| 392 |
nogrid_charbox; endchar; |
| 393 |
beginchar("f",decrwidth(1,0),ht#,dp#); "Bind off knitwise"; |
| 394 |
pickup symbol_pen; |
| 395 |
x3-x1=wd; 0.5[x1,x3]=w/2; x2 = 0.5[x1,x3]; |
| 396 |
y1 = y3 = (h-d)/2; top y2 = h-topgap; |
| 397 |
bot z4 = (w/2, -d+bottomgap); |
| 398 |
symbolpath0 := z1..z2{right}..z3; |
| 399 |
draw symbolpath0; |
| 400 |
%draw z4--bot z1; |
| 401 |
nogrid_charbox; endchar; |
| 402 |
beginchar("F",decrwidth(1,0),ht#,dp#); "Bind off purlwise"; |
| 403 |
if fonttype <> purltype: |
| 404 |
pickup purl_symbol_pen; |
| 405 |
draw symbolpath0; |
| 406 |
fi |
| 407 |
nogrid_charbox; purlfill; endchar; |
| 408 |
beginchar("Z",incrwidth(1,3),ht#,dp#); "Knit one doubly elongated"; |
| 409 |
pickup symbol_pen; |
| 410 |
0.5[z1,z7] = top (w/2, -d+min_bottomgap); |
| 411 |
y1 = y7; |
| 412 |
x7 - x1 = 0.8(x8 - x0); |
| 413 |
0.5[x0,x8] = w/2; |
| 414 |
y0 = y8 = 0.5[y1,y2]; |
| 415 |
x8 - x0 = y2 - y1; |
| 416 |
0.5[z2,z6] = bot (w/2, h-min_topgap); |
| 417 |
y2 = y6; |
| 418 |
x6 - x2 = 0.7(x7-x1); |
| 419 |
0.5[x3,x5] = w/2; |
| 420 |
y3 = y5 = 0.2[y1,y2]; |
| 421 |
x5 - x3 = 0.5(x7-x1); |
| 422 |
|
| 423 |
x4 = w/2; y4 = y2; |
| 424 |
|
| 425 |
endangle := 110; |
| 426 |
midtension := 2; |
| 427 |
sidetension := 2; |
| 428 |
|
| 429 |
draw |
| 430 |
z1{dir endangle} |
| 431 |
..z0{up} |
| 432 |
..z2{right} |
| 433 |
..tension sidetension |
| 434 |
..z3{left} |
| 435 |
..tension midtension |
| 436 |
..z4{right} |
| 437 |
..tension midtension |
| 438 |
..z5{left} |
| 439 |
..tension sidetension |
| 440 |
..z6{right} |
| 441 |
..z8{down} |
| 442 |
..z7{dir(-endangle)}; |
| 443 |
|
| 444 |
charbox; endchar; |
| 445 |
|
| 446 |
beginchar("z",incrwidth(1,2),ht#,dp#); "Knit one elongated"; |
| 447 |
pickup symbol_pen; |
| 448 |
0.5[z1,z5] = top (w/2, -d+small_bottomgap); |
| 449 |
y1 = y5; |
| 450 |
x5 - x1 = 0.8(x6-x0); |
| 451 |
0.5[x0,x6] = w/2; |
| 452 |
y0 = y6 = 0.5[y1,y2]; |
| 453 |
x6 - x0 = y2 - y1; |
| 454 |
0.5[z2,z4] = bot (w/2, h-small_topgap); |
| 455 |
y2 = y4; |
| 456 |
x4 - x2 = 0.6(x5-x1); |
| 457 |
x3 = w/2; y3 = 0.2[y1,y2]; |
| 458 |
|
| 459 |
endangle := 110; |
| 460 |
midtension := 1.5; |
| 461 |
|
| 462 |
draw |
| 463 |
z1{dir endangle}..z0{up}..z2{right}..tension midtension..z3{left} |
| 464 |
..tension midtension..z4{right}..z6{down}..z5{dir(-endangle)}; |
| 465 |
|
| 466 |
charbox; endchar; |
| 467 |
beginchar("9",incrwidth(1,2),ht#,dp#); "CYCA knit one elongated"; |
| 468 |
pickup symbol_pen; |
| 469 |
y0l=y0r; y1l=y1r; y2l=y2r; |
| 470 |
x0r=wd-x0l; |
| 471 |
x1r=wd-x1l; |
| 472 |
x2r=wd-x2l; |
| 473 |
z0l = top rt (mingap-ho,-d+small_bottomgap-o); |
| 474 |
y1l = bot h-small_topgap; |
| 475 |
x2r-x2l = y1l-y0l+2(smallgap-mingap-o/2); |
| 476 |
x1l = 0.23[x2l,x2r]; |
| 477 |
y2l = 0.7[y0l,y1l]; |
| 478 |
draw z0l..tension 3..z1l{left}..z2l{down}..tension 1.5.. |
| 479 |
z2r{up}..z1r{left}..tension 3..z0r; |
| 480 |
labels(0l,1l,2l,0r,1r,2r); |
| 481 |
currentpicture := currentpicture shifted ((w-wd)/2,0); |
| 482 |
charbox; endchar; |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
beginchar(25,wd#/2,ht#,dp#); "Left end of a wide increase"; |
| 487 |
pickup pensquare xscaled wideinctip yscaled wideincline; |
| 488 |
z1 = (w+cableextend,(h-topgap-d+bottomgap)/2); |
| 489 |
x2 = w/3; top y2 = h-min_topgap+o; |
| 490 |
fill bot lft z2{down}..bot z1{right}--top z1{left}..top rt z2{up}--top lft z2---cycle; |
| 491 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 492 |
leftgrid_charbox; endchar; |
| 493 |
beginchar(22,wd#/2,ht#,dp#); "Extender for a wide increase/decrease"; |
| 494 |
z1 = (w+cableextend,(h-topgap-d+bottomgap)/2); |
| 495 |
x2 = 0-cableextend; y2 = y1; |
| 496 |
pickup pensquare scaled wideincline; |
| 497 |
draw rt z2 -- lft z1; |
| 498 |
topbotgrid_charbox; endchar; |
| 499 |
beginchar(26,wd#/2,ht#,dp#); "Right end of a wide increase"; |
| 500 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); rightgrid_charbox; endchar; |
| 501 |
beginchar(27,wd#/2,ht#,dp#); "Left end of a wide decrease"; |
| 502 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); leftgrid_charbox; endchar; |
| 503 |
beginchar(28,wd#/2,ht#,dp#); "Right end of a wide decrease"; |
| 504 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); flipvert(currentpicture)(currentpicture); rightgrid_charbox; endchar; |
| 505 |
|
| 506 |
beginchar(29,wd#,ht#,dp#); "Middle of a wide increase"; |
| 507 |
pickup pensquare xscaled wideinctip yscaled wideincline; |
| 508 |
z1 = (-cableextend,(h-topgap-d+bottomgap)/2); |
| 509 |
z3 = (w+cableextend,(h-topgap-d+bottomgap)/2); |
| 510 |
x2 = w/2; bot y2 = -d+min_bottomgap-o; |
| 511 |
%draw z1{right}..z2{down}; |
| 512 |
fill bot lft z2{up}..bot z1{left}--top z1{right}..top rt z2---bot rt z2--cycle; |
| 513 |
%draw z3{left}..z2{down}; |
| 514 |
fill bot rt z2{up}..bot z3{right}--top z3{left}..top lft z2---bot lft z2--cycle; |
| 515 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 516 |
topbotgrid_charbox; |
| 517 |
endchar; |
| 518 |
beginchar(30,wd#,ht#,dp#); "Middle of a wide decrease"; |
| 519 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 520 |
topbotgrid_charbox; |
| 521 |
endchar; |
| 522 |
|
| 523 |
if 5*wd# < symbolmaxwd#: |
| 524 |
|
| 525 |
beginchar(31,if fonttype = counttype: decrwidth(5,1) else: 5wd# fi,ht#,dp#); "Make 1 from 5"; |
| 526 |
pickup pensquare xscaled wideinctip yscaled wideincline; |
| 527 |
top z1 = (w/2,h-min_topgap+o); |
| 528 |
x2 = wd/3; bot y2 = bot y3 = -d+min_bottomgap-o; |
| 529 |
x3 - x1 = x1 - x2; |
| 530 |
z4 = 0.5[z1,z2]; z5 = 0.5[z1,z3]; |
| 531 |
%draw z2{up}..z4{right}..z1{up}; |
| 532 |
%draw z3{up}..z5{left}..z1{up}; |
| 533 |
|
| 534 |
fill bot lft z2---top lft z2..top z4{right}..top lft z1{up}--top rt z1---bot rt z1..bot z4{left }..bot rt z2{down}--cycle; |
| 535 |
fill bot rt z3---top rt z3..top z5{left }..top rt z1{up}--top lft z1---bot lft z1..bot z5{right}..bot lft z3{down}--cycle; |
| 536 |
|
| 537 |
charbox; endchar; |
| 538 |
fi |
| 539 |
|
| 540 |
beginchar("~",incrwidth(0,0),ht#,dp#); "Empty box (spacer)"; endchar; |
| 541 |
beginchar("`",if fonttype = counttype: 0 else: 0.5wd# fi,ht#,dp#); "Empty box (spacer)"; endchar; |
| 542 |
beginchar("'",if fonttype = counttype: 0 else: 0.5wd# fi,ht#,dp#); "Empty box (spacer)"; |
| 543 |
if fonttype = purltype: fill (0,-d)--(w,-d)--(w,h)--(0,h)--cycle; fi |
| 544 |
endchar; |
| 545 |
|
| 546 |
|
| 547 |
beginchar("m",incrwidth(0,1),ht#,dp#); "Make one"; |
| 548 |
pickup symbol_pen; |
| 549 |
drawM(h-topgap, -d+bottomgap, 0.5(h+d),symbolwidth); |
| 550 |
charbox; endchar; |
| 551 |
beginchar("M",incrwidth(0,1),ht#,dp#); "Make one purlwise"; |
| 552 |
pickup purl_symbol_pen; |
| 553 |
drawM(h-topgap, -d+bottomgap, 0.5(h+d),purl_symbolwidth); |
| 554 |
purlbox; endchar; |
| 555 |
|
| 556 |
%def drawB(expr topgap, bottomgap, symbolwidth) = |
| 557 |
% x1 = x2 = x3; x4 = x5 = x6; x7=x8 + 0.05(x7-x1); |
| 558 |
% y1 = y4; y2 = y5; y3 = y6; y7 = 0.5[y1,y2]; y8 = 0.5[y2,y3]; |
| 559 |
% top y3 = h-topgap; bot y1 = -d+bottomgap; |
| 560 |
% y2 = 0.51[y1,y3]; |
| 561 |
% x7-x1 = 1.3(y2-y1); |
| 562 |
% x7-x6 = 0.7(x7-x1); |
| 563 |
% 0.5[x7,x1]=w/2+ho; |
| 564 |
% z9=z10=z5; z11=rt z2; |
| 565 |
% |
| 566 |
% penpos11(symbolwidth,-90); |
| 567 |
% penpos5(symbolwidth,-90); |
| 568 |
% penpos8(symbolwidth,0); |
| 569 |
% penpos6(symbolwidth,90); |
| 570 |
% penpos2(symbolwidth,180); |
| 571 |
% penpos4(symbolwidth,-90); |
| 572 |
% penpos7(symbolwidth,0); |
| 573 |
% z10l=z5l; z9l=z5r; z10r = 0.4[z5,z5r]; |
| 574 |
% z9r-z9l=z10l-z10r; |
| 575 |
% y3r=y6r; y3l=y6l; x3r=x2r=x1r; x3l=x2l=x1l; |
| 576 |
% y1r=y4r; y1l=y4l; |
| 577 |
% penstroke z11e--z5e--z10e{right}..z8e..z6e---z3e--z2e--z1e---z4e..z7e..z9e{left}; |
| 578 |
% |
| 579 |
%enddef; |
| 580 |
% |
| 581 |
% |
| 582 |
%beginchar("b",wd#,ht#,dp#); "Knit tbl"; |
| 583 |
% pickup symbol_pen; |
| 584 |
% drawB(topgap, bottomgap, symbolwidth); |
| 585 |
% charbox; endchar; |
| 586 |
%beginchar("B",wd#,ht#,dp#); "Purl tbl"; |
| 587 |
% pickup purl_symbol_pen; |
| 588 |
% drawB(topgap, bottomgap, purl_symbolwidth); |
| 589 |
% purlbox; endchar; |
| 590 |
|
| 591 |
beginchar("|",if fonttype <> counttype: overlinewd# else: 0 fi,ht#,dp#); "Divider"; |
| 592 |
if (fonttype = foretype) or (fonttype = bothtype): |
| 593 |
fill(0,-d-gridwidth/2-purlextend)--(0,h+gridwidth/2+purlextend) |
| 594 |
--(w,h+gridwidth/2+purlextend)--(w,-d-gridwidth/2-purlextend) |
| 595 |
--cycle; |
| 596 |
fi |
| 597 |
endchar; |
| 598 |
|
| 599 |
%Twists |
| 600 |
|
| 601 |
path twistpath[]; |
| 602 |
|
| 603 |
pair time; |
| 604 |
|
| 605 |
beginchar("x",incrwidth(0,1),ht#,dp#); "Twist slanting right"; |
| 606 |
pickup symbol_pen; |
| 607 |
bot lft z0 = (0.5w-0.4 standardheight-ho,-d+small_bottomgap-o); |
| 608 |
bot rt z4 = (0.5w+0.4 standardheight+ho,-d+small_bottomgap-o); |
| 609 |
top z2 = (0.5w, h-topgap+o); |
| 610 |
x3-x1 = 0.8(x0-x4); 0.5[x1,x3] = w/2; |
| 611 |
y1 = y3 = 0.7[y0,y2]; |
| 612 |
twistpath0:=z0{curl 0.1}..z1{up}..z2..z3{down}..z4{curl 0.1}; |
| 613 |
|
| 614 |
pathdir0 = angle (direction 0 of twistpath0); |
| 615 |
pathdir4 = angle (direction 4 of twistpath0); |
| 616 |
|
| 617 |
penpos0(symbolwidth, (pathdir0 + 90)); |
| 618 |
penpos1(symbolwidth, 180); |
| 619 |
penpos2(symbolwidth, 270); |
| 620 |
penpos3(symbolwidth, 360); |
| 621 |
penpos4(symbolwidth, (pathdir4 + 90)); |
| 622 |
|
| 623 |
z5 = z0; z6 = z1; |
| 624 |
penpos5(eraserwidth, (pathdir0 + 90)); |
| 625 |
penpos6(eraserwidth, 180); |
| 626 |
|
| 627 |
time := (z5l{direction 0 of twistpath0}..z6l{up}) intersectiontimes |
| 628 |
(z3l{down}..z4l{direction 4 of twistpath0}); |
| 629 |
twistpath1 := subpath (ypart(time),1) of (z3l{down}..z4l{direction 4 of twistpath0}); |
| 630 |
time := (z5l{direction 0 of twistpath0}..z6l{up}) intersectiontimes |
| 631 |
(z3r{down}..z4r{direction 4 of twistpath0}); |
| 632 |
twistpath2 := subpath (ypart(time),1) of (z3r{down}..z4r{direction 4 of twistpath0}); |
| 633 |
fill twistpath1 & (point infinity of twistpath1--point infinity of twistpath2) |
| 634 |
& reverse twistpath 2 & |
| 635 |
(point 0 of twistpath2--point 0 of twistpath1) & cycle; |
| 636 |
|
| 637 |
time := (z5r{direction 0 of twistpath0}..z6r{up}) intersectiontimes |
| 638 |
(z3l{down}..z4l{direction 4 of twistpath0}); |
| 639 |
twistpath1 := subpath (0,ypart(time)) of (z3l{down}..z4l{direction 4 of twistpath0}); |
| 640 |
time := (z5r{direction 0 of twistpath0}..z6r{up}) intersectiontimes |
| 641 |
(z3r{down}..z4r{direction 4 of twistpath0}); |
| 642 |
twistpath2:= subpath (0,ypart(time)) of (z3r{down}..z4r{direction 4 of twistpath0}); |
| 643 |
fill twistpath1 & (point infinity of twistpath1--point infinity of twistpath2) |
| 644 |
& reverse twistpath 2 & |
| 645 |
(point 0 of twistpath2--point 0 of twistpath1) & cycle; |
| 646 |
|
| 647 |
penstroke z0e{direction 0 of twistpath0}.. |
| 648 |
z1e{up}..z2e{left}..z3e{down} |
| 649 |
;%..z4e{direction 4 of twistpath0}; |
| 650 |
|
| 651 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 652 |
labels(0,1,2,3,4,5); |
| 653 |
charbox; endchar; |
| 654 |
|
| 655 |
numeric t[]; |
| 656 |
|
| 657 |
beginchar("t",incrwidth(0,1),ht#,dp#); "Twist slanting left"; |
| 658 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 659 |
charbox; endchar; |
| 660 |
|
| 661 |
beginchar("X",incrwidth(0,1),ht#,dp#); "Purl right twist"; |
| 662 |
currentpicture := symbolpic0; currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 663 |
purlbox; endchar; |
| 664 |
beginchar("T",incrwidth(0,1),ht#,dp#); "Purl left twist"; |
| 665 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 666 |
purlbox; endchar; |
| 667 |
|
| 668 |
beginchar("b",wd#,ht#,dp#); "Right upside-down twist"; |
| 669 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 670 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 671 |
charbox; endchar; |
| 672 |
beginchar("q",wd#,ht#,dp#); "Left upside-down twist"; |
| 673 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 674 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 675 |
charbox; endchar; |
| 676 |
beginchar("Q",wd#,ht#,dp#); "Purl right upside-down twist"; |
| 677 |
currentpicture := symbolpic0; currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 678 |
purlbox; endchar; |
| 679 |
beginchar("B",wd#,ht#,dp#); "Purl left upside-down twist"; |
| 680 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 681 |
purlbox; endchar; |
| 682 |
|
| 683 |
%2/1 increases and decreases |
| 684 |
|
| 685 |
def drawSSK(expr topheight,bottom) = |
| 686 |
bot rt z1 = (0.5w+0.5 (topheight-bottom)+ho,bottom-o); |
| 687 |
top lft z2 = (0.5w-0.5 (topheight-bottom), topheight+o); |
| 688 |
bot lft z3 = (0.5w-0.5 (topheight-bottom), bottom-o); |
| 689 |
symbolpath0 := z1--z2--z3; |
| 690 |
draw symbolpath0; |
| 691 |
enddef; |
| 692 |
|
| 693 |
beginchar("<",decrwidth(2,1),ht#,dp#); "SSK or left-slant cable"; |
| 694 |
pickup symbol_pen; |
| 695 |
drawSSK(h-topgap,-d+bottomgap); |
| 696 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 697 |
charbox; endchar; |
| 698 |
beginchar(">",decrwidth(2,1),ht#,dp#); "k2tog or right-slant cable"; |
| 699 |
fliphoriz(symbolpic0)(currentpicture); |
| 700 |
currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 701 |
charbox; endchar; |
| 702 |
|
| 703 |
beginchar("0",incrwidth(1,2),ht#,dp#); "Make 2 from 1"; |
| 704 |
flipvert(symbolpic0)(currentpicture); |
| 705 |
charbox; endchar; |
| 706 |
beginchar("#",incrwidth(1,2),ht#,dp#); "Make 2 from 1"; |
| 707 |
flipvert(symbolpic0)(currentpicture); |
| 708 |
fliphoriz(currentpicture)(currentpicture); |
| 709 |
charbox; endchar; |
| 710 |
|
| 711 |
beginchar(";",decrwidth(2,1),ht#,dp#); "P2tog"; |
| 712 |
pickup purl_symbol_pen; |
| 713 |
draw symbolpath0; |
| 714 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 715 |
purlbox; endchar; |
| 716 |
beginchar(":",decrwidth(2,1),ht#,dp#); "SSP"; |
| 717 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 718 |
purlbox; endchar; |
| 719 |
|
| 720 |
beginchar("j",incrwidth(0,1),ht#,dp#); "Lifted increase slanting left"; |
| 721 |
pickup symbol_pen; |
| 722 |
top lft z1 = (0.5w-0.5 standardheight-ho,h-topgap+o); |
| 723 |
bot rt z2 = (0.5w+0.5 standardheight, -d+bottomgap-o); |
| 724 |
symbolpath0 := z2--z1; |
| 725 |
definearrow(symbolpath0)((y1-y2)/3)(symbolpath1); |
| 726 |
draw symbolpath0; |
| 727 |
draw symbolpath1; |
| 728 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 729 |
charbox; endchar; |
| 730 |
beginchar("i",incrwidth(0,1),ht#,dp#); "Lifted increase slanting right"; |
| 731 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 732 |
charbox; endchar; |
| 733 |
beginchar("J",incrwidth(0,1),ht#,dp#); "Purl increase slanting right"; |
| 734 |
pickup purl_symbol_pen; |
| 735 |
draw symbolpath0; |
| 736 |
draw symbolpath1; |
| 737 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 738 |
purlbox; endchar; |
| 739 |
beginchar("I",incrwidth(0,1),ht#,dp#); "Purl increase slanting left"; |
| 740 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 741 |
purlbox; endchar; |
| 742 |
|
| 743 |
beginchar("(",wd#,ht#,dp#); "Left-slanting line"; |
| 744 |
pickup symbol_pen; |
| 745 |
top lft z1 = (0.5w-0.5 standardheight-ho,h-topgap+o); |
| 746 |
bot rt z2 = (0.5w+0.5 standardheight, -d+bottomgap-o); |
| 747 |
symbolpath0 := z2--z1; |
| 748 |
draw symbolpath0; |
| 749 |
charbox; endchar; |
| 750 |
beginchar(")",wd#,ht#,dp#); "Right-slanting line"; |
| 751 |
pickup symbol_pen; |
| 752 |
draw symbolpath0; |
| 753 |
fliphoriz(currentpicture)(currentpicture); |
| 754 |
charbox; endchar; |
| 755 |
|
| 756 |
beginchar("y",incrwidth(1,2),ht#,dp#); "Knit front and back"; |
| 757 |
pickup symbol_pen; |
| 758 |
bot lft z1 = (0.5w-0.495 Vwidth-ho,-d+bottomgap-o); |
| 759 |
top rt z2 = (0.5w+0.495 Vwidth+ho,h-topgap+o); |
| 760 |
bot rt z3 = (0.5w+0.495 Vwidth+ho,-d+bottomgap-o); |
| 761 |
top lft z4 = (0.5w-0.495 Vwidth-ho,h-topgap+o); |
| 762 |
% For some reason, mf2pt1 doesn't like it if I use 0.5 Vwidth |
| 763 |
z5 = whatever[z1,z2] = whatever[z3,z4]; |
| 764 |
draw z1--z2; |
| 765 |
draw z4--z5; |
| 766 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 767 |
charbox; endchar; |
| 768 |
beginchar("u",incrwidth(1,2),ht#,dp#); "Knit back and front"; |
| 769 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 770 |
charbox; endchar; |
| 771 |
beginchar("4",decrwidth(2,1),ht#,dp#); "Alternative SSK"; |
| 772 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 773 |
charbox; endchar; |
| 774 |
beginchar("5",decrwidth(2,1),ht#,dp#); "Alternative K2tog"; |
| 775 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 776 |
fliphoriz(currentpicture)(currentpicture); |
| 777 |
charbox; endchar; |
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
beginchar("7",incrwidth(1,2),ht#,dp#); "Alt front and back"; |
| 782 |
pickup symbol_pen; |
| 783 |
x0 = x1 = x2; |
| 784 |
bot y0 = -d+small_bottomgap; |
| 785 |
top y1 = h-small_topgap; |
| 786 |
0.5[x3+ho,x0] = w/2; |
| 787 |
z3 = z2 + whatever*(-1.2,1); |
| 788 |
y3 = 0.9[y0,y1]; |
| 789 |
y2 = 0.4[y0,y1]; |
| 790 |
draw z2--z3; draw z1--z0; |
| 791 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 792 |
charbox; endchar; |
| 793 |
beginchar("8",incrwidth(1,2),ht#,dp#); "Alt back and front"; |
| 794 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 795 |
charbox; endchar; |
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
beginchar("v",incrwidth(1,2),ht#,dp#); "Generic make 2 from 1"; |
| 800 |
pickup symbol_pen; |
| 801 |
top rt z1 = (0.5w+0.5 Vwidth+ho,h-topgap+o); |
| 802 |
bot y2 = -d+bottomgap-o; x2 = 0.5[x1,x3]; |
| 803 |
top lft z3 = (0.5w-0.5 Vwidth-ho,h-topgap+o); |
| 804 |
symbolpath0 := z1--z2--z3; |
| 805 |
draw symbolpath0; |
| 806 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 807 |
charbox; endchar; |
| 808 |
beginchar("V",incrwidth(1,2),ht#,dp#); "Purl make 2 from 1"; |
| 809 |
pickup purl_symbol_pen; |
| 810 |
draw symbolpath0; |
| 811 |
symbolpic1 := currentpicture; symbolpicwd1 := w; |
| 812 |
purlbox; endchar; |
| 813 |
beginchar("6",wd#,ht#,dp#); "V with bar"; |
| 814 |
pickup symbol_pen; |
| 815 |
currentpicture := symbolpic0; currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 816 |
0.5[x0,x1]=w/2; |
| 817 |
y0=y1=0.6[-d+bottomgap,h-topgap]; |
| 818 |
rt x1-lft x0 = Wwidth; |
| 819 |
draw z0--z1; |
| 820 |
charbox; endchar; |
| 821 |
|
| 822 |
beginchar("!",decrwidth(2,1),ht#,dp#); "Make 1 from 2"; |
| 823 |
flipvert(symbolpic0)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 824 |
charbox; endchar; |
| 825 |
beginchar("2",decrwidth(2,1),ht#,dp#); "Make 1 from 2 purlwise"; |
| 826 |
flipvert(symbolpic1)(currentpicture); currentpicture := currentpicture shifted ((w-symbolpicwd1)/2,0); |
| 827 |
purlbox; endchar; |
| 828 |
|
| 829 |
%Double decreases and increases |
| 830 |
|
| 831 |
beginchar("w",incrwidth(1,3),ht#,dp#); "make 3 from 1"; |
| 832 |
pickup symbol_pen; |
| 833 |
top lft z1 = (0.5w-0.5 Wwidth-ho,h-small_topgap+o); |
| 834 |
bot z2 = (0.5w,-d+small_bottomgap-o); |
| 835 |
top rt z3 = (0.5w+0.5 Wwidth+ho, h-small_topgap+o); |
| 836 |
z4 = 0.5[z1,z3]; |
| 837 |
symbolpath0 := z1--z2--z3; |
| 838 |
draw symbolpath0; |
| 839 |
symbolpath1 := z2--z4; |
| 840 |
draw symbolpath1; |
| 841 |
charbox; endchar; |
| 842 |
beginchar("W",incrwidth(1,3),ht#,dp#); "Purl make 3 from 1"; |
| 843 |
pickup purl_symbol_pen; |
| 844 |
draw symbolpath0; draw symbolpath1; |
| 845 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 846 |
purlbox; endchar; |
| 847 |
beginchar("Y",incrwidth(1,3),ht#,dp#); "Make 3 from 1 with YO center"; |
| 848 |
pickup symbol_pen; |
| 849 |
draw symbolpath0; |
| 850 |
top z4 = (0.5w, h-small_topgap+o); |
| 851 |
bot z5 = z4 - (0, 0.5Wwidth); %Better way? |
| 852 |
z6-z7 = (z4-z5) rotated 90; 0.5[z6,z7]=0.5[z4,z5]; |
| 853 |
draw z4..z6..z5..z7..cycle; |
| 854 |
charbox; endchar; |
| 855 |
|
| 856 |
beginchar("E",incrwidth(1,3),ht#,dp#); "make 3 from 1 with purl center"; |
| 857 |
pickup symbol_pen; |
| 858 |
if (fonttype = foretype) or (fonttype = bothtype): |
| 859 |
currentpicture := symbolpic0; currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 860 |
fi |
| 861 |
charbox; |
| 862 |
if (fonttype = purltype): |
| 863 |
z1 = point 0 of symbolpath0; |
| 864 |
z2 = point 1 of symbolpath0; |
| 865 |
z3 = point 2 of symbolpath0; |
| 866 |
fill z1--z2--z3--cycle; |
| 867 |
fi |
| 868 |
endchar; |
| 869 |
|
| 870 |
beginchar("&",incrwidth(1,3),ht#,dp#); "make 3 from 1 with knit center"; |
| 871 |
pickup symbol_pen; |
| 872 |
if (fonttype = foretype) or (fonttype = bothtype): |
| 873 |
currentpicture := symbolpic0; currentpicture := currentpicture shifted ((w-symbolpicwd0)/2,0); |
| 874 |
fi |
| 875 |
charbox; |
| 876 |
if (fonttype = purltype): |
| 877 |
z1 = point 0 of symbolpath0; |
| 878 |
z2 = point 1 of symbolpath0; |
| 879 |
z3 = point 2 of symbolpath0; |
| 880 |
fill z1--z2--z3--%z1--(0,h)-- |
| 881 |
(w,h)--(w,-d)--(0,-d)--(0,h)--cycle; |
| 882 |
fi |
| 883 |
endchar; |
| 884 |
|
| 885 |
beginchar("A",decrwidth(3,1),ht#,dp#); "Make 1 from 3"; |
| 886 |
pickup symbol_pen; |
| 887 |
bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); |
| 888 |
bot rt z3 = (0.5w+0.5 biggerheight+ho,-d+small_bottomgap-o); |
| 889 |
top z2 = (xpart z4, h-small_topgap+o); |
| 890 |
z4 = 0.5[z1,z3]; |
| 891 |
symbolpath0 := z1--z2--z3; |
| 892 |
symbolpath1 := z2--z4; |
| 893 |
draw symbolpath0; |
| 894 |
draw symbolpath1; |
| 895 |
labels(1,2,3,4); |
| 896 |
charbox; endchar; |
| 897 |
beginchar("3",decrwidth(3,1),ht#,dp#); "Purl make 1 from 3"; |
| 898 |
pickup purl_symbol_pen; |
| 899 |
draw symbolpath0; |
| 900 |
draw symbolpath1; |
| 901 |
purlbox; endchar; |
| 902 |
|
| 903 |
beginchar("R",decrwidth(3,1),ht#,dp#); "k3tog"; |
| 904 |
pickup symbol_pen; |
| 905 |
finesymbolwidth := 4/7symbolwidth; |
| 906 |
top rt z0 = (0.5w+0.5 biggerheight, h-small_topgap+o); |
| 907 |
bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); |
| 908 |
bot rt z3 = (0.5w+0.5 biggerheight, -d+small_bottomgap-o); |
| 909 |
|
| 910 |
% The line z0--z4 is halfway between z0--z1 and z0--z3 as angles |
| 911 |
z4 = whatever[z1,z3]; |
| 912 |
z4 = z0+whatever*(dir 0.5[angle(z1-z0),angle(z3-z0)]); |
| 913 |
z5 = 0.5[z1,z3]; |
| 914 |
|
| 915 |
z2 = 0.5[z4,z5]; |
| 916 |
|
| 917 |
z1' = 0.5[z1,z0]; |
| 918 |
z3' = 0.2[z3,z0]; |
| 919 |
z2'' = z0; |
| 920 |
z2' = 0.2[z2,z2'']; |
| 921 |
penpos1(symbolwidth, -90+angle (z0-z1)); |
| 922 |
penpos1'(symbolwidth, -90+angle (z0-z1)); |
| 923 |
penpos3(symbolwidth, 0); |
| 924 |
penpos3'(symbolwidth, 0); |
| 925 |
|
| 926 |
z1''l = whatever[z1l,z1'l]; |
| 927 |
z1''l = z0 + whatever*((z1-z0) rotated 90); |
| 928 |
penpos1''(finesymbolwidth, -90+angle (z0-z1)); |
| 929 |
|
| 930 |
z3''r = (x3r,y0); |
| 931 |
penpos3''(finesymbolwidth, 0); |
| 932 |
|
| 933 |
penpos2(symbolwidth, -90+angle (z2''-z2)); |
| 934 |
penpos2'(symbolwidth, -90+angle (z2''-z2)); |
| 935 |
penpos2''(finesymbolwidth, -90+angle (z2''-z2)); |
| 936 |
|
| 937 |
symbolpath1 := z1''l..z1'l---z1l..z1r---z1'r..z1''r; |
| 938 |
symbolpath2 := z2''l..z2'l---z2l..z2r---z2'r..z2''r; |
| 939 |
symbolpath3 := z3''l..z3'l---z3l..z3r---z3'r..z3''r; |
| 940 |
% Not penstroke because we want the endpoints to be rounded |
| 941 |
|
| 942 |
numeric t[]; |
| 943 |
(t12,t21) = symbolpath1 intersectiontimes symbolpath2; |
| 944 |
(t23,t32) = symbolpath2 intersectiontimes symbolpath3; |
| 945 |
fill (subpath(0,t12) of symbolpath1 |
| 946 |
-- subpath (t21,t23) of symbolpath2 |
| 947 |
-- subpath (t32,infinity) of symbolpath3 |
| 948 |
-- z3''r{z3''r-z3'r}..{z1-z0}cycle |
| 949 |
); |
| 950 |
%pickup pencircle scaled 0.01pt; |
| 951 |
%draw symbolpath2; draw symbolpath3; |
| 952 |
|
| 953 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 954 |
labels(1,2,3,1',2',3',1r,1l,2r,2l,3r,3l,1'r,1'l,2'r,2'l,3'r,3'l, 1''r,1''l); |
| 955 |
|
| 956 |
symbolpath0 := z1--z0--z3--z2; |
| 957 |
charbox; endchar; |
| 958 |
beginchar("L",decrwidth(3,1),ht#,dp#); "SSSK"; |
| 959 |
|
| 960 |
%draw subpath(0,2) of symbolpath0; |
| 961 |
%draw point 3 of symbolpath0--point 1 of symbolpath0; |
| 962 |
fliphoriz(symbolpic0)(currentpicture); |
| 963 |
%currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 964 |
charbox; endchar; |
| 965 |
|
| 966 |
beginchar("r",decrwidth(3,1),ht#,dp#); "LRC"; |
| 967 |
pickup symbol_pen; |
| 968 |
bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); |
| 969 |
top rt z2 = (0.5w+0.5 biggerheight+ho,h-small_topgap+o); |
| 970 |
bot rt z3 = (0.5w+0.5 biggerheight+ho,-d+small_bottomgap-o); |
| 971 |
top lft z4 = (0.5w-0.5 biggerheight-ho,h-small_topgap+o); |
| 972 |
x5 = 0.5w; y5 = 0.53[y1,y4]; |
| 973 |
x6=x5; y6=y1; |
| 974 |
draw z1..z5..z2; |
| 975 |
draw z3--z5; |
| 976 |
draw z5--z6; |
| 977 |
|
| 978 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 979 |
labels(1,2,3,4,5,6,7); |
| 980 |
charbox; endchar; |
| 981 |
beginchar("l",decrwidth(3,1),ht#,dp#); "RLC"; |
| 982 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 983 |
charbox; endchar; |
| 984 |
|
| 985 |
beginchar("a",decrwidth(3,1),ht#,dp#); "LRC"; |
| 986 |
pickup symbol_pen; |
| 987 |
bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); |
| 988 |
top rt z2 = (0.5w+0.5 biggerheight+ho,h-small_topgap+o); |
| 989 |
bot rt z3 = (0.5w+0.5 biggerheight+ho,-d+small_bottomgap-o); |
| 990 |
top lft z4 = (0.5w-0.5 biggerheight-ho,h-small_topgap+o); |
| 991 |
x5 = 0.5w; y5 = 0.6[y1,y4]; |
| 992 |
top z6 = (0.5w, h-small_topgap+o); |
| 993 |
bot z7 = (0.5w, -d+small_bottomgap-o); |
| 994 |
draw z1--z5; |
| 995 |
draw z3--z5; |
| 996 |
draw z6--z7; |
| 997 |
charbox; endchar; |
| 998 |
|
| 999 |
% Rownumber triangles (modified from manfnt.mf) |
| 1000 |
|
| 1001 |
trianglecharwd# = 19/3 pt#; |
| 1002 |
|
| 1003 |
beginchar("}", trianglecharwd#, 6.25pt#, 0); "Triangle pointing right"; |
| 1004 |
if (fonttype = foretype) or (fonttype = bothtype): |
| 1005 |
x1=x2=w-x3-max(purlextend, 0.5gridwidth)=4/3pt; y3=.5h; |
| 1006 |
y1-y3=y3-y2; |
| 1007 |
y1-y2 = 1.3*(x3-x1); |
| 1008 |
% For an equilateral triangle, use 2/sqrt 3 = 1.1547 |
| 1009 |
fill z1--z2--z3--cycle; |
| 1010 |
fi |
| 1011 |
symbolpic0 := currentpicture; |
| 1012 |
labels(1,2,3); endchar; |
| 1013 |
|
| 1014 |
beginchar("{", trianglecharwd#, 6.25pt#, 0); "Triangle pointing left"; |
| 1015 |
fliphoriz(symbolpic0)(currentpicture); |
| 1016 |
endchar; |
| 1017 |
|
| 1018 |
|
| 1019 |
% Wrapped stitches |
| 1020 |
|
| 1021 |
beginchar("?",wd#,ht#,dp#); "Left end of wrapped stitches"; |
| 1022 |
pickup symbol_pen; |
| 1023 |
x0r = x1r = x2r = w; |
| 1024 |
y0r-y1r = y1r-y2r; |
| 1025 |
y0m=y0r; y1m=y1r; y2m=y2r; |
| 1026 |
y0l-y0r = y1l-y1r = y2l-y2r; |
| 1027 |
|
| 1028 |
if gridfont: |
| 1029 |
h-small_topgap+o = top y0l; |
| 1030 |
bot y2r = small_bottomgap-d; |
| 1031 |
y1l = 2/3[y1r,y0r]; |
| 1032 |
x2l+ho = h-y0l+o; |
| 1033 |
x0m = 0.4[x0l,x0r]; |
| 1034 |
x2m = 0.5[x2l,x2r]; |
| 1035 |
z0l = z2l + whatever*(1,3); |
| 1036 |
wraplines := 3; |
| 1037 |
else: |
| 1038 |
h-small_topgap-top y0r = bot y2r-small_bottomgap+d; |
| 1039 |
if (topgap>standardgap) or (bottomgap>standardgap): |
| 1040 |
wraplines := 2; else: wraplines:=3; fi |
| 1041 |
if wraplines = 2: |
| 1042 |
y0r - y2r = 1.5(h-small_topgap-top y0r); |
| 1043 |
lft x2l+ho = smallgap; |
| 1044 |
else: |
| 1045 |
y0r - y1r = 1.5(h-small_topgap-top y0r); |
| 1046 |
lft x2l+ho = mingap; |
| 1047 |
fi |
| 1048 |
x0m = 0.2[x0l,x0r]; |
| 1049 |
x2m = 0.3[x2l,x2r]; |
| 1050 |
y0l = 0.6[y0r,h-small_topgap+o]; |
| 1051 |
z0l = z2l + whatever*(1,4); |
| 1052 |
fi |
| 1053 |
|
| 1054 |
z1l=whatever[z0l,z2l]; |
| 1055 |
z1m=whatever[z0m,z2m]; |
| 1056 |
pickup pensquare scaled symbolwidth; |
| 1057 |
draw lft z0r--rt (0,y0r); |
| 1058 |
if wraplines=3: draw lft z1r--rt (0,y1r); fi |
| 1059 |
draw lft z2r--rt (0,y2r); |
| 1060 |
symbolpic1 := currentpicture; symbolpicwd1 := w; |
| 1061 |
currentpicture := nullpicture; |
| 1062 |
draw lft z0r---rt z0m; |
| 1063 |
if wraplines=3: draw lft z1r---rt z1m; fi |
| 1064 |
draw lft z2r---rt z2m; |
| 1065 |
pickup symbol_pen; |
| 1066 |
draw z0m{left}..z0l; |
| 1067 |
if wraplines=3: draw z1m{left}..z1l; fi |
| 1068 |
draw z2m{left}..z2l; |
| 1069 |
|
| 1070 |
if gridfont: else: |
| 1071 |
draw bot (w/2,h-small_topgap+o) -- top (w/2, -d+small_bottomgap-o); |
| 1072 |
fi |
| 1073 |
|
| 1074 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 1075 |
labels(0r,0m,0l,1r,1m,1l,2r,2m,2l); |
| 1076 |
charbox; endchar; |
| 1077 |
|
| 1078 |
beginchar(23,wd#,ht#,dp#); "Middle of wrapped stitches"; |
| 1079 |
pickup symbol_pen; |
| 1080 |
currentpicture := symbolpic1; currentpicture := currentpicture shifted ((w-symbolpicwd1)/2,0); |
| 1081 |
if gridfont: else: |
| 1082 |
draw bot (w/2,h-small_topgap+o) -- top (w/2, -d+small_bottomgap-o); |
| 1083 |
fi |
| 1084 |
charbox; endchar; |
| 1085 |
beginchar(24,wd#,ht#,dp#); "Right end of wrapped stitches"; |
| 1086 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 1087 |
charbox; endchar; |
| 1088 |
|
| 1089 |
ligtable "?": |
| 1090 |
"?" |=: 24; |
| 1091 |
ligtable 24: |
| 1092 |
"?" |=: 24, |
| 1093 |
24 =:| 23; |
| 1094 |
|
| 1095 |
beginchar("1",wd#,ht#,dp#); "Left end of single-wrapped stitches"; |
| 1096 |
pickup symbol_pen; |
| 1097 |
x1r=w; |
| 1098 |
y1m=y1r; |
| 1099 |
|
| 1100 |
if gridfont: |
| 1101 |
if wd>ht+dp: |
| 1102 |
y1l-y1r = (h+d)/3; |
| 1103 |
else: |
| 1104 |
y1l-y1r = (h+d)/4; |
| 1105 |
fi |
| 1106 |
else: |
| 1107 |
y1l-y1r = (h+d)/5; |
| 1108 |
fi |
| 1109 |
x1m = 0.1[x1r,x1l]; |
| 1110 |
h-topgap+o-y1l = 1/2(y1r+d-bottomgap); |
| 1111 |
rt x1l+ho = standardgap; |
| 1112 |
wraplines := 1; |
| 1113 |
if y1r<bottomgap-d: message("Your single-wrapped stitch symbol is too tall."); fi |
| 1114 |
|
| 1115 |
pickup pensquare scaled symbolwidth; |
| 1116 |
draw lft z1r--rt (0,y1r); |
| 1117 |
symbolpic1 := currentpicture; symbolpicwd1 := w; |
| 1118 |
currentpicture := nullpicture; |
| 1119 |
draw lft z1r---rt z1m; |
| 1120 |
pickup symbol_pen; |
| 1121 |
draw z1m{left}..z1l; |
| 1122 |
|
| 1123 |
if gridfont: else: |
| 1124 |
draw bot (w/2,h-topgap+o) -- top (w/2, -d+bottomgap-o); |
| 1125 |
fi |
| 1126 |
|
| 1127 |
symbolpic0 := currentpicture; symbolpicwd0 := w; |
| 1128 |
labels(1r,1m,1l); |
| 1129 |
charbox; endchar; |
| 1130 |
|
| 1131 |
beginchar(17,wd#,ht#,dp#); "Middle of wrapped stitches"; |
| 1132 |
pickup symbol_pen; |
| 1133 |
currentpicture := symbolpic1; currentpicture := currentpicture shifted ((w-symbolpicwd1)/2,0); |
| 1134 |
if gridfont: else: |
| 1135 |
draw bot (w/2,h-small_topgap+o) -- top (w/2, -d+small_bottomgap-o); |
| 1136 |
fi |
| 1137 |
charbox; endchar; |
| 1138 |
beginchar(18,decrwidth(1,0),ht#,dp#); "Right end of wrapped stitches"; |
| 1139 |
fliphoriz(symbolpic0)(currentpicture); currentpicture := currentpicture shifted (-(w-symbolpicwd0)/2,0); |
| 1140 |
charbox; endchar; |
| 1141 |
|
| 1142 |
ligtable "1": |
| 1143 |
"1" |=: 18; |
| 1144 |
ligtable 18: |
| 1145 |
"1" |=: 18, |
| 1146 |
18 =:| 17; |
| 1147 |
|
| 1148 |
% Outlines |
| 1149 |
|
| 1150 |
if gridfont: |
| 1151 |
|
| 1152 |
beginchar(5,wd#,ht#,dp#); "Top and bottom outlines"; |
| 1153 |
topbotgrid_charbox; endchar; |
| 1154 |
|
| 1155 |
beginchar(6,0,ht#,dp#); "Vertical grid line"; |
| 1156 |
pickup pensquare scaled gridwidth; |
| 1157 |
if (fonttype = gridtype) or (fonttype = bothtype): |
| 1158 |
draw (0,-d)--(0,h); |
| 1159 |
fi |
| 1160 |
endchar; |
| 1161 |
|
| 1162 |
fi |
| 1163 |
|