diff options
Diffstat (limited to 'Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf')
-rw-r--r-- | Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf | 117 |
1 files changed, 63 insertions, 54 deletions
diff --git a/Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf b/Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf index e127626bd5e..f101cd98664 100644 --- a/Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf +++ b/Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf @@ -1,4 +1,4 @@ -% Date: 2010/08/10 +% Date: 2019/04/05 picture symbolpic[]; @@ -18,22 +18,21 @@ endchar; code := 127; +beginchar("-",wd#,ht#,dp#); "A knit stitch"; + charbox; endchar; +beginchar("=",wd#,ht#,dp#); "A purl stitch"; + purlbox; endchar; beginchar(".",incrwidth(0,0),ht#,dp#); "No stitch"; fill (0.5(w-standardheight),-d+bottomgap) -- - (0.5(w-standardheight),h-topgap) -- - (0.5(w+standardheight),h-topgap) -- - (0.5(w+standardheight),-d+bottomgap) -- cycle; + (0.5(w-standardheight),h-topgap) -- + (0.5(w+standardheight),h-topgap) -- + (0.5(w+standardheight),-d+bottomgap) -- cycle; symbolpic0 := currentpicture; charbox; endchar; beginchar(",",incrwidth(0,0),ht#,dp#); "Purl no stitch"; currentpicture := symbolpic0; purlbox; endchar; - -beginchar("-",wd#,ht#,dp#); "A knit stitch"; - charbox; endchar; -beginchar("=",wd#,ht#,dp#); "A purl stitch"; - purlbox; endchar; - + % Cables cablelinewidth#:=0.4pt#; @@ -43,32 +42,46 @@ pickup pencircle scaled cablelinewidth; cable_pen := savepen; % The one-letter cells beginchar("p",wd#,ht#,dp#); "Purl cable background"; + currentpicture := errorsymbol1; purlbox; endchar; beginchar("P",wd#,ht#,dp#); "Purl cable foreground"; + currentpicture := errorsymbol1; purlbox; endchar; beginchar("k",wd#,ht#,dp#); "Knit cable background"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("K",wd#,ht#,dp#); "Knit cable foreground"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("g",wd#,ht#,dp#); "Purl cable background"; + currentpicture := errorsymbol1; purlbox; endchar; beginchar("G",wd#,ht#,dp#); "Purl cable foreground"; + currentpicture := errorsymbol1; purlbox; endchar; beginchar("c",wd#,ht#,dp#); "Knit cable background"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("C",wd#,ht#,dp#); "Knit cable foreground"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("d",wd#,ht#,dp#); "White knit cable background"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("D",wd#,ht#,dp#); "White knit cable foreground"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("n",wd#,ht#,dp#); "Odd knit cable background"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("N",wd#,ht#,dp#); "Odd knit cable foreground"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("e",wd#,ht#,dp#); "Odd twist"; + currentpicture := errorsymbol1; charbox; endchar; beginchar("o",wd#,ht#,dp#); "Odd twist"; + currentpicture := errorsymbol1; charbox; endchar; % Horizontal cables @@ -96,7 +109,7 @@ specialhoriz := ASCII"/"; beginchar(midhoriz,wd#,ht#,dp#); "Middle of a horizontal cable"; charbox; pickup pensquare scaled cablelinewidth; - x1=x4=0; x2=x3=w; bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; + x1=x4=gridwidth/2; x2=x3=w-gridwidth/2; bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; if (fonttype = gridtype) or (fonttype = bothtype): draw rt z1--lft z2; draw lft z3--rt z4; fi @@ -104,15 +117,17 @@ beginchar(midhoriz,wd#,ht#,dp#); "Middle of a horizontal cable"; fill z1--z2--(w,-d)--(0,-d)--cycle; fill z4--z3--(w,h)--(0,h)--cycle; fi + labels(1,2,3,4); endchar; beginchar(specialhoriz,wd#,ht#,dp#); "Special horizontal cable"; charbox; pickup pensquare scaled cablelinewidth; - x1=x4=0; x2=x3=w; bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; + x1=x4=gridwidth/2; x2=x3=w-gridwidth/2; + bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; x5=x6; x7=x8; x7-x5 = y3-y2; 0.5[x7,x5]=0.5w; - y5=y7=-d; y6=y8=h; + y5=y7=-d+gridwidth/2; y6=y8=h-gridwidth/2; if (fonttype = gridtype) or (fonttype = bothtype): draw top z5--bot z6; draw top z7--bot z8; @@ -128,10 +143,11 @@ beginchar(specialhoriz,wd#,ht#,dp#); "Special horizontal cable"; fill (x3,y8)--z3--(x8,y3)--z8--cycle; fill (x4,y6)--z4--(x6,y4)--z6--cycle; fi + labels(1,2,3,4,5,6,7,8); endchar; -beginchar(righthoriz,wd#,ht#,dp#); "Right end of a horizontal cable"; +beginchar(righthoriz,if fonttype = counttype: 0 else: wd# fi,ht#,dp#); "Right end of a horizontal cable"; fliphoriz(symbolpic0)(currentpicture); endchar; @@ -154,24 +170,28 @@ numeric botcableleft[][]; numeric botcableright[][]; for sts = 2 upto 3: cableright[0][sts][0] := incr code; beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" cable background stitches"; + addto currentpicture also errorsymbol[sts]; charbox; endchar; cableleft[sts][0][0] := incr code; beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" cable foreground stitches"; - charbox; endchar; + addto currentpicture also errorsymbol[sts]; + charbox; endchar; revcableright[0][sts] := incr code; beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" twist background stitches"; - purlbox; endchar; + addto currentpicture also errorsymbol[sts]; + purlbox; endchar; revcableleft[sts][0] := incr code; beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" twist foreground stitches"; - purlbox; endchar; + addto currentpicture also errorsymbol[sts]; + purlbox; endchar; endfor % Draw the cables -if known slantlines: else: boolean slantlines; slantlines = false; fi +if known slantcutoff: else: slantcutoff = 0; fi for backsts = 1 upto 3: for frontsts = 1 upto 3: @@ -213,32 +233,19 @@ beginchar(cableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); if (fonttype = gridtype) or (fonttype = bothtype): % Define top and bottom points - if slantlines: for k=0 upto totsts: - z.bot[k] = (k*wd,-d); - z.top[k] = (k*wd,h); - penpos.bot[k] (frontstroke, 0); - penpos.top[k] (frontstroke, 0); + z.bot[k] = (k*wd,-d); + z.top[k] = (k*wd,h); + penpos.bot[k] (frontstroke, 0); + penpos.top[k] (frontstroke, 0); + endfor + + for k=0 upto totsts: + labels(bot[k],top[k],bot[k]l,bot[k]r,top[k]l,top[k]r); endfor - else: - z.top[0] = (0,h); - z.top[frontsts] = (frontsts*wd,h); - z.top[totsts] = (totsts*wd,h); - z.bot[0] = (0,-d); - z.bot[backsts] = (backsts*wd,-d); - z.bot[totsts] = (totsts*wd,-d); - if midsts > 0: - z.bot[backsts+midsts] = ((backsts+midsts)*wd,-d); - z.top[frontsts+midsts] = ((frontsts+midsts)*wd,h); - fi - penpos.bot[backsts+midsts] (frontstroke, 0); - penpos.top[0] (frontstroke, 0); - penpos.bot[totsts] (frontstroke, 0); - penpos.top[frontsts] (frontstroke, 0); - fi % Draw the lines on the front cable - if slantlines: + if slantcutoff > (backsts+midsts-1): for k=1 upto frontsts-1: penstroke z.top[k]e -- z.bot[k+backsts+midsts]e; endfor @@ -266,23 +273,12 @@ beginchar(cableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); slip = whatever * (-backsts,1); % Define some more points - if slantlines: for k=0 upto backsts: z.ur[k] = whatever [z.top0,z.bot[backsts+midsts]]; z.ur[k] = whatever [z.bot[k],z.top[frontsts+midsts+k]]; z.ll[k] = whatever [z.bot[totsts],z.top[frontsts]]; z.ll[k] = whatever [z.bot[k],z.top[frontsts+midsts+k]]; endfor - else: - z.ur[0] = whatever [z.top0,z.bot[backsts+midsts]]; - z.ur[0] = whatever [z.bot0,z.top[frontsts+midsts]]; - z.ll[backsts] = whatever [z.bot[totsts],z.top[frontsts]]; - z.ll[backsts] = whatever [z.bot[backsts],z.top[totsts]]; - z.ur[backsts] = whatever [z.top0,z.bot[backsts+midsts]]; - z.ur[backsts] = whatever [z.bot[backsts],z.top[totsts]]; - z.ll[0] = whatever [z.bot[totsts],z.top[frontsts]]; - z.ll[0] = whatever [z.bot[0],z.top[frontsts+midsts]]; - fi % Top back lines fill z.top[totsts]+(-backstroke,0) -- z.top[totsts] -- z.top[totsts]+(0,-ypart(slip)) -- z.ll[backsts]-slip -- z.ll[backsts]+slip --cycle; @@ -291,7 +287,7 @@ beginchar(cableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); fill z.top[frontsts+midsts]+(-backstroke,0) -- z.top[frontsts+midsts]+(backstroke,0) -- z.ll[0]-slip -- z.ll[0]+slip --cycle; fi - if slantlines: + if slantcutoff > (frontsts+midsts-1): for k=1 upto backsts-1: fill z.top[frontsts+midsts+k]+(-backstroke,0) -- z.top[frontsts+midsts+k]+(backstroke,0) -- z.ll[k]-slip -- z.ll[k]+slip --cycle; endfor @@ -306,7 +302,7 @@ beginchar(cableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); fill z.bot[backsts]+(backstroke,0) -- z.bot[backsts]-(backstroke,0) -- z.ur[backsts]+slip -- z.ur[backsts]-slip --cycle; fi - if slantlines: + if slantcutoff > (frontsts+midsts-1): for k=1 upto backsts-1: fill z.bot[k]+(backstroke,0) -- z.bot[k]-(backstroke,0) -- z.ur[k]+slip -- z.ur[k]-slip --cycle; endfor @@ -355,7 +351,20 @@ beginchar(twistleft[frontsts][backsts],totsts * wd#,ht#,dp#); % Twist/twist front "Twist " & decimal(frontsts) & " over " &decimal(backsts); charbox; - if fonttype <> purltype: currentpicture := symbolpic1; + if fonttype <> purltype: + currentpicture := symbolpic1; + % Draw some missing lines + for k=1 upto backsts-1: + z.bot[k] = (k*wd,-d); + x.slant.bot[k] = k*wd; + z.slant.bot[k] = whatever[(0,h),(backsts*wd,-d)]; + draw z.bot[k]--z.slant.bot[k]; + + z.top[k] = ((frontsts+k)*wd,h); + x.slant.top[k] = (frontsts+k)*wd; + z.slant.top[k] = whatever[(frontsts*wd,h),(w,-d)]; %whatever[(w,-d),(w-backsts*wd,h)]; + draw z.top[k]--z.slant.top[k]; + endfor else: fill (0,h)--(wd*backsts,-d)--(0,-d)--cycle; % Bottom triangle fill (w,-d)--(wd*frontsts,h)--(w,h)--cycle; % Top triangle |