From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- fonts/knot/README | 45 +++++++++++ fonts/knot/bits.mf | 207 ++++++++++++++++++++++++++++++++++++++++++++++++ fonts/knot/do2knots.mf | 53 +++++++++++++ fonts/knot/doknots.mf | 52 ++++++++++++ fonts/knot/found.mf | 177 +++++++++++++++++++++++++++++++++++++++++ fonts/knot/knot.mf | 37 +++++++++ fonts/knot/knot.tex | 37 +++++++++ fonts/knot/knot1.mf | 39 +++++++++ fonts/knot/knot2.mf | 39 +++++++++ fonts/knot/knot3.mf | 39 +++++++++ fonts/knot/knot4.mf | 39 +++++++++ fonts/knot/knot5.mf | 39 +++++++++ fonts/knot/knot6.mf | 39 +++++++++ fonts/knot/knot7.mf | 39 +++++++++ fonts/knot/knots.mf | 39 +++++++++ fonts/knot/sides.mf | 195 +++++++++++++++++++++++++++++++++++++++++++++ fonts/knot/soloman.mf | 125 +++++++++++++++++++++++++++++ fonts/knot/testknot.tex | 51 ++++++++++++ fonts/knot/tri.mf | 38 +++++++++ 19 files changed, 1329 insertions(+) create mode 100644 fonts/knot/README create mode 100644 fonts/knot/bits.mf create mode 100644 fonts/knot/do2knots.mf create mode 100644 fonts/knot/doknots.mf create mode 100644 fonts/knot/found.mf create mode 100644 fonts/knot/knot.mf create mode 100644 fonts/knot/knot.tex create mode 100644 fonts/knot/knot1.mf create mode 100644 fonts/knot/knot2.mf create mode 100644 fonts/knot/knot3.mf create mode 100644 fonts/knot/knot4.mf create mode 100644 fonts/knot/knot5.mf create mode 100644 fonts/knot/knot6.mf create mode 100644 fonts/knot/knot7.mf create mode 100644 fonts/knot/knots.mf create mode 100644 fonts/knot/sides.mf create mode 100644 fonts/knot/soloman.mf create mode 100644 fonts/knot/testknot.tex create mode 100644 fonts/knot/tri.mf (limited to 'fonts/knot') diff --git a/fonts/knot/README b/fonts/knot/README new file mode 100644 index 0000000000..c24f860d81 --- /dev/null +++ b/fonts/knot/README @@ -0,0 +1,45 @@ + Celtic Knotwork Font + + The metafont source comprises the following files. + + knot1.mf These are the base files for seven different + knot2.mf styles of knotwork. You can create your own + knot3.mf by modifying the parameters set in these. + knot4.mf + knot5.mf + knot6.mf + knot7.mf + + doknots.mf This files sets up the macros according to the + base parpameters. + soloman.mf This creates the parts for the Soloman Knot. + found.mf This creates the parts for the Foundation Knot. + sides.mf This has different styles of intersections. + bits.mf This has general box drawing characters and + bits for ornamentation. + + testknot.tex This is a comprehensive display of the seven + knotwork types and how one might display them. + + In general to use them in TeX you must set up a box with +\obeylines, \obeyspaces, \baselineskip=0pt, and \lineskip=0pt. This is +to ensure there are no gaps between vertical characters. + The best way I've discovered in LaTeX is to use a center +environment with a \nointerlineskip after each \\. + I would greatly appreciate any macros people work out for using +the knotwork characters in. I would especially like to see some sort of +tabular environment or a border creation macro. + + Known bugs: + I don't think it works at other than normal magnification. + I'm probably using an unshapred value where I should be using + a sharped value or vice versa. + The width of the path appears to change on the + straight vertical or horizontal strokes. + My screen driver shows gaps between some characters. I do + not see these on my printer though. + Some joints appear a bit kinked. Not badly enough to + detract from sight. + + Send all comments, bugs and improvementes to Jo Jaquina, + jaymin@maths.tcd.ie diff --git a/fonts/knot/bits.mf b/fonts/knot/bits.mf new file mode 100644 index 0000000000..2693d47d44 --- /dev/null +++ b/fonts/knot/bits.mf @@ -0,0 +1,207 @@ +beginchar ("0", sqwid#, sqht#, 0); "bit 0"; + pickup thin_pen; + + z1 = (0,0); + z2 = (w,0); + z3 = (w,h); + z4 = (0,h); + draw z1--z2--z3--z4--cycle; +endchar; + +beginchar ("1", sqwid#, sqht#, 0); "bit 1"; + pickup thin_pen; + + z1 = (0,0); + z2 = (w,0); + z3 = (w,h); + z4 = (0,h); + z5 = (1/7w,1/7h); + z6 = (6/7w,1/7h); + z7 = (6/7w,6/7h); + z8 = (1/7w,6/7h); + draw z1--z2--z3--z4--cycle; + draw z5--z6--z7--z8--cycle; + pickup pensquare xscaled (1/7w) yscaled (1/7h) shifted (1/14w, 1/14h); + drawdot (1/7w, 1/7h); + drawdot (3/7w, 1/7h); + drawdot (5/7w, 1/7h); + drawdot (2/7w, 2/7h); + drawdot (4/7w, 2/7h); + drawdot (1/7w, 3/7h); + drawdot (3/7w, 3/7h); + drawdot (5/7w, 3/7h); + drawdot (2/7w, 4/7h); + drawdot (4/7w, 4/7h); + drawdot (1/7w, 5/7h); + drawdot (3/7w, 5/7h); + drawdot (5/7w, 5/7h); +endchar; + +beginchar ("2", sqwid#, sqht#, 0); "bit 2"; + pickup thin_pen; + + z1 = (0,0); + z2 = (w,0); + z3 = (w,h); + z4 = (0,h); + z5 = (0,.75h); + z6 = (.25w,.75h); + z7 = (.25w,.5h); + z8 = (.75w,.5h); + z9 = (.75w,.25h); + z10= (w,.25h); + z11= (.25w,0); + z12= (.25w,.25h); + z13= (.5w,.25h); + z14= (.5w,.75h); + z15= (.75w,.75h); + z16= (.75w,h); + z17= (.125w,.125h); + z18= (.125w,.625h); + z19= (.125w,.375h); + z20= (.375w,.375h); + z21= (.875w,.125h); + z22= (.375w,.125h); + z23= (.625w,.125h); + z24= (.625w,.375h); + z25= (.875w,.375h); + z26= (.875w,.875h); + z27= (.625w,.625h); + z28= (.875w,.625h); + z29= (.375w,.625h); + z30= (.375w,.875h); + z31= (.125w,.875h); + z32= (.625w,.875h); + + draw z1--z2--z3--z4--cycle; + draw z5--z6--z7--z8--z9--z10; + draw z11--z12--z13--z14--z15--z16; + draw z17--z18; draw z19--z20; draw z21--z22; + draw z23--z24; draw z25--z26; draw z27--z28; + draw z29--z30; draw z31--z32; +endchar; + +beginchar ("3", sqwid#, sqht#, 0); "bit 3"; + z1 = (w/2,h/4); + z2 = (3w/4,h/2); + z3 = (w/2,3h/4); + z4 = (w/4,h/2); + fill z1--z2--z3--z4--cycle; +endchar; + +beginchar ("4", sqwid#, sqht#, 0); "bit 4"; + z1 = (w/2,h/4); + z2 = (3w/4,h/2); + z3 = (w/2,3h/4); + z4 = (w/4,h/2); + fill z1..z2..z3..z4..cycle; +endchar; + +beginchar ("5", sqwid#, sqht#, 0); "bit 5"; + pickup thin_pen; + + z1 = (0,0); + z2 = (w,0); + z3 = (w,h); + z4 = (0,h); + z5 = (1/7w,1/7h); + z6 = (6/7w,1/7h); + z7 = (6/7w,6/7h); + z8 = (1/7w,6/7h); + z9 = (w/2, 2/7h); + z10= (5/7w, h/2); + z11= (w/2, 5/7h); + z12= (2/7w, h/2); + draw z1--z2--z3--z4--cycle; + fill z5--z9--z6--cycle; + fill z6--z10--z7--cycle; + fill z7--z11--z8--cycle; + fill z8--z12--z5--cycle; +endchar; + +def ulsq = + pickup knot_pen; + lft x1 = 0; + y1 = 0; + lft x2 = 0; + top y2 = h; + x3 = w; + top y3 = h; + draw z1--z2--z3; + + pickup thin_pen; + z4 = (.2w, 0); + z5 = (.2w, .8h); + z6 = (w, .8h); + draw z4--z5--z6; + + pickup thin_pen; + z7 = (.8w, 0); + z8 = (.8w, .2h); + z9 = (w, .2h); + draw z7--z8--z9; + + pickup knot_pen; + rt x10 = w; + y10 = 0; + rt x11 = w; + bot y11 = 0; + x12 = w; + bot y12 = 0; + draw z10--z11--z12; +enddef; + +beginchar (":", sqwid#, sqht#, 0); "ul square"; + ulsq; +endchar; + +beginchar (";", sqwid#, sqht#, 0); "ur square"; + ulsq; + currentpicture := currentpicture rotated 270 shifted (0, h); +endchar; + +beginchar ("=", sqwid#, sqht#, 0); "lr square"; + ulsq; + currentpicture := currentpicture rotated 180 shifted (w, h); +endchar; + +beginchar ("<", sqwid#, sqht#, 0); "ll square"; + ulsq; + currentpicture := currentpicture rotated 90 shifted (w, 0); +endchar; + +def vtsq = + pickup knot_pen; + lft x1 = 0; + y1 = 0; + lft x2 = 0; + y2 = h; + draw z1--z2; + pickup thin_pen; + x3 = .2w; + y3 = 0; + x4 = .2w; + y4 = h; + draw z3--z4; + pickup thin_pen; + x5 = .8w; + y5 = 0; + x6 = .8w; + y6 = h; + draw z5--z6; + pickup knot_pen; + rt x7 = w; + y7 = 0; + rt x8 = w; + y8 = h; + draw z7--z8; +enddef; + +beginchar (">", sqwid#, sqht#, 0); "vert square"; + vtsq; +endchar; + +beginchar ("?", sqwid#, sqht#, 0); "horiz square"; + vtsq; + currentpicture := currentpicture rotated 90 shifted (w, 0); +endchar; diff --git a/fonts/knot/do2knots.mf b/fonts/knot/do2knots.mf new file mode 100644 index 0000000000..bfcece09b8 --- /dev/null +++ b/fonts/knot/do2knots.mf @@ -0,0 +1,53 @@ +pickup pencircle scaled thick; +knot_pen := savepen; +pickup pencircle scaled thin; +thin_pen := savepen; + +numeric a[]; +a1 := angle(sqwid#, sqht#); +a2 := 180 - a1; +a3 := 180 + a1; +a4 := 360 - a1; + +pair x[]ll, x[]rr, x[]c; +pair y[]ll, y[]rr, y[]c; +path parp_.l, parp_.r, parp_.c, parp_.ll, parp_.rr; + +def llrrexp(expr max_num) = + for ii := 0 upto max_num: + z[ii].c = z[ii]; + z[ii].ll = indist[z[ii].l, z[ii].r]; + z[ii].rr = indist[z[ii].r, z[ii].l]; + endfor; +enddef; + +def penstroke text t = + forsuffixes e = c,l,r,ll,rr: parp_.e:=t; endfor + if cycle parp_.l: cyclestroke_ + else: + unfill parp_.ll -- reverse parp_.rr -- cycle; + cullit; + forsuffixes e = c,l,r,ll,rr: + if knotstyle.e = 2: + pickup knot_pen; draw parp_.e; + elseif knotstyle.e = 1: + pickup thin_pen; draw parp_.e; + elseif knotstyle.e = -1: + pickup thin_pen; undraw parp_.e; + elseif knotstyle.e = -2: + pickup knot_pen; undraw parp_.e; + fi + endfor + if knotstyle.solid = 1: + fill parp_.l -- reverse parp_.r -- cycle; + elseif knotstyle.solid = 2: + fill parp_.ll -- reverse parp_.rr -- cycle; + elseif knotstyle.solid = 3: + fill parp_.ll -- reverse parp_.l -- cycle; + fill parp_.rr -- reverse parp_.r -- cycle; + fi + cullit; + fi +enddef; + +input tri diff --git a/fonts/knot/doknots.mf b/fonts/knot/doknots.mf new file mode 100644 index 0000000000..e67e894294 --- /dev/null +++ b/fonts/knot/doknots.mf @@ -0,0 +1,52 @@ +pickup pencircle scaled thick; +knot_pen := savepen; +pickup pencircle scaled thin; +thin_pen := savepen; + +numeric a[]; +a1 := angle(sqwid#, sqht#); +a2 := 180 - a1; +a3 := 180 + a1; +a4 := 360 - a1; + +pair x[]ll, x[]rr, x[]c; +pair y[]ll, y[]rr, y[]c; +path parp_.l, parp_.r, parp_.c, parp_.ll, parp_.rr; + +def llrrexp(expr max_num) = + for ii := 0 upto max_num: + z[ii].c = z[ii]; + z[ii].ll = indist[z[ii].l, z[ii].r]; + z[ii].rr = indist[z[ii].r, z[ii].l]; + endfor; +enddef; + +def penstroke text t = + forsuffixes e = c,l,r,ll,rr: parp_.e:=t; endfor + if cycle parp_.l: cyclestroke_ + else: + forsuffixes e = c,l,r,ll,rr: + if knotstyle.e = 2: + pickup knot_pen; draw parp_.e; + elseif knotstyle.e = 1: + pickup thin_pen; draw parp_.e; + elseif knotstyle.e = -1: + pickup thin_pen; undraw parp_.e; + elseif knotstyle.e = -2: + pickup knot_pen; undraw parp_.e; + fi + endfor + if knotstyle.solid = 1: + fill parp_.l -- reverse parp_.r -- cycle; + elseif knotstyle.solid = 2: + fill parp_.ll -- reverse parp_.rr -- cycle; + elseif knotstyle.solid = 3: + fill parp_.ll -- reverse parp_.l -- cycle; + fill parp_.rr -- reverse parp_.r -- cycle; + fi + fi +enddef; + +input soloman +input found +input sides diff --git a/fonts/knot/found.mf b/fonts/knot/found.mf new file mode 100644 index 0000000000..7bef786f9d --- /dev/null +++ b/fonts/knot/found.mf @@ -0,0 +1,177 @@ +def foundation_left = + z0 = (.5w,h); + penpos0(croswid, a3); + z1 = z0; + penpos1(knotwid, a3); + z2 = (.75w, .75h); + penpos2(knotwid, a3); + z7 = (w, .75h); + penpos7(knotwid, a4); + z3 = z0r; + penpos3(knotwid, a2); + z4 = (.25w,.75h); + penpos4(knotwid, a2); + z5 = (.25w,.25h); + penpos5(knotwid, a3); + z6 = (w, .25h); + penpos6(knotwid, a3); + + llrrexp(7); + penstroke z1e---z2e{right}---z7e; + penstroke z3e---z4e---z5e{right}---z6e; +enddef; + +def foundation_right = + z0 = (.5w,h); + penpos0(croswid, a3); + z1 = z0; + penpos1(knotwid, a3); + z2 = (.75w,.75h); + penpos2(knotwid, a3); + z3 = (.75w,.25h); + penpos3(knotwid, a2); + z4 = (0w,.25h); + penpos4(knotwid, a1); + z5 = z0r; + penpos5(knotwid, a2); + z6 = (.25w,.75h); + penpos6(knotwid, a2); + z7 = (0w,.75h); + penpos7(knotwid, a2); + + llrrexp(7); + penstroke z1e---z2e---z3e{left}---z4e; + penstroke z5e---z6e{left}---z7e; +enddef; + +def foundation_ileft = + z0 = (.5w,h); + penpos0(croswid, a3); + z1 = z0; + penpos1(knotwid, a3); + z2 = z3r; + penpos2(knotwid, a3); + z3 = (w,.5h); + penpos3(croswid, a2); + z4 = z3; + penpos4(knotwid, a2); + z5 = (.75w,.25h); + penpos5(knotwid, a2); + z6 = (0w,.25h); + penpos6(knotwid, a1); + z7 = z0r; + penpos7(knotwid, a2); + z8 = (.25w,.75h); + penpos8(knotwid, a2); + z9 = (0w,.75h); + penpos9(knotwid, a2); + + llrrexp(9); + penstroke z1e---z2e; + penstroke z4e---z5e{left}---z6e; + penstroke z7e---z8e{left}---z9e; +enddef; + +def foundation_iright = + z0 = (.5w,h); + penpos0(croswid, a3); + z1 = z0; + penpos1(knotwid, a3); + z2 = (.75w,.75h); + penpos2(knotwid, a3); + z3 = (w,.75h); + penpos3(knotwid, a4); + z4 = z0r; + penpos4(knotwid, a2); + z5 = (0w,.5h); + penpos5(knotwid, a2); + z6 = z5; + penpos6(croswid, a2); + z7 = z6l; + penpos7(knotwid, a3); + z8 = (.25w,.25h); + penpos8(knotwid, a3); + z9 = (w,.25h); + penpos9(knotwid, a3); + + llrrexp(9); + penstroke z1e---z2e{right}---z3e; + penstroke z4e---z5e; + penstroke z7e---z8e{right}---z9e; +enddef; + +beginchar ("I", sqwid#, sqht#, 0); "found-b left"; + foundation_left; +endchar; + +beginchar ("J", sqwid#, sqht#, 0); "found-b right"; + foundation_right; +endchar; + +beginchar ("K", sqwid#, sqht#, 0); "found-b mid-l"; + foundation_ileft; +endchar; + +beginchar ("L", sqwid#, sqht#, 0); "found-b mid-r"; + foundation_iright; +endchar; + +beginchar ("M", sqwid#, sqht#, 0); "found-t right"; + foundation_left; + currentpicture := currentpicture rotated 180 shifted (w, h); +endchar; + +beginchar ("N", sqwid#, sqht#, 0); "found-b left"; + foundation_right; + currentpicture := currentpicture rotated 180 shifted (w, h); +endchar; + +beginchar ("O", sqwid#, sqht#, 0); "found-b mid-l"; + foundation_ileft; + currentpicture := currentpicture rotated 180 shifted (w, h); +endchar; + +beginchar ("P", sqwid#, sqht#, 0); "found-b mid-r"; + foundation_iright; + currentpicture := currentpicture rotated 180 shifted (w, h); +endchar; + +beginchar ("Q", sqwid#, sqht#, 0); "found-l top"; + foundation_left; + currentpicture := currentpicture rotated 270 shifted (0, h); +endchar; + +beginchar ("R", sqwid#, sqht#, 0); "found-l bot"; + foundation_right; + currentpicture := currentpicture rotated 270 shifted (0, h); +endchar; + +beginchar ("S", sqwid#, sqht#, 0); "found-l mid-t"; + foundation_ileft; + currentpicture := currentpicture rotated 270 shifted (0, h); +endchar; + +beginchar ("T", sqwid#, sqht#, 0); "found-l mid-b"; + foundation_iright; + currentpicture := currentpicture rotated 270 shifted (0, h); +endchar; + +beginchar ("U", sqwid#, sqht#, 0); "found-r bot"; + foundation_left; + currentpicture := currentpicture rotated 90 shifted (w, 0); +endchar; + +beginchar ("V", sqwid#, sqht#, 0); "found-r top"; + foundation_right; + currentpicture := currentpicture rotated 90 shifted (w, 0); +endchar; + +beginchar ("W", sqwid#, sqht#, 0); "found-r mid-b"; + foundation_ileft; + currentpicture := currentpicture rotated 90 shifted (w, 0); +endchar; + +beginchar ("X", sqwid#, sqht#, 0); "found-r mid-t"; + foundation_iright; + currentpicture := currentpicture rotated 90 shifted (w, 0); +endchar; diff --git a/fonts/knot/knot.mf b/fonts/knot/knot.mf new file mode 100644 index 0000000000..497d2977fe --- /dev/null +++ b/fonts/knot/knot.mf @@ -0,0 +1,37 @@ +mode_setup; + +scale# := 0.25pt#; +knotwid# = 8scale#; +croswid# = 1.25knotwid#; +thin# = 1scale#; +thick# = 2scale#; +sqwid# = 25scale#; +sqht# = 25scale#; +define_pixels(scale, thick, thin); +define_blacker_pixels(knotwid, croswid); +font_normal_space sqwid#; +def --- = .. tension 2 .. enddef; +numeric indist; +numeric knotstyle.ll, knotstyle.rr, knotstyle.l, knotstyle.r, knotstyle.c; +numeric knotstyle.solid; +% A knotstroke is composed of up to five strokes: l ll c rr r +% Each line can be drawn five ways. If knotstyle.x | | | | | +% is 0 it is not drawn, if it is 1 it is drawn with | | | | | +% the thin pen and if 2 it is drawn with the thick pen. | | | | | +% -1 and -2 undraw it with the thin & thick pen | | | | | +% respectively. knotstyle.solid can have four different | | | | | +% values. If it is zero, no solid filling is done. If | | | | | +% 1 then the stroke is filled from l to r. If it is |xxxxxxxxxxx| +% 2 it is filled from ll to rr. Lastly if it is | |xxxxxxx| | +% 3 it is filled from l to ll and rr to r. |x| | |x| + +indist := 1/4; +knotstyle.l = 1; +knotstyle.r = 1; +knotstyle.ll = 0; +knotstyle.rr = 0; +knotstyle.c = 0; +knotstyle.solid = 0; +input do2knots + +end. diff --git a/fonts/knot/knot.tex b/fonts/knot/knot.tex new file mode 100644 index 0000000000..9f37ad94bb --- /dev/null +++ b/fonts/knot/knot.tex @@ -0,0 +1,37 @@ +\documentstyle{article} +\font\knot=knot4 +\begin{document} +\begin{center} +BASIC KNOT:\\ +\bigskip +\knot CDB\hskip1cm\tt CDB\\\nointerlineskip +\knot FHG\hskip1cm\tt FHG\\\nointerlineskip +\knot @EA\hskip1cm\tt @EA\\ +\bigskip +SOLOMAN KNOT:\\ +\bigskip +\knot NPOM\hskip1cm\tt NPOM\\\nointerlineskip +\knot FHHG\hskip1cm\tt FHHG\\\nointerlineskip +\knot IKLJ\hskip1cm\tt IKLJ\\ +\bigskip +\knot QDV\hskip1cm\tt QDV\\\nointerlineskip +\knot SHX\hskip1cm\tt SHX\\\nointerlineskip +\knot THW\hskip1cm\tt THW\\\nointerlineskip +\knot REU\hskip1cm\tt REU\\ +\bigskip +INTERLACED KNOT:\\ +\bigskip +\knot CD`DB\hskip1cm\tt CD`DB\\\nointerlineskip +\knot FHeHG\hskip1cm\tt FHeHG\\\nointerlineskip +\knot bgHfc\hskip1cm\tt bgHfc\\\nointerlineskip +\knot FHdHG\hskip1cm\tt FHdHG\\\nointerlineskip +\knot @EaEA\hskip1cm\tt @EaEA\\ +SQURES :\\ +\bigskip +\knot :??;\hskip1cm\tt :??;\\\nointerlineskip +\knot >01>\hskip1cm\tt >01>\\\nointerlineskip +\knot >23>\hskip1cm\tt >23>\\\nointerlineskip +\knot >45>\hskip1cm\tt >45>\\\nointerlineskip +\knot CDDD`DDDDDDDDD`DDDB> +>FHEEaEEHEEEHEEaEEHG> +>FG:???;FV1QG:???;FG> +>FG>CDB>FX2SG>CDB>FG> +>bc>FHA>FW3TG>@HG>bc> +>FG>@A:=FU4RG<;@A>FG> +>FG +>FHDDDDHHHHHHHDDDDHG> +>FHEEEEHHEEEHHEEEEHG> +>FGNPOMFG:?;FGNPOMFG> +>FHHHHHHG>5>FHHHHHHG> +>FGIKLJFG +>FHDDDDHHDDDHHDDDDHG> +>FHEEEEHHHHHHHEEEEHG> +>FG:??;@HEEEHA:??;FG> +>FG>CB<;FV4QG:=CB>FG> +>FG>FHB>FX3SG>CHG>FG> +>bc>@EA>FW2TG>@EA>bc> +>FG +>FHDD`DDHDDDHDD`DDHG> +>@EEEaEEEEEEEEEaEEEA> +