diff options
author | Karl Berry <karl@freefriends.org> | 2010-01-17 23:55:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-01-17 23:55:48 +0000 |
commit | acd348131221ef4a967e6584a1bf898c4402471b (patch) | |
tree | 4dccf1d055551b368078a515fa00f777b6e990ed /Master/texmf-dist/fonts/source | |
parent | 1f5d5aecc9a0afaf88d196f4957d29cad92603b3 (diff) |
new package knitting 1.0 (17jan10)
git-svn-id: svn://tug.org/texlive/trunk@16764 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/fonts/source')
14 files changed, 2209 insertions, 0 deletions
diff --git a/Master/texmf-dist/fonts/source/public/knitting/knit_dimens.mf b/Master/texmf-dist/fonts/source/public/knitting/knit_dimens.mf new file mode 100644 index 00000000000..0e69a6bdbb7 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knit_dimens.mf @@ -0,0 +1,100 @@ +widewd# = 16.3pt#; +% This is as wide as a cell can be without causing problems with 5-cell-wide symbols +if known wd#: else: wd# = 12 pt#; fi + ht# + dp# = 12 pt#; ht#-dp# = 6.44444pt#; + + symbolwidth#=0.7pt#; + purl_symbolwidth#=0.7pt#; + gridwidth# = if gridfont: 0.3pt# else: 0pt# fi; + overlinewd# = if gridfont: 1.5pt# else: 0.8pt# fi; + +eraserwidth# = 3pt#; +wrapturngap# = 2pt#; + + o#:=0.4pt#; %Vertical overshoot + ho#:=o#; %Horizontal overshoot + +% Vertical gaps +standardgap# = if gridfont: 3pt# else: 2.5pt# fi; +smallgap# = if gridfont: 2.5pt# else: 2pt# fi; +mingap# = if gridfont: 1.2pt# else: 1pt# fi; + +botcableheight# - symbolwidth#/2 = (-dp# + smallgap#); +topcableheight# + symbolwidth#/2 = (ht# - smallgap#); + +cablevertgap# = 3symbolwidth#; +cablebargap# = 4pt#; +cableslant# = 4pt#; + +if known topgap#: else: topgap# = standardgap#; fi +if known bottomgap#: else: bottomgap# = standardgap#; fi + +cableextend# := 0pt#; +% If your software is prone to leaving little gaps between the nogrid +% cable connectors, or in wide increases and decreases, you might want +% to make this nonzero. + +if gridfont: +purlextend# := 0pt#; +else: +purlextend# := 0.2pt#; +fi +% +% Purlextend affects how far outside their box the purl background goes. +% +% This is largely irrelevant when printing, +% but it makes the PDFs look much better. +% +% If you do a Knuth-esque bitmap-font customization to your +% particular printer, this is one parameter you *have* to fiddle with. + +define_pixels(wd,ht,dp); +define_blacker_pixels(cableextend,purlextend,gridwidth,symbolwidth,purl_symbolwidth, + overlinewidth); +define_pixels(eraserwidth,wrapturngap); +define_corrected_pixels(o,ho); +define_pixels(standardgap,smallgap,mingap,topgap,bottomgap, + cablevertgap,cablebargap,cableslant, botcableheight,topcableheight); + +pickup pencircle scaled symbolwidth; symbol_pen := savepen; +pickup pencircle scaled purl_symbolwidth; purl_symbol_pen := savepen; +pickup pencircle scaled eraserwidth; eraser_pen := savepen; + +offset = (topgap-bottomgap)/2; +small_topgap = topgap + smallgap-standardgap; +small_bottomgap = bottomgap + smallgap-standardgap; +min_topgap = topgap + mingap-standardgap; +min_bottomgap = bottomgap + mingap-standardgap; + +standardheight := ht+dp-topgap-bottomgap; +biggerheight := ht+dp-small_topgap-small_bottomgap; + +font_size 10pt#; + +font_slant := 0pt#; % fontdimen 1 +font_normal_space := 0pt#; % fontdimen 2 +font_normal_stretch := 0pt#; % fontdimen 3 +font_normal_shrink := 0pt#; % fontdimen 4 +font_x_height := ht#; % fontdimen 5 +font_quad := wd#; % fontdimen 6 +font_extra_space := 0pt#; % fontdimen 7 + +fontdimen 8: % Font dimensions 8+ listed here +dp#, % dimen 8: depth +% width is not needed because it is quad (dimen 6) +% height is not needed because it is xheight (dimen 5) +ht#+dp#, % dimen 9: height+depth (LaTeX height) +gridwidth#, % dimen 10: grid width +overlinewd#, % dimen 11: overline/bar width +(ht#+dp#)/8, % dimen 12: raise/lower symbols in narrow increases +(topgap#-bottomgap#), % dimen 13: vertical offset +purlextend#; % dimen 14: purl box outlap + +def incrwidth (expr sts) = wd# enddef; +def decrwidth (expr sts) = wd# enddef; +Vwidth := standardheight; % Used twice: v and y +Wwidth := biggerheight; % Used for make 3 from 1 +wideincline := 2symbolwidth; +wideinctip := 0.3symbolwidth; + +symbolmaxwd# = 82.244pt# - max(2purlextend#,gridwidth#); 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 new file mode 100644 index 00000000000..8e95657cb02 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knit_grid_cables.mf @@ -0,0 +1,572 @@ +picture symbolpic[]; + +beginchar(5,wd#,ht#,dp#); "Top and bottom outlines"; + pickup pensquare scaled gridwidth; + if (fonttype = gridtype) or (fonttype = bothtype): + draw (0,-d)--(w,-d); draw (0,h)--(w,h); + fi +endchar; + +beginchar(6,0,ht#,dp#); "Vertical grid line"; + pickup pensquare scaled gridwidth; + if (fonttype = gridtype) or (fonttype = bothtype): + draw (0,-d)--(0,h); + fi +endchar; + +code := 127; + +beginchar(".",wd#,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; + symbolpic0 := currentpicture; + charbox; endchar; +beginchar(",",wd#,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#; +define_blacker_pixels(cablelinewidth); +pickup pencircle scaled cablelinewidth; cable_pen := savepen; + +beginchar("p",wd#,ht#,dp#); "Purl cable background"; + purlbox; endchar; +beginchar("P",wd#,ht#,dp#); "Purl cable foreground"; + purlbox; endchar; +beginchar("k",wd#,ht#,dp#); "Knit cable background"; + charbox; endchar; +beginchar("K",wd#,ht#,dp#); "Knit cable foreground"; + charbox; endchar; +beginchar("g",wd#,ht#,dp#); "Purl cable background"; + purlbox; endchar; +beginchar("G",wd#,ht#,dp#); "Purl cable foreground"; + purlbox; endchar; +beginchar("c",wd#,ht#,dp#); "Knit cable background"; + charbox; endchar; +beginchar("C",wd#,ht#,dp#); "Knit cable foreground"; + charbox; endchar; +beginchar("d",wd#,ht#,dp#); "White knit cable background"; + charbox; endchar; +beginchar("D",wd#,ht#,dp#); "White knit cable foreground"; + charbox; endchar; +beginchar("n",wd#,ht#,dp#); "Odd knit cable background"; + charbox; endchar; +beginchar("N",wd#,ht#,dp#); "Odd knit cable foreground"; + charbox; endchar; +beginchar("e",wd#,ht#,dp#); "Odd twist"; + charbox; endchar; +beginchar("o",wd#,ht#,dp#); "Odd twist"; + charbox; endchar; + +horizcablegap# := 0.3 wd#; +define_pixels(horizcablegap); + +beginchar("+",wd#,ht#,dp#); "Left end of a horizontal cable"; + charbox; + pickup pensquare scaled cablelinewidth; + x1=x4=horizcablegap; x2=x3=w; bot y1=bot y2= -d+bottomgap; top y3=top y4=h-topgap; + if (fonttype = gridtype) or (fonttype = bothtype): + draw lft z3--rt z4; draw rt z1--lft z2; draw rt z4--rt z1; + fi + if fonttype = purltype: + fill (0,-d)--(w,-d)--z2--z1--z4--z3--(w,h)--(0,h)--cycle; + fi + symbolpic0 := currentpicture; +endchar; + +midhoriz := 20; +righthoriz := 21; +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; + if (fonttype = gridtype) or (fonttype = bothtype): + draw rt z1--lft z2; draw lft z3--rt z4; + fi + if fonttype = purltype: + fill z1--z2--(w,-d)--(0,-d)--cycle; + fill z4--z3--(w,h)--(0,h)--cycle; + fi + 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; + + x5=x6; x7=x8; x7-x5 = y3-y2; 0.5[x7,x5]=0.5w; + y5=y7=-d; y6=y8=h; + + if (fonttype = gridtype) or (fonttype = bothtype): + draw top z5--bot z6; draw top z7--bot z8; + draw rt z1--lft (x5,y2); + draw rt (x7,y2)--lft z2; + draw lft z3--rt(x7,y3); + draw lft(x5,y4)--rt z4; + fi + + if fonttype = purltype: + fill (x1,y5)--z1--(x5,y1)--z5--cycle; + fill (x2,y7)--z2--(x7,y2)--z7--cycle; + fill (x3,y8)--z3--(x8,y3)--z8--cycle; + fill (x4,y6)--z4--(x6,y4)--z6--cycle; + fi + endchar; + + +beginchar(righthoriz,wd#,ht#,dp#); "Right end of a horizontal cable"; + fliphoriz(symbolpic0)(currentpicture); + endchar; + +ligtable "+": specialhoriz: + "+" |=: righthoriz; +ligtable righthoriz: + "+" |=: righthoriz, + specialhoriz =:| midhoriz, + righthoriz =:| midhoriz; + +numeric cableleft[][][]; numeric cableright[][][]; +numeric whitecableleft[][][]; numeric whitecableright[][][]; +numeric twistleft[][]; numeric twistright[][]; +numeric revcableleft[][]; numeric revcableright[][]; +numeric topcableleft[][]; numeric topcableright[][]; +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"; + charbox; endchar; + + cableleft[sts][0][0] := incr code; + beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" cable foreground stitches"; + charbox; endchar; + + revcableright[0][sts] := incr code; + beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" twist background stitches"; + purlbox; endchar; + + revcableleft[sts][0] := incr code; + beginchar(code, (sts)*wd#,ht#,dp#); decimal sts&" twist foreground stitches"; + purlbox; endchar; +endfor + +% Draw all the cables + +if known slantlines: else: boolean slantlines; slantlines = false; fi + +for backsts = 1 upto 3: +for frontsts = 1 upto 3: +for midsts = 0 upto if frontsts = backsts: if frontsts < 3: frontsts else: 0 fi else: 0 fi: + + +cableleft[frontsts][backsts][midsts] = incr code; +cableright[frontsts][backsts][midsts] = incr code; +whitecableleft[frontsts][backsts][midsts] = incr code; +whitecableright[frontsts][backsts][midsts] = incr code; + +if midsts = 0: +topcableleft[frontsts][backsts] = incr code; +topcableright[frontsts][backsts] = incr code; +botcableleft[frontsts][backsts] = incr code; +botcableright[frontsts][backsts] = incr code; +twistleft[frontsts][backsts] = incr code; +twistright[frontsts][backsts] = incr code; +revcableleft[frontsts][backsts] = incr code; +revcableright[frontsts][backsts] = incr code; +fi + +symbolpic0 := nullpicture; +symbolpic1 := nullpicture; +symbolpic2 := nullpicture; + +totsts := frontsts + backsts + midsts; + +if (frontsts+backsts+midsts)*wd# < symbolmaxwd#: + +beginchar(cableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); + % Cable/cable front + "Cable " & decimal(frontsts) & " over " &decimal(backsts) & " over " &decimal(midsts); + + frontstroke := cablelinewidth * ((backsts+midsts)++1); + backstroke := cablelinewidth * ((frontsts+midsts)++1)/2; + + charbox; % Have to do it here so the grid type fonts have stuff + 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); + 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: + for k=1 upto frontsts-1: + penstroke z.top[k]e -- z.bot[k+backsts+midsts]e; + endfor + fi + + % Draw the left and right lines of the front cable + pair temp; + temp = (0,whatever); + temp = whatever[z.top0l,z.bot[backsts+midsts]l]; + + fill z.top0r--z.bot[backsts+midsts]r -- z.bot[backsts+midsts]l--temp--z.top0--cycle; + + pair temp; + temp = (w,whatever); + temp = whatever[z.bot[totsts]r,z.top[frontsts]r]; + + fill z.top[frontsts]r--z.top[frontsts]l--z.bot[totsts]l --z.bot[totsts]--temp--cycle; + + symbolpic1 := currentpicture; + % Save this pic for twist front + + % Draw the back lines + pair slip; + slip = whatever[(-backstroke,0),(frontsts+midsts,1)+(-backstroke,0)]; + 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; + + if midsts > 0: + 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: + 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 + fi + + symbolpic2 := currentpicture; + + % Bottom back lines + fill z.bot[0]+(backstroke,0) -- z.bot[0] -- z.bot[0]+(0,ypart(slip)) -- z.ur[0]+slip -- z.ur[0]-slip --cycle; + + if midsts > 0: + fill z.bot[backsts]+(backstroke,0) -- z.bot[backsts]-(backstroke,0) -- z.ur[backsts]+slip -- z.ur[backsts]-slip --cycle; + fi + + if slantlines: + 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 + fi + + fi + + if fonttype = purltype: + z.L = whatever[(0,-d),((frontsts+midsts)*wd,h)]; + z.L = whatever[(0,h),((backsts+midsts)*wd,-d)]; + z.R = whatever[(w,-d),(w-(backsts+midsts)*wd,h)]; + z.R = whatever[(w,h),(w-(frontsts+midsts)*wd,-d)]; + + if midsts = 0: else: + z.top1 = (frontsts*wd,h); z.top2 = ((frontsts+midsts)*wd,h); + z.bot1 = (frontsts*wd,-d); z.bot2 = ((frontsts+midsts)*wd,-d); + z.top3 = whatever[z.top1,(w,-d)]; + z.top3 = whatever[z.top2,(0,-d)]; + z.bot3 = whatever[z.bot1,(w,h)]; + z.bot3 = whatever[z.bot2,(0,h)]; + fill z.top1 -- z.top2 -- z.top3 -- cycle; + fill z.bot1 -- z.bot2 -- z.bot3 -- cycle; + fi + + fill (0,-d) -- z.L -- (0,h) --cycle; + fill (w,-d) -- z.R -- (w,h) --cycle; + fi + symbolpic0 := currentpicture; + endchar; +beginchar(cableright[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); + "Cable right " & decimal(frontsts) & " over " &decimal(backsts); + currentpicture := symbolpic0 reflectedabout ((w/2,0),(w/2,h)); + endchar; +beginchar(whitecableleft[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); + "White cable " & decimal(frontsts) & " over " &decimal(backsts); + if fonttype <> purltype: currentpicture := symbolpic0; fi + endchar; +beginchar(whitecableright[frontsts][backsts][midsts],totsts * wd#,ht#,dp#); + "White cable " & decimal(frontsts) & " over " &decimal(backsts); + if fonttype <> purltype: currentpicture := symbolpic0 reflectedabout ((w/2,0),(w/2,h)); fi + endchar; + +if midsts = 0: + +beginchar(twistleft[frontsts][backsts],totsts * wd#,ht#,dp#); + % Twist/twist front + "Twist " & decimal(frontsts) & " over " &decimal(backsts); + charbox; + if fonttype <> purltype: currentpicture := symbolpic1; + else: + fill (0,h)--(wd*backsts,-d)--(0,-d)--cycle; % Bottom triangle + fill (w,-d)--(wd*frontsts,h)--(w,h)--cycle; % Top triangle + fi + symbolpic1 := currentpicture; + endchar; +beginchar(twistright[frontsts][backsts],totsts * wd#,ht#,dp#); + "Twist " & decimal(frontsts) & " over " &decimal(backsts); + currentpicture := symbolpic1 reflectedabout ((w/2,0),(w/2,h)); + endchar; + +beginchar(topcableleft[frontsts][backsts],totsts * wd#,ht#,dp#); + % Twist/twist front + "Cable " & decimal(frontsts) & " over " &decimal(backsts); + z.R = whatever[(w,-d),(w-(backsts+midsts)*wd,h)]; + z.R = whatever[(w,h),(w-(frontsts+midsts)*wd,-d)]; + charbox; + if fonttype <> purltype: currentpicture := symbolpic2; + else: + fill (0,h)--(wd*backsts,-d)--(0,-d)--cycle; % Bottom left triangle + fill (w,-d) -- z.R -- (w,h) --cycle; % Right triangle + fi + symbolpic2 := currentpicture; + endchar; +beginchar(topcableright[frontsts][backsts],totsts * wd#,ht#,dp#); + "Cable " & decimal(frontsts) & " over " &decimal(backsts); + currentpicture := symbolpic2 reflectedabout ((w/2,0),(w/2,h)); + endchar; +beginchar(botcableleft[frontsts][backsts],totsts * wd#,ht#,dp#); + "Cable " & decimal(frontsts) & " over " &decimal(backsts); + currentpicture := symbolpic2 rotatedaround ((w/2,(h-d)/2),180); + endchar; +beginchar(botcableright[frontsts][backsts],totsts * wd#,ht#,dp#); + "Cable " & decimal(frontsts) & " over " &decimal(backsts); + currentpicture := symbolpic2 reflectedabout ((0,(h-d)/2),(w,(h-d)/2)); + endchar; + +beginchar(revcableleft[frontsts][backsts],totsts * wd#,ht#,dp#); + % Reverse cable/twist back + "Reverse cable left " & decimal(frontsts) & " over " &decimal(backsts); + if fonttype <> purltype: + currentpicture := symbolpic0; + else: purlbox; fi + endchar; +beginchar(revcableright[frontsts][backsts],totsts * wd#,ht#,dp#); + "Reverse cable " & decimal(frontsts) & " over " &decimal(backsts); + if fonttype <> purltype: + currentpicture := symbolpic0 reflectedabout ((w/2,0),(w/2,h)); + else: purlbox; fi + endchar; +fi + +else: + +beginchar(cableleft[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; +beginchar(cableright[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; +beginchar(whitecableleft[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; +beginchar(whitecableright[frontsts][backsts][midsts],0pt#,ht#,dp#); endchar; + +if midsts = 0: +beginchar(twistleft[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(twistright[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(topcableleft[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(topcableright[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(botcableleft[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(botcableright[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(revcableleft[frontsts][backsts],0pt#,ht#,dp#); endchar; +beginchar(revcableright[frontsts][backsts],0pt#,ht#,dp#); endchar; + +fi + +fi + +endfor endfor endfor +%Ligatures + +cableright[0][1][0] := ASCII"k"; +cableleft[1][0][0] := ASCII"K"; +revcableright[0][1] := ASCII"p"; +revcableleft[1][0] := ASCII"P"; + + ligtable "c": + "k" =: cableright[0][1+1][0], + "c" =: cableright[0][1+1][0], + "p" =: cableright[1][1][1], + "K" =: cableright[1][1][0], + "D" =: whitecableright[1][1][0], + "N" =: topcableright[1][1]; +ligtable "C": + "K" =: cableleft[1+1][0][0], + "C" =: cableleft[1+1][0][0], + "p" =: twistleft[1][1], + "k" =: cableleft[1][1][0], + "d" =: whitecableleft[1][1][0], + "n" =: topcableleft[1][1], + "e" =: botcableleft[1][1], + "o" =: botcableleft[1][1]; + ligtable "g": + "p" =: revcableright[0][1+1], + "g" =: revcableright[0][1+1], + "K" =: twistright[1][1], + "P" =: revcableright[1][1], + "N" =: botcableright[1][1]; + ligtable "G": + "P" =: revcableleft[1+1][0], + "G" =: revcableleft[1+1][0], + "p" =: revcableleft[1][1]; + +for sts = 1 upto 3: + ligtable cableright[0][sts][0]: + if sts < 3: + "k" =: cableright[0][sts+1][0], + "c" =: cableright[0][sts+1][0], + "p" =: cableright[sts][sts][1], + fi + "K" =: cableright[1][sts][0], + "D" =: whitecableright[1][sts][0], + "N" =: topcableright[1][sts]; + ligtable cableleft[sts][0][0]: + if sts < 3: + "K" =: cableleft[sts+1][0][0], + "C" =: cableleft[sts+1][0][0], + fi + "p" =: twistleft[sts][1], + "k" =: cableleft[sts][1][0], + "d" =: whitecableleft[sts][1][0], + "n" =: topcableleft[sts][1], + "e" =: botcableleft[sts][1], + "o" =: botcableleft[sts][1]; + ligtable revcableright[0][sts]: + if sts < 3: + "p" =: revcableright[0][sts+1], + "g" =: revcableright[0][sts+1], + fi + "K" =: twistright[1][sts], + "P" =: revcableright[1][sts], + "N" =: botcableright[1][sts]; + ligtable revcableleft[sts][0]: + if sts < 3: + "P" =: revcableleft[sts+1][0], + "G" =: revcableleft[sts+1][0], + fi + "p" =: revcableleft[sts][1]; + +endfor + +for sts = 1 upto 2: + ligtable cableleft[sts][sts][1]: + if sts > 1: "p" =: cableleft[sts][sts][2], fi + "k" =: cableleft[sts][sts][1], + "d" =: whitecableleft[sts][sts][1]; + ligtable cableright[sts][sts][1]: + if sts > 1: "p" =: cableright[sts][sts][2], fi + "K" =: cableright[sts][sts][1], + "D" =: whitecableright[sts][sts][1]; + ligtable whitecableleft[sts][sts][1]: + "d" =: whitecableleft[sts][sts][1]; + ligtable whitecableright[sts][sts][1]: + "D" =: whitecableright[sts][sts][1]; +endfor + +if 6wd# < symbolmaxwd#: + ligtable cableleft[2][2][2]: + "k" =: cableleft[2][2][2], + "d" =: whitecableleft[2][2][2]; + ligtable cableright[2][2][2]: + "K" =: cableright[2][2][2], + "D" =: whitecableright[2][2][2]; + ligtable whitecableleft[2][2][2]: + "d" =: whitecableleft[2][2][2]; + ligtable whitecableright[2][2][2]: + "D" =: whitecableright[2][2][2]; +fi + +for backsts = 1 upto 3: +for frontsts = 1 upto 3: + + if frontsts < 3: + ligtable cableright[frontsts][backsts][0]: + "K" =: cableright[frontsts+1][backsts][0], + "N" =: topcableright[frontsts+1][backsts], + "D" =: whitecableright[frontsts+1][backsts][0]; + ligtable whitecableright[frontsts][backsts][0]: + "D" =: whitecableright[frontsts+1][backsts][0]; + ligtable topcableright[frontsts][backsts]: + "N" =: topcableright[frontsts+1][backsts]; + ligtable botcableright[frontsts][backsts]: + "N" =: botcableright[frontsts+1][backsts]; + ligtable twistright[frontsts][backsts]: + "K" =: twistright[frontsts+1][backsts], + "N" =: botcableright[frontsts+1][backsts]; + ligtable revcableright[frontsts][backsts]: + "P" =: revcableright[frontsts+1][backsts]; + fi + + if backsts < 3: + ligtable cableleft[frontsts][backsts][0]: + "k" =: cableleft[frontsts][backsts+1][0], + "n" =: topcableleft[frontsts][backsts+1], + "d" =: whitecableleft[frontsts][backsts+1][0]; + ligtable whitecableleft[frontsts][backsts][0]: + "d" =: whitecableleft[frontsts][backsts+1][0]; + ligtable topcableleft[frontsts][backsts]: + "n" =: topcableleft[frontsts][backsts+1]; + ligtable botcableleft[frontsts][backsts]: + "e" =: botcableleft[frontsts][backsts+1], + "o" =: botcableleft[frontsts][backsts+1]; + ligtable twistleft[frontsts][backsts]: + if frontsts < 3: if backsts <= frontsts: + "k" =: cableleft[frontsts][frontsts][backsts], + "d" =: whitecableleft[frontsts][frontsts][backsts], + fi fi + "e" =: botcableleft[frontsts][backsts+1], + "o" =: botcableleft[frontsts][backsts+1], + "p" =: twistleft[frontsts][backsts+1]; + ligtable revcableleft[frontsts][backsts]: + "p" =: revcableleft[frontsts][backsts+1]; + fi + +endfor +endfor + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knit_nogrid_cables.mf b/Master/texmf-dist/fonts/source/public/knitting/knit_nogrid_cables.mf new file mode 100644 index 00000000000..44a34381186 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knit_nogrid_cables.mf @@ -0,0 +1,386 @@ +beginchar(",",wd#,ht#,dp#); "No stitch"; + purlbox; + endchar; +beginchar(".",wd#,ht#,dp#); "No stitch"; + endchar; + + path purlbar; + +beginchar("-",wd#,ht#,dp#); "A knit stitch"; + pickup symbol_pen; + draw bot (w/2,h-topgap+o) -- top (w/2, -d+bottomgap-o); + charbox; endchar; +beginchar("=",wd#,ht#,dp#); "A purl stitch"; + pickup symbol_pen; + lft x1-rt x2 = 0.7standardheight; x1+x2=w; y1=y2=0.5[h,-d]; + purlbar = z1--z2; + draw purlbar; + purlbox; endchar; + +code := 127; + +%Cables + +kright := incr code; +Kright := incr code; +pright := incr code; +Pright := incr code; +nright := incr code; +eright := incr code; +Nright := incr code; +dright := incr code; +oright := incr code; +Dright := incr code; + +midhoriz := 20; +righthoriz := 21; +specialhoriz := ASCII"/"; + +cabletopleft := 5; +cablebotleft := 6; +cabletopright:= 7; +cablebotright:= 8; + +cableleftslash := 9; +cableleftbackslash := 10; +cablerightslash := 11; +cablerightbackslash := 12; + +leftslash := 13; +rightslash := 14; + +beginchar("+",wd#,ht#,dp#); "Left end of a horizontal cable"; + pickup symbol_pen; + HCtop = (h-d)/2 + 0.2standardheight; + HCbot = (h-d)/2 - 0.2standardheight; + HCttop = bot (h-d)/2 + 0.5standardheight + o; + HCbbot = top (h-d)/2 - 0.5standardheight - o; + y.ul = y.ur = HCtop; + y.ll = y.lr = HCbot; + x.ul = x.ll = w-x.ur = w-x.lr; + x.ur-x.ul = (ht+dp)-2smallgap; + symbolpath0 := z.ul--z.ur; + symbolpath1 := z.ll--z.lr; + draw symbolpath0; draw symbolpath1; + symbolpic0 := currentpicture; + charbox; endchar; + +beginchar(midhoriz,wd#,ht#,dp#); "Middle of a horizontal cable"; + currentpicture := symbolpic0; + charbox; endchar; +beginchar(righthoriz,wd#,ht#,dp#); "Right end of a horizontal cable"; + currentpicture := symbolpic0; + charbox; endchar; + +ligtable "+": specialhoriz: + "+" |=: righthoriz; +ligtable righthoriz: + "+" |=: righthoriz, + specialhoriz =:| midhoriz, + righthoriz =:| midhoriz; + +beginchar(specialhoriz,wd#,ht#,dp#); "Special horizontal cable"; + pickup symbol_pen; + specialspread = 1.5symbolwidth; + y.ul = y.ur = HCtop; + y.ll = y.lr = HCbot; + x.ul = x.ll = w-x.ur = w-x.lr; + x.ur-x.ul = (ht+dp)-2smallgap; + draw rt (w/2+specialspread,y.ur)--z.ur; + draw rt (w/2+specialspread,y.lr)--z.lr; + draw lft (w/2-specialspread,y.ur)--z.ul; + draw lft (w/2-specialspread,y.lr)--z.ll; + draw (w/2+specialspread,HCttop)--(w/2+specialspread,HCbbot); + draw (w/2-specialspread,HCttop)--(w/2-specialspread,HCbbot); + charbox; endchar; + +beginchar("k",wd#,ht#,dp#); "Knit cable background"; + pickup symbol_pen; + draw top (w/2, botcableheight+cablevertgap)--bot(w/2,h-topgap); + charbox; + symbolpic0 := currentpicture; + endchar; +beginchar("c",wd#,ht#,dp#); "Knit cable background"; + currentpicture := symbolpic0; + endchar; +beginchar(kright,wd#,ht#,dp#); "Knit cable background"; + currentpicture := symbolpic0; + endchar; + +beginchar("p",wd#,ht#,dp#); "Purl cable background"; + pickup symbol_pen; + draw purlbar; + purlbox; + symbolpic0 := currentpicture; + endchar; +beginchar("g",wd#,ht#,dp#); "Purl cable background"; + currentpicture := symbolpic0; + purlbox; + endchar; +beginchar(pright,wd#,ht#,dp#); "Purl cable background"; + currentpicture := symbolpic0; + purlbox; + endchar; + +beginchar("n",wd#,ht#,dp#); "Back make one"; + pickup symbol_pen; + drawM(h-topgap, botcableheight+cablevertgap, 0.5w,symbolwidth); + charbox; + symbolpic0:=currentpicture; + endchar; +beginchar(nright,wd#,ht#,dp#); "Back make one"; + currentpicture := symbolpic0; endchar; + +beginchar("e",wd#,ht#,dp#); "Back purlwise make one"; + pickup purl_symbol_pen; + drawM(h-topgap, botcableheight+cablevertgap, 0.5w,purl_symbolwidth); + symbolpic0:=currentpicture; purlbox; +endchar; +beginchar(eright,wd#,ht#,dp#); "Back purlwise make one"; + currentpicture := symbolpic0; + purlbox; +endchar; + +beginchar("N",wd#,ht#,dp#); "Front make one"; + pickup symbol_pen; + drawM(topcableheight-cablevertgap, -d+bottomgap, 0.5w,symbolwidth); + symbolpic0 := currentpicture; +charbox; endchar; +beginchar(Nright,wd#,ht#,dp#); "Front make one"; + currentpicture := symbolpic0; +charbox; endchar; + +beginchar("d",wd#,ht#,dp#); "Back decrease"; + pickup symbol_pen; + drawSSK(h-topgap, botcableheight+cablevertgap); + charbox; symbolpic0:=currentpicture; +endchar; +beginchar(dright,wd#,ht#,dp#); "Back decrease"; + fliphoriz(symbolpic0)(currentpicture); endchar; + +beginchar("o",wd#,ht#,dp#); "Back purl decrease"; + pickup purl_symbol_pen; + drawSSK(h-topgap, botcableheight+cablevertgap); + symbolpic0:=currentpicture; purlbox; +endchar; +beginchar(oright,wd#,ht#,dp#); "Back purl decrease"; + fliphoriz(symbolpic0)(currentpicture); + purlbox; + endchar; + +beginchar("D",wd#,ht#,dp#); "Front decrease"; + pickup symbol_pen; + drawSSK(topcableheight-cablevertgap,-d+bottomgap); + charbox; symbolpic0:=currentpicture; +endchar; +beginchar(Dright,wd#,ht#,dp#); "Front decrease"; + fliphoriz(symbolpic0)(currentpicture); endchar; + + +beginchar("K",wd#,ht#,dp#); "Knit cable foreground"; + pickup symbol_pen; + draw top (w/2, -d+bottomgap)--bot(w/2,topcableheight-cablevertgap); + charbox; + symbolpic0 := currentpicture; + endchar; +beginchar("C",wd#,ht#,dp#); "Knit cable foreground"; + currentpicture := symbolpic0; + endchar; +beginchar(Kright,wd#,ht#,dp#); "Knit cable foreground"; + currentpicture := symbolpic0; + endchar; + +beginchar("P",wd#,ht#,dp#); "Purl cable foreground"; + pickup symbol_pen; + draw purlbar; + purlbox; + symbolpic0 := currentpicture; + endchar; +beginchar("G",wd#,ht#,dp#); "Purl cable foreground"; + currentpicture := symbolpic0; + endchar; +beginchar(Pright,wd#,ht#,dp#); "Purl cable foreground"; + currentpicture := symbolpic0; + purlbox; + endchar; + +beginchar("_",0,ht#,dp#); "Cable bottom connector"; + pickup symbol_pen; + x2 - x1 = 2wd - cablebargap; + 0.5[x1,x2]=0; + y1=y2=botcableheight; draw z1--z2; + endchar; +beginchar("^",0,ht#,dp#); "Cable top connector"; + pickup symbol_pen; + x2 - x1 = 2wd - cablebargap; + 0.5[x1,x2]=0; + y1=y2=topcableheight; draw z1--z2; +% pickup pensquare scaled symbolwidth; +% draw rt (-wd/2,topcableheight) -- lft (wd/2,topcableheight); + endchar; + +beginchar(rightslash,0,ht#,dp#); "Cable right slant connector"; + pickup symbol_pen; + x4 - x3 = cableslant; 0.5[x3,x4]=0; + y3=botcableheight; y4=topcableheight; + draw z3--z4; + symbolpic0 := currentpicture; + endchar; + +beginchar(leftslash,0,ht#,dp#); "Cable left slant connector"; + pickup symbol_pen; + x3 - x4 = cableslant; 0.5[x3,x4]=0; + y3=botcableheight; y4=topcableheight; + draw z3--z4; + symbolpic0 := currentpicture; + endchar; + + +beginchar(cabletopleft,0,ht#,dp#); "Cable top left connector"; + pickup pensquare scaled symbolwidth; + rt x2 - lft x1 = wd+2cableextend; lft x1 = -wd + cablebargap/2; + y1=y2=topcableheight; + symbolpath0 := z1--z2; + draw symbolpath0; + symbolpic0 := currentpicture; + endchar; +beginchar(cabletopright,0,ht#,dp#); "Cable top right connector"; + currentpicture := symbolpic0 reflectedabout ((0,0),(0,h)); + endchar; +beginchar(cablebotleft,0,ht#,dp#); "Cable bot left connector"; + pickup pensquare scaled symbolwidth; + y1=y2=botcableheight; + x1 = xpart (point 0 of symbolpath0); + x2 = xpart (point 1 of symbolpath0); + draw z1--z2; + symbolpic0 := currentpicture; + endchar; +beginchar(cablebotright,0,ht#,dp#); "Cable bot right connector"; + currentpicture := symbolpic0 reflectedabout ((0,0),(0,h)); + endchar; + +beginchar(cableleftslash,0,ht#,dp#); "Cable slash connector"; + pickup pensquare scaled symbolwidth; + y1 = y2 = botcableheight; + rt x1 = - cableslant/2; lft x2 = -wd + cablebargap/2; + draw z1--z2; + symbolpic0 := currentpicture; + endchar; +beginchar(cablerightbackslash,0,ht#,dp#); "Cable slash connector"; + currentpicture := symbolpic0 reflectedabout ((0,0),(0,h)); + endchar; +beginchar(cableleftbackslash,0,ht#,dp#); "Cable slash connector"; + pickup pensquare scaled symbolwidth; + y1 = y2 = topcableheight; + rt x1 = - cableslant/2; lft x2 = -wd + cablebargap/2; + draw z1--z2; + symbolpic0 := currentpicture; + endchar; +beginchar(cablerightslash,0,ht#,dp#); "Cable slash connector"; + currentpicture := symbolpic0 reflectedabout ((0,0),(0,h)); + endchar; + +if fonttype = foretype: + +ligtable +"k": +"p": +"c": +"g": +"o": +"e": +"n": +"d": + "k" |=:| cablebotleft, + "c" |=:| cablebotleft, + "n" |=:| cablebotleft, + "d" |=:| cablebotleft, + "p" |=:| cablebotleft, + "g" |=:| cablebotleft, + "e" |=:| cablebotleft, + "o" |=:| cablebotleft, + "K" |=:| rightslash, + "P" |=:| rightslash, + "N" |=:| rightslash, + "D" |=:| rightslash, + rightslash |=:| cableleftslash; + +ligtable +"K": +"P": +"C": +"G": +"N": +"D": + "K" |=:| cabletopleft, + "P" |=:| cabletopleft, + "G" |=:| cabletopleft, + "C" |=:| cabletopleft, + "N" |=:| cabletopleft, + "D" |=:| cabletopleft, + "k" |=:| leftslash, + "p" |=:| leftslash, + "o" |=:| leftslash, + "e" |=:| leftslash, + "n" |=:| leftslash, + "d" |=:| leftslash, + leftslash |=:| cableleftbackslash; + +ligtable +Kright: +Pright: +Nright: +Dright: + "K" |=: Kright, + Kright |=:| cabletopright, + "P" |=: Pright, + Pright |=:| cabletopright, + "N" |=: Nright, + Nright |=:| cabletopright, + "D" |=: Dright, + Dright |=:| cabletopright; + +ligtable +kright: +pright: +oright: +eright: +nright: +dright: + "k" |=: kright, + kright |=:| cablebotright, + "p" |=: pright, + pright |=:| cablebotright, + "o" |=: oright, + oright |=:| cablebotright, + "e" |=: eright, + eright |=:| cablebotright, + "n" |=: nright, + nright |=:| cablebotright, + "d" |=: dright, + dright |=:| cablebotright; + +ligtable rightslash: + "K" |=: Kright, + Kright |=:| cablerightslash, + "P" |=: Pright, + Pright |=:| cablerightslash, + "N" |=: Nright, + Nright |=:| cablerightslash, + "D" |=: Dright, + Dright |=:| cablerightslash; +ligtable leftslash: + "k" |=: kright, + "p" |=: pright, + "o" |=: oright, + "e" |=: eright, + "n" |=: nright, + "d" |=: dright, + kright |=:| cablerightbackslash, + nright |=:| cablerightbackslash, + dright |=:| cablerightbackslash, + pright |=:| cablerightbackslash, + eright |=:| cablerightbackslash, + oright |=:| cablerightbackslash; + +fi diff --git a/Master/texmf-dist/fonts/source/public/knitting/knit_symbols.mf b/Master/texmf-dist/fonts/source/public/knitting/knit_symbols.mf new file mode 100644 index 00000000000..b69176268d2 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knit_symbols.mf @@ -0,0 +1,930 @@ +if known ps_output: + font_coding_scheme := "T1-WGL4.enc"; +fi + +def purlfill = + if fonttype = purltype: + fill + ( -purlextend,-d-purlextend)-- + (w+purlextend,-d-purlextend)-- + (w+purlextend, h+purlextend)-- + ( -purlextend, h+purlextend)--cycle; + fi +enddef; + +purltype = 0; +gridtype = 1; +foretype = 2; +bothtype = 3; + +if gridfont: +def charbox = + if fonttype = purltype: + currentpicture := nullpicture; + else: + if fonttype = gridtype: currentpicture := nullpicture; fi + if (fonttype = gridtype) or (fonttype = bothtype): + pickup pencircle scaled gridwidth; + fill (-gridwidth/2,-d-gridwidth/2)--(w+gridwidth/2,-d-gridwidth/2)-- + (w+gridwidth/2,h+gridwidth/2)--(-gridwidth/2,h+gridwidth/2)--cycle; + unfill (gridwidth/2,-d+gridwidth/2)--(w-gridwidth/2,-d+gridwidth/2)-- + (w-gridwidth/2,h-gridwidth/2)--(gridwidth/2,h-gridwidth/2)--cycle; + %draw (0,-d)--(w,-d)--(w,h)--(0,h)--cycle; + fi + fi + enddef; +else: +def charbox = + if fonttype = purltype: + currentpicture := nullpicture; + fi + enddef; +fi + + +def purlbox = charbox; purlfill; enddef; + + picture symbolpic[]; + path symbolpath[]; + +def fliphoriz(text beginning, ending) = + ending := (beginning) reflectedabout ((.5w,0),(.5w,h)); + enddef; +def flipvert(text beginning, ending) = + ending := (beginning) reflectedabout ((0,(h-d)/2),(w,(h-d)/2)); + ending := (ending) shifted (0,bottomgap-topgap); + enddef; + +pair arrowpoint; + +def definearrow(text thepath, arrowlength, endpath) = + + arrowpoint := point infinity of thepath; + arrowdir := angle(direction infinity of thepath); + endpath := arrowpoint + ((1,0) rotated (arrowdir+150) scaled arrowlength) + --arrowpoint + ((1,0) rotated arrowdir scaled 0.5symbolwidth) + --arrowpoint + ((1,0) rotated (arrowdir-150) scaled arrowlength) + ; + enddef; + +beginchar("s",wd#,ht#,dp#); "Slip one left"; + pickup symbol_pen; + y1 = y2 = (h-d)/2-offset; + 0.5[x1,x2]=w/2; + rt x2 - lft x1 = ht+dp-2*smallgap; + symbolpath0 := z1--z2; + definearrow(symbolpath0)((x2-x1)/3)(symbolpath1); + draw symbolpath0; + draw symbolpath1; + symbolpic0 := currentpicture; + charbox; endchar; + +beginchar("S",wd#,ht#,dp#); "Slip one right"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +beginchar("[",wd#,ht#,dp#); "Slip one left knitwise"; + pickup symbol_pen; + pickup symbol_pen; + y1 = y2 = (h-d)/2-offset; + 0.5[x1,x2]=w/2; + rt x2 - lft x1 = ht+dp-2*0.3[smallgap,mingap]; + symbolpath0 := z1--z2; + definearrow(symbolpath0)((x2-x1)/3)(symbolpath1); + draw symbolpath0; + draw symbolpath1; + 0.5[y3,y4] = y1; + 0.5[x3,x4] = 0.5[lft x1, lft xpart point 0 of symbolpath1]; + z4 = z3+whatever*(1,2); + y4-y3 = 1.5 ypart (point 2 of symbolpath1 - point 0 of symbolpath1); + draw z3--z4; + labels(1,2,3,4); + symbolpic0 := currentpicture; + charbox; endchar; + +beginchar("]",wd#,ht#,dp#); "Slip one right knitwise"; + fliphoriz(symbolpic0)(currentpicture); + flipvert(currentpicture)(currentpicture); + charbox; endchar; + + +beginchar("h",wd#,ht#,dp#); "Drop stitch"; + pickup symbol_pen; + y1 = bot h-small_topgap; + y2 = top -d+small_bottomgap; + x1 = x2 =w/2; + symbolpath0 := z1--z2; + definearrow(symbolpath0)((y1-y2)/3)(symbolpath1); + draw symbolpath0; + draw symbolpath1; + symbolpic0 := currentpicture; + charbox; endchar; + +beginchar("H",wd#,ht#,dp#); "Up arrow"; + flipvert(symbolpic0)(currentpicture); + charbox; endchar; + +beginchar("O",wd#,ht#,dp#); "Yarn over"; + pickup symbol_pen; + top z1 = (0.5w, h-topgap+o); + bot z3 = (0.5w, bottomgap-d-o); + x2-x4 = y1-y3; 0.5[x2,x4]=0.5w; + y2 = y4 = 0.5[y1,y3]; + penpos1(symbolwidth,90); + penpos2(symbolwidth,0); + penpos3(symbolwidth,270); + penpos4(symbolwidth,180); + penstroke z1e..z2e..z3e..z4e..cycle; + charbox; endchar; + +beginchar("@",wd#,ht#,dp#); "Bead"; + pickup symbol_pen; + z1 = (0.5w, 0.667h); + z3 = (x1,-d+h-y1); + x2-x4 = y1-y3; 0.5[x2,x4]=0.5w; + y2 = y4 = 0.5[y1,y3]; + fill z1..z2..z3..z4..cycle; + unfill fullcircle scaled 0.3333(y1-y3) shifted 0.5[z1,z3]; + charbox; endchar; + +beginchar(ditto,wd#,ht#,dp#); "Wrap and turn"; + if fonttype <> purltype: + pickup symbol_pen; + z0 = 0.4[z1,z3] = 0.5[z2,z4]; + x3=x1=w/2; y2=y4; y3-y1=x4-x2; + + z5 = z3 + 1.5((x4-x2)/2,0); + z6 = z5 + ((x4-x2)/2,0) rotated 150; + z7 = z5 + ((x4-x2)/2,0) rotated -150; + + y6 = h-wrapturngap; + y1 = -d+wrapturngap; + + top (1-2spiralgap)[z0,z3]+(whatever,symbolwidth) = bot z7; + + symbolpath0 := + (1-2spiralgap)[z0,z2] + ..(1-2spiralgap)[z0,z3] + ..(1-spiralgap)[z0,z4] + ..z1 + ..z2 + ..z3{right}--z5; + definearrow(symbolpath0)((x4-x2)/2)(symbolpath1); + draw symbolpath0; + draw symbolpath1; + fi + symbolpic0 := currentpicture; +endchar; +beginchar(19,wd#,ht#,dp#); "Reverse wrap and turn"; + fliphoriz(symbolpic0)(currentpicture); + endchar; + +ligtable +ditto: + ditto =: 19; +ligtable +"-": +"=": + ditto |=: 19; + + +def drawM(expr topheight, bottomheight, mwidth, penwidth) = + pickup pensquare scaled penwidth; + rt x3 - lft x1 = 1.43 (y7-y1) = mwidth; + y1 = y2 = y3; + bot y7 = y8 = y9; + topheight - y7 = y1-bottomheight; + y4 = y10; y5 = y6; + y8 - y5 = 0.4(x2 - x1); + y8 - y4 = 1.6(y8 - y5); + x1 = x7; x5 = x2; x6 = x3; + x4 - x1 = x10 - x2 = 0.3penwidth; + x8 = 0.6[x1,x2]; x9 - x2 = x8 - x1; + x3 - x2 = x2 - x1; + x1 = w - x3; + penpos1 (penwidth, 0); + penpos7 (penwidth, 0); + penpos5 (penwidth, 0); + penpos6 (penwidth, 0); + penpos2 (penwidth, 0); + penpos3 (penwidth, 0); + penpos4 (penwidth-2(x4-x1), 180); + penpos10 (penwidth-2(x4-x1), 180); + penpos8 (penwidth, 90); + penpos9 (penwidth, 90); + %draw z4{up}..z8{right}..z5{down}; draw z10{up}..z9{right}..z6{down}; + penstroke z1e--z7e; + penstroke z4e{up}..z8e..z5e{down}--z2e; penstroke z10e{up}..z9e..z6e{down}--z3e; + labels(1,2,3,4,5,6,7,8,9,10,4l,4r); +enddef; + +def drawstar(expr topheight, bottomheight) = + top z1 = (w/2,topheight+o); + bot z2 = (w/2, bottomheight-o); + z3 - z4 = (z1-z2) rotated 60; + z5 - z6 = (z1-z2) rotated 120; + 0.5[z3,z4] = 0.5 [z5,z6] = 0.5[z1,z2]; + draw z1--z2; draw z3--z4; draw z5--z6; +enddef; + +beginchar("*",wd#,ht#,dp#); "Special instructions"; pickup symbol_pen; drawstar(h-topgap,-d+bottomgap); charbox; endchar; + +%beginchar("a",wd#,ht#,dp#); "Small bobble"; +% pickup symbol_pen; +% top z1 = (0.5w, h-small_topgap+o); +% bot z3 = (0.5w, small_bottomgap-d-o); +% x2-x4 = y1-y3; 0.5[x2,x4]=0.5w; +% y2 = y4 = 0.5[y1,y3]; +% pickup pensquare scaled symbolwidth rotated 45; +% draw z1--z2; draw z2--z3; draw z3--z4; draw z4--z1; +% drawdot 0.5[z1,z3]; +%charbox; endchar; +beginchar(0,wd#,ht#,dp#); "Large bobble"; + pickup symbol_pen; + top z0 = (w/2, h-min_topgap) if offset=0: + (0,o) fi; + bot z2 = (w/2, -d+min_bottomgap) if offset=0: - (0,o) fi; + 0.5[z1,z3] = 0.5[z0,z2]; + z1-z3 = (z2-z0) rotated 90; + draw z0..z1..z2..z3..cycle; +charbox; endchar; + + +def drawhat(expr linewd) = + pickup symbol_pen; + top z1 = (w/2, h-min_topgap+o); + x3-x1 = x1-x2; y3=y2; + x3-x2 = standardheight; + y1-y3 = (x1-x2); + z3l = z3 + ((linewd/2,0) rotated (angle (z1-z3)-90)); + z3m = z3 + ((linewd/2,0) rotated (angle (z3-z1))); + 0.5[z3l,z3r] = z3; + z2l = z2 + ((linewd/2,0) rotated (angle (z2-z1)-90)); + z2m = z2 + ((linewd/2,0) rotated (angle (z2-z1))); + 0.5[z2l,z2r] = z2; + z1r = z3r + whatever*(z1-z3); + z1r = z2r + whatever*(z2-z1); + z1l3-z1 = z3l-z3; + z1l2-z1 = z2l-z2; + fill z3l---z1l3..z1l2---z2l..z2m..z2r---z1r---z3r..z3m..cycle; +enddef; + + + +beginchar(1,wd#,ht#,dp#); "Make 1 from N"; + % Fontforge keeps mangling this symbol, so I'm doing it the slow, hard, but reliable way. + drawhat(symbolwidth); + symbolpic0 := currentpicture; + charbox; endchar; +beginchar(2,wd#,ht#,dp#); "Purl make 1 from N"; + drawhat(purl_symbolwidth); + symbolpic1 := currentpicture; + purlbox; endchar; +beginchar(3,wd#,ht#,dp#); "Make N from 1"; + flipvert(symbolpic0)(currentpicture); + charbox; endchar; +beginchar(4,wd#,ht#,dp#); "Purl make N from 1"; + flipvert(symbolpic1)(currentpicture); + purlbox; endchar; + +beginchar("U",wd#,ht#,dp#); "Cast on"; + if fonttype <> purltype: + pickup symbol_pen; + bot y1 = bot y3 = -d+bottomgap; + x1 = 0; x3 = w; x2 = w/2; top y2 = h-topgap; + draw z1{right}..z2{left}..z3{right}; + fi + endchar; +beginchar("f",wd#,ht#,dp#); "Bind off knitwise"; + if fonttype <> purltype: + pickup symbol_pen; + x1 = 0; x3 = w; x2 = w/2; + y1 = y3 = (h-d)/2; top y2 = h-topgap; + bot z4 = (w/2, -d+bottomgap); + draw z1..z2{right}..z3; + %draw z4--bot z1; + fi + endchar; +beginchar("F",wd#,ht#,dp#); "Bind off purlwise"; + if fonttype <> purltype: + pickup symbol_pen; + x1 = 0; x3 = w; x2 = w/2; + y1 = y3 = (h-d)/2; top y2 = h-topgap; + draw z1..z2{right}..z3; + fi + purlfill; endchar; +beginchar("Z",wd#,ht#,dp#); "Knit one doubly elongated"; + pickup symbol_pen; +% drawstar(h-topgap,-d+bottomgap); + 0.5[z1,z7] = top (w/2, -d+min_bottomgap); + y1 = y7; + x7 - x1 = 0.8(x8 - x0); + 0.5[x0,x8] = w/2; + y0 = y8 = 0.5[y1,y2]; + x8 - x0 = y2 - y1; + 0.5[z2,z6] = bot (w/2, h-min_topgap); + y2 = y6; + x6 - x2 = 0.7(x7-x1); + 0.5[x3,x5] = w/2; + y3 = y5 = 0.2[y1,y2]; + x5 - x3 = 0.5(x7-x1); + + x4 = w/2; y4 = y2; + + endangle := 110; + midtension := 2; + sidetension := 2; + + draw + z1{dir endangle} + ..z0{up} + ..z2{right} + ..tension sidetension + ..z3{left} + ..tension midtension + ..z4{right} + ..tension midtension + ..z5{left} + ..tension sidetension + ..z6{right} + ..z8{down} + ..z7{dir(-endangle)}; + + charbox; endchar; + +beginchar("z",wd#,ht#,dp#); "Knit one elongated"; + pickup symbol_pen; + 0.5[z1,z5] = top (w/2, -d+small_bottomgap); + y1 = y5; + x5 - x1 = 0.8(x6-x0); + 0.5[x0,x6] = w/2; + y0 = y6 = 0.5[y1,y2]; + x6 - x0 = y2 - y1; + 0.5[z2,z4] = bot (w/2, h-small_topgap); + y2 = y4; + x4 - x2 = 0.6(x5-x1); + x3 = w/2; y3 = 0.2[y1,y2]; + + endangle := 110; + midtension := 1.5; + + draw + z1{dir endangle}..z0{up}..z2{right}..tension midtension..z3{left} + ..tension midtension..z4{right}..z6{down}..z5{dir(-endangle)}; + + charbox; endchar; + +beginchar(25,wd#/2,ht#,dp#); "Left end of a wide increase"; + if fonttype <> purltype: + pickup pensquare xscaled wideinctip yscaled wideincline; + z1 = (w+cableextend,(h-topgap-d+bottomgap)/2); + x2 = w/3; top y2 = h-min_topgap+o; + fill bot lft z2{down}..bot z1{right}--top z1{left}..top rt z2{up}--top lft z2---cycle; + if gridfont: + if fonttype = gridtype: currentpicture := nullpicture; fi + if (fonttype = gridtype) or (fonttype = bothtype): + pickup pensquare scaled gridwidth; + draw lft (w,h)--(0,h); + draw (0,h)--(0,-d); + draw (0,-d)--lft (w,-d); + fi fi fi + symbolpic0 := currentpicture; + endchar; +beginchar(22,wd#/2,ht#,dp#); "Extender for a wide increase/decrease"; + if fonttype <> purltype: + z1 = (w+cableextend,(h-topgap-d+bottomgap)/2); + x2 = 0-cableextend; y2 = y1; + pickup pensquare scaled wideincline; + draw rt z2 -- lft z1; + if gridfont: + if fonttype = gridtype: currentpicture := nullpicture; fi + if (fonttype = gridtype) or (fonttype = bothtype): + pickup pensquare scaled gridwidth; + draw lft (w,h) -- rt (0,h); draw rt (0,-d) -- lft (w,-d); + fi fi fi + endchar; +beginchar(26,wd#/2,ht#,dp#); "Right end of a wide increase"; + fliphoriz(symbolpic0)(currentpicture); endchar; +beginchar(27,wd#/2,ht#,dp#); "Left end of a wide decrease"; + flipvert(symbolpic0)(currentpicture); endchar; +beginchar(28,wd#/2,ht#,dp#); "Right end of a wide decrease"; + fliphoriz(symbolpic0)(currentpicture); flipvert(currentpicture)(currentpicture);endchar; + +beginchar(29,wd#,ht#,dp#); "Middle of a wide increase"; + if fonttype <> purltype: + pickup pensquare xscaled wideinctip yscaled wideincline; + z1 = (-cableextend,(h-topgap-d+bottomgap)/2); + z3 = (w+cableextend,(h-topgap-d+bottomgap)/2); + x2 = w/2; bot y2 = -d+min_bottomgap-o; + %draw z1{right}..z2{down}; + fill bot lft z2{up}..bot z1{left}--top z1{right}..top rt z2---bot rt z2--cycle; + %draw z3{left}..z2{down}; + fill bot rt z2{up}..bot z3{right}--top z3{left}..top lft z2---bot lft z2--cycle; + if gridfont: + if fonttype = gridtype: currentpicture := nullpicture; fi + if (fonttype = gridtype) or (fonttype = bothtype): + pickup pensquare scaled gridwidth; + draw lft (w,h) -- rt (0,h); draw rt (0,-d) -- lft (w,-d); + fi fi fi + symbolpic0 := currentpicture; + endchar; +beginchar(30,wd#,ht#,dp#); "Middle of a wide decrease"; + flipvert(symbolpic0)(currentpicture); + endchar; + +if 5*wd# < symbolmaxwd#: + +beginchar(31,5wd#,ht#,dp#); "Make 1 from 5"; + pickup pensquare xscaled wideinctip yscaled wideincline; + top z1 = (w/2,h-min_topgap+o); + x2 = wd/3; bot y2 = bot y3 = -d+min_bottomgap-o; + x3 - x1 = x1 - x2; + z4 = 0.5[z1,z2]; z5 = 0.5[z1,z3]; + %draw z2{up}..z4{right}..z1{up}; + %draw z3{up}..z5{left}..z1{up}; + + 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; + 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; + + charbox; + endchar; +fi + +beginchar("~",wd#,ht#,dp#); "Empty box (spacer)"; endchar; +beginchar("`",0.5wd#,ht#,dp#); "Empty box (spacer)"; endchar; +beginchar("'",0.5wd#,ht#,dp#); "Empty box (spacer)"; + if fonttype = purltype: fill (0,-d)--(w,-d)--(w,h)--(0,h)--cycle; fi + endchar; + + +beginchar("m",wd#,ht#,dp#); "Make one"; + pickup symbol_pen; + drawM(h-topgap, -d+bottomgap, 0.5(h+d),symbolwidth); + charbox; endchar; +beginchar("M",wd#,ht#,dp#); "Make one purlwise"; + pickup purl_symbol_pen; + drawM(h-topgap, -d+bottomgap, 0.5(h+d),purl_symbolwidth); + purlbox; endchar; + +%def drawB(expr topgap, bottomgap, symbolwidth) = +% x1 = x2 = x3; x4 = x5 = x6; x7=x8 + 0.05(x7-x1); +% y1 = y4; y2 = y5; y3 = y6; y7 = 0.5[y1,y2]; y8 = 0.5[y2,y3]; +% top y3 = h-topgap; bot y1 = -d+bottomgap; +% y2 = 0.51[y1,y3]; +% x7-x1 = 1.3(y2-y1); +% x7-x6 = 0.7(x7-x1); +% 0.5[x7,x1]=w/2+ho; +% z9=z10=z5; z11=rt z2; +% +% penpos11(symbolwidth,-90); +% penpos5(symbolwidth,-90); +% penpos8(symbolwidth,0); +% penpos6(symbolwidth,90); +% penpos2(symbolwidth,180); +% penpos4(symbolwidth,-90); +% penpos7(symbolwidth,0); +% z10l=z5l; z9l=z5r; z10r = 0.4[z5,z5r]; +% z9r-z9l=z10l-z10r; +% y3r=y6r; y3l=y6l; x3r=x2r=x1r; x3l=x2l=x1l; +% y1r=y4r; y1l=y4l; +% penstroke z11e--z5e--z10e{right}..z8e..z6e---z3e--z2e--z1e---z4e..z7e..z9e{left}; +% +%enddef; +% +% +%beginchar("b",wd#,ht#,dp#); "Knit tbl"; +% pickup symbol_pen; +% drawB(topgap, bottomgap, symbolwidth); +% charbox; endchar; +%beginchar("B",wd#,ht#,dp#); "Purl tbl"; +% pickup purl_symbol_pen; +% drawB(topgap, bottomgap, purl_symbolwidth); +% purlbox; endchar; + +beginchar("|",overlinewd#,ht#,dp#); "Divider"; + if fonttype <> purltype: + fill(0,-d-gridwidth/2-purlextend)--(0,h+gridwidth/2+purlextend) + --(w,h+gridwidth/2+purlextend)--(w,-d-gridwidth/2-purlextend) + --cycle; + if gridfont: if fonttype = gridtype: currentpicture := nullpicture; fi fi + fi +endchar; + +%Twists + +path twistpath[]; + + pair time; + +beginchar("x",wd#,ht#,dp#); "Twist slanting right"; + pickup symbol_pen; + bot lft z0 = (0.5w-0.4 standardheight-ho,-d+small_bottomgap-o); + bot rt z4 = (0.5w+0.4 standardheight+ho,-d+small_bottomgap-o); + top z2 = (0.5w, h-topgap+o); + x3-x1 = 0.8(x0-x4); 0.5[x1,x3] = w/2; + y1 = y3 = 0.7[y0,y2]; + twistpath0:=z0{curl 0.1}..z1{up}..z2..z3{down}..z4{curl 0.1}; + + pathdir0 = angle (direction 0 of twistpath0); + pathdir4 = angle (direction 4 of twistpath0); + + penpos0(symbolwidth, (pathdir0 + 90)); + penpos1(symbolwidth, 180); + penpos2(symbolwidth, 270); + penpos3(symbolwidth, 360); + penpos4(symbolwidth, (pathdir4 + 90)); + + z5 = z0; z6 = z1; + penpos5(eraserwidth, (pathdir0 + 90)); + penpos6(eraserwidth, 180); + + time := (z5l{direction 0 of twistpath0}..z6l{up}) intersectiontimes + (z3l{down}..z4l{direction 4 of twistpath0}); + twistpath1 := subpath (ypart(time),1) of (z3l{down}..z4l{direction 4 of twistpath0}); + time := (z5l{direction 0 of twistpath0}..z6l{up}) intersectiontimes + (z3r{down}..z4r{direction 4 of twistpath0}); + twistpath2 := subpath (ypart(time),1) of (z3r{down}..z4r{direction 4 of twistpath0}); + fill twistpath1 & (point infinity of twistpath1--point infinity of twistpath2) + & reverse twistpath 2 & + (point 0 of twistpath2--point 0 of twistpath1) & cycle; + + time := (z5r{direction 0 of twistpath0}..z6r{up}) intersectiontimes + (z3l{down}..z4l{direction 4 of twistpath0}); + twistpath1 := subpath (0,ypart(time)) of (z3l{down}..z4l{direction 4 of twistpath0}); + time := (z5r{direction 0 of twistpath0}..z6r{up}) intersectiontimes + (z3r{down}..z4r{direction 4 of twistpath0}); + twistpath2:= subpath (0,ypart(time)) of (z3r{down}..z4r{direction 4 of twistpath0}); + fill twistpath1 & (point infinity of twistpath1--point infinity of twistpath2) + & reverse twistpath 2 & + (point 0 of twistpath2--point 0 of twistpath1) & cycle; + + penstroke z0e{direction 0 of twistpath0}.. + z1e{up}..z2e{left}..z3e{down} + ;%..z4e{direction 4 of twistpath0}; + + symbolpic0 := currentpicture; + labels(0,1,2,3,4,5); + charbox; endchar; + + numeric t[]; + +beginchar("t",wd#,ht#,dp#); "Twist slanting left"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +beginchar("X",wd#,ht#,dp#); "Purl right twist"; + currentpicture := symbolpic0; + purlbox; endchar; +beginchar("T",wd#,ht#,dp#); "Purl left twist"; + fliphoriz(symbolpic0)(currentpicture); + purlbox; endchar; + +beginchar("b",wd#,ht#,dp#); "Right upside-down twist"; + flipvert(symbolpic0)(currentpicture); + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("q",wd#,ht#,dp#); "Left upside-down twist"; + fliphoriz(symbolpic0)(currentpicture); + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("Q",wd#,ht#,dp#); "Purl right upside-down twist"; + currentpicture := symbolpic0; + purlbox; endchar; +beginchar("B",wd#,ht#,dp#); "Purl left upside-down twist"; + fliphoriz(symbolpic0)(currentpicture); + purlbox; endchar; + +%2/1 increases and decreases + +def drawSSK(expr topheight,bottom) = + bot rt z1 = (0.5w+0.5 (topheight-bottom)+ho,bottom-o); + top lft z2 = (0.5w-0.5 (topheight-bottom), topheight+o); + bot lft z3 = (0.5w-0.5 (topheight-bottom), bottom-o); + symbolpath0 := z1--z2--z3; + draw symbolpath0; +enddef; + +beginchar("<",decrwidth(2),ht#,dp#); "SSK or left-slant cable"; + pickup symbol_pen; + drawSSK(h-topgap,-d+bottomgap); + symbolpic0 := currentpicture; + charbox; endchar; +beginchar(">",decrwidth(2),ht#,dp#); "k2tog or right-slant cable"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; +beginchar(";",decrwidth(2),ht#,dp#); "P2tog"; + pickup purl_symbol_pen; + draw symbolpath0; + symbolpic0 := currentpicture; + purlbox; endchar; +beginchar(":",decrwidth(2),ht#,dp#); "SSP"; + fliphoriz(symbolpic0)(currentpicture); + purlbox; endchar; + +beginchar("j",incrwidth(1),ht#,dp#); "Lifted increase slanting left"; + pickup symbol_pen; + top lft z1 = (0.5w-0.5 standardheight-ho,h-topgap+o); + bot rt z2 = (0.5w+0.5 standardheight, -d+bottomgap-o); + symbolpath0 := z2--z1; + definearrow(symbolpath0)((y1-y2)/3)(symbolpath1); + draw symbolpath0; + draw symbolpath1; + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("i",incrwidth(1),ht#,dp#); "Lifted increase slanting right"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; +beginchar("J",incrwidth(1),ht#,dp#); "Purl increase slanting right"; + pickup purl_symbol_pen; + draw symbolpath0; + draw symbolpath1; + symbolpic0 := currentpicture; + purlbox; endchar; +beginchar("I",incrwidth(1),ht#,dp#); "Purl increase slanting left"; + fliphoriz(symbolpic0)(currentpicture); + purlbox; endchar; + +beginchar("(",wd#,ht#,dp#); "Left-slanting line"; + pickup symbol_pen; + draw symbolpath0; + charbox; endchar; +beginchar(")",wd#,ht#,dp#); "Right-slanting line"; + pickup symbol_pen; + draw symbolpath0; + fliphoriz(currentpicture)(currentpicture); + charbox; endchar; + +beginchar("y",incrwidth(2),ht#,dp#); "Knit front and back"; + pickup symbol_pen; + bot lft z1 = (0.5w-0.495 Vwidth-ho,-d+bottomgap-o); + top rt z2 = (0.5w+0.495 Vwidth+ho,h-topgap+o); + bot rt z3 = (0.5w+0.495 Vwidth+ho,-d+bottomgap-o); + top lft z4 = (0.5w-0.495 Vwidth-ho,h-topgap+o); + % For some reason, mf2pt1 doesn't like it if I use 0.5 Vwidth + z5 = whatever[z1,z2] = whatever[z3,z4]; + draw z1--z2; + draw z4--z5; + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("u",incrwidth(2),ht#,dp#); "Knit back and front"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +beginchar("4",incrwidth(2),ht#,dp#); "Alternative SSK"; + flipvert(symbolpic0)(currentpicture); + charbox; endchar; +beginchar("5",incrwidth(2),ht#,dp#); "Alternative K2tog"; + flipvert(symbolpic0)(currentpicture); + fliphoriz(currentpicture)(currentpicture); + charbox; endchar; + + +beginchar("v",incrwidth(2),ht#,dp#); "Generic make 2 from 1"; + pickup symbol_pen; + top rt z1 = (0.5w+0.5 Vwidth+ho,h-topgap+o); + bot y2 = -d+bottomgap-o; x2 = 0.5[x1,x3]; + top lft z3 = (0.5w-0.5 Vwidth-ho,h-topgap+o); + symbolpath0 := z1--z2--z3; + draw symbolpath0; + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("V",incrwidth(2),ht#,dp#); "Purl make 2 from 1"; + pickup purl_symbol_pen; + draw symbolpath0; + symbolpic1 := currentpicture; + purlbox; endchar; + +beginchar("!",incrwidth(2),ht#,dp#); "Make 1 from 2"; + flipvert(symbolpic0)(currentpicture); + charbox; endchar; +beginchar("2",incrwidth(2),ht#,dp#); "Make 1 from 2 purlwise"; + flipvert(symbolpic1)(currentpicture); + purlbox; endchar; + +%Double decreases and increases + +beginchar("w",incrwidth(3),ht#,dp#); "make 3 from 1"; + pickup symbol_pen; + top lft z1 = (0.5w-0.5 Wwidth-ho,h-small_topgap+o); + bot z2 = (0.5w,-d+small_bottomgap-o); + top rt z3 = (0.5w+0.5 Wwidth+ho, h-small_topgap+o); + z4 = 0.5[z1,z3]; + symbolpath0 := z1--z2--z3; + draw symbolpath0; + symbolpath1 := z2--z4; + draw symbolpath1; + charbox; endchar; +beginchar("W",incrwidth(3),ht#,dp#); "Purl make 3 from 1"; + pickup purl_symbol_pen; + draw symbolpath0; draw symbolpath1; + symbolpic0 := currentpicture; + purlbox; endchar; +beginchar("Y",incrwidth(3),ht#,dp#); "Make 3 from 1 with YO center"; + pickup symbol_pen; + draw symbolpath0; + top z4 = (0.5w, h-small_topgap+o); + bot z5 = z4 - (0, 0.5Wwidth); %Better way? + z6-z7 = (z4-z5) rotated 90; 0.5[z6,z7]=0.5[z4,z5]; + draw z4..z6..z5..z7..cycle; + charbox; endchar; + +beginchar("E",incrwidth(3),ht#,dp#); "make 3 from 1 with purl center"; + pickup symbol_pen; + if fonttype <> purltype: + currentpicture := symbolpic0; + else: + z1 = point 0 of symbolpath0; + z2 = point 1 of symbolpath0; + z3 = point 2 of symbolpath0; + fill z1--z2--z3--cycle; + fi + endchar; + +beginchar("A",decrwidth(3),ht#,dp#); "Make 1 from 3"; + pickup symbol_pen; + bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); + top z2 = (0.5w, h-small_topgap+o); + bot rt z3 = (0.5w+0.5 biggerheight, -d+small_bottomgap-o); + z4 = 0.5[z1,z3]; + symbolpath0 := z1--z2--z3; + symbolpath1 := z2--z4; + draw symbolpath0; + draw symbolpath1; + charbox; endchar; +beginchar("3",decrwidth(3),ht#,dp#); "Purl make 1 from 3"; + pickup purl_symbol_pen; + draw symbolpath0; + draw symbolpath1; + purlbox; endchar; + +beginchar("R",decrwidth(3),ht#,dp#); "k3tog"; + pickup symbol_pen; + bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); + top rt z2 = (0.5w+0.5 biggerheight, h-small_topgap+o); + bot rt z3 = (0.5w+0.5 biggerheight, -d+small_bottomgap-o); + z4 = 0.5[z1,z3]; + draw z1--z2--z3; + draw z4--0.5[z4,z2]; + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("L",decrwidth(3),ht#,dp#); "SSSK"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +beginchar("r",decrwidth(3),ht#,dp#); "LRC"; + pickup symbol_pen; + bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); + top rt z2 = (0.5w+0.5 biggerheight+ho,h-small_topgap+o); + bot rt z3 = (0.5w+0.5 biggerheight+ho,-d+small_bottomgap-o); + top lft z4 = (0.5w-0.5 biggerheight-ho,h-small_topgap+o); + z5 = alpha[z1,z2]; z5 = beta[z3,z4]; + x6=x5; y6=y1; + draw z1--z2; + draw z3--z5; + draw z5--z6; + symbolpic0 := currentpicture; + charbox; endchar; +beginchar("l",decrwidth(3),ht#,dp#); "RLC"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +beginchar("a",decrwidth(3),ht#,dp#); "LRC"; + pickup symbol_pen; + bot lft z1 = (0.5w-0.5 biggerheight-ho,-d+small_bottomgap-o); + top rt z2 = (0.5w+0.5 biggerheight+ho,h-small_topgap+o); + bot rt z3 = (0.5w+0.5 biggerheight+ho,-d+small_bottomgap-o); + top lft z4 = (0.5w-0.5 biggerheight-ho,h-small_topgap+o); + x5 = 0.5w; y5 = 0.6[y1,y4]; + top z6 = (0.5w, h-small_topgap+o); + bot z7 = (0.5w, -d+small_bottomgap-o); + draw z1--z5; + draw z3--z5; + draw z6--z7; + charbox; endchar; + +beginchar("?",wd#,ht#,dp#); "Left end of wrapped stitches"; + pickup symbol_pen; + x0r = x1r = x2r = w; + y0r-y1r = y1r-y2r; + y0m=y0r; y1m=y1r; y2m=y2r; + y0l-y0r = y1l-y1r = y2l-y2r; + + if gridfont: + h-small_topgap+o = top y0l; + bot y2r = small_bottomgap-d; + y1l = 2/3[y1r,y0r]; + x2l+ho = h-y0l+o; + x0m = 0.4[x0l,x0r]; + x2m = 0.5[x2l,x2r]; + z0l = z2l + whatever*(1,3); + wraplines := 3; + else: + h-small_topgap-top y0r = bot y2r-small_bottomgap+d; + if (topgap>standardgap) or (bottomgap>standardgap): + wraplines := 2; else: wraplines:=3; fi + if wraplines = 2: + y0r - y2r = 1.5(h-small_topgap-top y0r); + lft x2l+ho = smallgap; + else: + y0r - y1r = 1.5(h-small_topgap-top y0r); + lft x2l+ho = mingap; + fi + x0m = 0.2[x0l,x0r]; + x2m = 0.3[x2l,x2r]; + y0l = 0.6[y0r,h-small_topgap+o]; + z0l = z2l + whatever*(1,4); + fi + + z1l=whatever[z0l,z2l]; + z1m=whatever[z0m,z2m]; + pickup pensquare scaled symbolwidth; + draw lft z0r--rt (0,y0r); + if wraplines=3: draw lft z1r--rt (0,y1r); fi + draw lft z2r--rt (0,y2r); + symbolpic1 := currentpicture; + currentpicture := nullpicture; + draw lft z0r---rt z0m; + if wraplines=3: draw lft z1r---rt z1m; fi + draw lft z2r---rt z2m; + pickup symbol_pen; + draw z0m{left}..z0l; + if wraplines=3: draw z1m{left}..z1l; fi + draw z2m{left}..z2l; + + if gridfont: else: + draw bot (w/2,h-small_topgap+o) -- top (w/2, -d+small_bottomgap-o); + fi + + symbolpic0 := currentpicture; + labels(0r,0m,0l,1r,1m,1l,2r,2m,2l); + charbox; endchar; + +beginchar(23,wd#,ht#,dp#); "Middle of wrapped stitches"; + pickup symbol_pen; + currentpicture := symbolpic1; + if gridfont: else: + draw bot (w/2,h-small_topgap+o) -- top (w/2, -d+small_bottomgap-o); + fi + charbox; endchar; +beginchar(24,wd#,ht#,dp#); "Right end of wrapped stitches"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +ligtable "?": + "?" |=: 24; +ligtable 24: + "?" |=: 24, + 24 =:| 23; + +beginchar("1",wd#,ht#,dp#); "Left end of single-wrapped stitches"; + pickup symbol_pen; + x1r=w; + y1m=y1r; + + if gridfont: + if wd>ht+dp: + y1l-y1r = (h+d)/3; + else: + y1l-y1r = (h+d)/4; + fi + else: + y1l-y1r = (h+d)/5; + fi + x1m = 0.1[x1r,x1l]; + h-topgap+o-y1l = 1/2(y1r+d-bottomgap); + rt x1l+ho = standardgap; + wraplines := 1; + if y1r<bottomgap-d: message("Your single-wrapped stitch symbol is too tall."); fi + + pickup pensquare scaled symbolwidth; + draw lft z1r--rt (0,y1r); + symbolpic1 := currentpicture; + currentpicture := nullpicture; + draw lft z1r---rt z1m; + pickup symbol_pen; + draw z1m{left}..z1l; + + if gridfont: else: + draw bot (w/2,h-topgap+o) -- top (w/2, -d+bottomgap-o); + fi + + symbolpic0 := currentpicture; + labels(1r,1m,1l); + charbox; endchar; + +beginchar(17,wd#,ht#,dp#); "Middle of wrapped stitches"; + pickup symbol_pen; + currentpicture := symbolpic1; + if gridfont: else: + draw bot (w/2,h-small_topgap+o) -- top (w/2, -d+small_bottomgap-o); + fi + charbox; endchar; +beginchar(18,wd#,ht#,dp#); "Right end of wrapped stitches"; + fliphoriz(symbolpic0)(currentpicture); + charbox; endchar; + +ligtable "1": + "1" |=: 18; +ligtable 18: + "1" |=: 18, + 18 =:| 17; + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitgg.mf b/Master/texmf-dist/fonts/source/public/knitting/knitgg.mf new file mode 100644 index 00000000000..2e8ae81800d --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitgg.mf @@ -0,0 +1,21 @@ +%mode=localfont; % Run mf knit_grid; then run gftopk knit_grid.600gf +mode_setup; + +boolean gridfont; gridfont := true; +fonttype = gridtype; % Show grid only + +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-grid-grid"; +fi + +string Vtitle; Vtitle := "Knit font with grid"; + +input knit_symbols; + +input knit_grid_cables; + +end + + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitgn.mf b/Master/texmf-dist/fonts/source/public/knitting/knitgn.mf new file mode 100644 index 00000000000..cc785ea68bd --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitgn.mf @@ -0,0 +1,22 @@ +%mode=localfont; % Run mf knit_grid; then run gftopk knit_grid.600gf +mode_setup; + +boolean gridfont; gridfont := true; +boolean slantlines; slantlines = false; +fonttype = foretype; % Show symbols only - no grid + +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-grid-foreground"; +fi + +string Vtitle; Vtitle := "Knit font with grid"; + +input knit_symbols; + +input knit_grid_cables; + +end + + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitgp.mf b/Master/texmf-dist/fonts/source/public/knitting/knitgp.mf new file mode 100644 index 00000000000..6f321d5d1ed --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitgp.mf @@ -0,0 +1,21 @@ +%mode=localfont; % Run mf knit_grid; then run gftopk knit_grid.600gf +mode_setup; + +boolean gridfont; gridfont := true; +fonttype = purltype; % Gray purl background + +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-grid-purl"; +fi + +string Vtitle; Vtitle := "Knit font with grid"; + +input knit_symbols; + +input knit_grid_cables; + +end + + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitnl.mf b/Master/texmf-dist/fonts/source/public/knitting/knitnl.mf new file mode 100644 index 00000000000..6cdd723b036 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitnl.mf @@ -0,0 +1,25 @@ +%mode=localfont; +mode_setup; + +boolean gridfont; gridfont := false; +fonttype = foretype; % Show symbols + +bottomgap# = standardgap#; +topgap# = ht#-topcableheight#+cablevertgap#; + +input knit_dimens; + +if known ps_output: + font_identifier :="KnittingSymbols-nogrid-lowered"; +fi + +string Vtitle; Vtitle := "Knit font, no grid"; + +input knit_symbols; + +pickup symbol_pen; + +input knit_nogrid_cables; + + +end diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitnn.mf b/Master/texmf-dist/fonts/source/public/knitting/knitnn.mf new file mode 100644 index 00000000000..a58accfce10 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitnn.mf @@ -0,0 +1,19 @@ +%mode=localfont; +mode_setup; + +boolean gridfont; gridfont := false; +fonttype = foretype; % Show symbols + +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-nogrid-foreground"; +fi + +string Vtitle; Vtitle := "Knit font, no grid"; + +input knit_symbols; + +input knit_nogrid_cables; + +end diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitnp.mf b/Master/texmf-dist/fonts/source/public/knitting/knitnp.mf new file mode 100644 index 00000000000..023cdd9e93c --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitnp.mf @@ -0,0 +1,22 @@ +%mode=localfont; +mode_setup; + +boolean gridfont; gridfont := false; +fonttype = purltype; % Gray purl background + +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-nogrid-purl"; +fi + +string Vtitle; Vtitle := "Knit font, no grid"; + +input knit_symbols; + +pickup symbol_pen; + +input knit_nogrid_cables; + + +end diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitnr.mf b/Master/texmf-dist/fonts/source/public/knitting/knitnr.mf new file mode 100644 index 00000000000..5c7d6f2dd8f --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitnr.mf @@ -0,0 +1,25 @@ +%mode=localfont; +mode_setup; + +boolean gridfont; gridfont := false; +fonttype = foretype; % Show symbols + +bottomgap# = dp#+botcableheight#+cablevertgap#; +topgap# = standardgap#; + +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-nogrid-raised"; +fi + +string Vtitle; Vtitle := "Knit font, no grid"; + +input knit_symbols; + +pickup symbol_pen; + +input knit_nogrid_cables; + + +end diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitwg.mf b/Master/texmf-dist/fonts/source/public/knitting/knitwg.mf new file mode 100644 index 00000000000..5fb5bd7efa0 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitwg.mf @@ -0,0 +1,22 @@ +%mode=localfont; % Run mf knit_grid; then run gftopk knit_grid.600gf +mode_setup; + +boolean gridfont; gridfont := true; +fonttype = gridtype; % Show grid only + +wd# = widewd#; +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-wide-grid"; +fi + +string Vtitle; Vtitle := "Knit font with grid"; + +input knit_symbols; + +input knit_grid_cables; + +end + + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitwn.mf b/Master/texmf-dist/fonts/source/public/knitting/knitwn.mf new file mode 100644 index 00000000000..8470efbde72 --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitwn.mf @@ -0,0 +1,22 @@ +%mode=localfont; % Run mf knit_grid; then run gftopk knit_grid.600gf +mode_setup; + +boolean gridfont; gridfont := true; +fonttype = foretype; % Show symbols only - no grid + +wd# = widewd#; +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-wide-foreground"; +fi + +string Vtitle; Vtitle := "Knit font with grid"; + +input knit_symbols; + +input knit_grid_cables; + +end + + diff --git a/Master/texmf-dist/fonts/source/public/knitting/knitwp.mf b/Master/texmf-dist/fonts/source/public/knitting/knitwp.mf new file mode 100644 index 00000000000..3b5e821655a --- /dev/null +++ b/Master/texmf-dist/fonts/source/public/knitting/knitwp.mf @@ -0,0 +1,22 @@ +%mode=localfont; % Run mf knit_grid; then run gftopk knit_grid.600gf +mode_setup; + +boolean gridfont; gridfont := true; +fonttype = purltype; % Gray purl background + +wd# = widewd#; +input knit_dimens; + +if known ps_output: + font_identifier := "KnittingSymbols-wide-purl"; +fi + +string Vtitle; Vtitle := "Knit font with grid"; + +input knit_symbols; + +input knit_grid_cables; + +end + + |