From eb97ff53e2ab83edbde770b61bcbb876268f82ad Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 5 Feb 2005 07:08:27 +0000 Subject: [PATCH] * mf/feta-autometric.mf (fet_beginchar): Check whether `feta_group' is defined. * mf/feta-alphabet.mf: Define `staffsize#'. Include `feta-params.mf'. s/staffheight/design_size/. * mf/feta-alphabet??.mf: s/staffheight/design_size/. * mf/feta-alphabet26.mf: Fix a serious bug (design size off by 8pt). * mf/feta-nummer-code.mf: Reformatted. (draw_six): Use outline intersection to avoid a self-intersecting path. ("Numeral comma"): Fix serious outline glitches. This slightly changes the glyph shape. ("Numeral dash"): Use `draw_rounded_block'. ("Numeral dot"): Use `drawdot'. ("Numeral 1"): Assure identical tangent directions for the intersection points of paths. The glyph shape improvement is only visible at very high magnifications. ("Numeral 2"): Use `solve' macro to make the lower right part of the glyph outline touch the x axis exactly. This changes the glyph shape. Minor fixes for better overlap removal support. ("Numeral 4"): Make lefter corner `rounder'. ("Numeral 5"): Assure identical tangent directions for the intersection points of paths. This improves the glyph shape at high magnifications. ("Numeral 7"): Use `solve' macro to make the upper right part of the glyph outline touch the metrics box exactly. This changes the glyph shape. Avoid corner in the upper left part of the glyph (causing a minor shape change). * mf/feta-ital-*.mf: Removed. Unused. --- ChangeLog | 39 ++ mf/feta-alphabet.mf | 15 +- mf/feta-alphabet11.mf | 2 +- mf/feta-alphabet13.mf | 2 +- mf/feta-alphabet14.mf | 2 +- mf/feta-alphabet16.mf | 2 +- mf/feta-alphabet18.mf | 2 +- mf/feta-alphabet20.mf | 2 +- mf/feta-alphabet23.mf | 4 +- mf/feta-alphabet26.mf | 2 +- mf/feta-autometric.mf | 7 +- mf/feta-ital-f.mf | 40 -- mf/feta-ital-m.mf | 37 -- mf/feta-ital-p.mf | 29 - mf/feta-ital-r.mf | 27 - mf/feta-ital-s.mf | 34 -- mf/feta-ital-z.mf | 29 - mf/feta-nummer-code.mf | 1198 ++++++++++++++++++++++++---------------- 18 files changed, 786 insertions(+), 687 deletions(-) delete mode 100644 mf/feta-ital-f.mf delete mode 100644 mf/feta-ital-m.mf delete mode 100644 mf/feta-ital-p.mf delete mode 100644 mf/feta-ital-r.mf delete mode 100644 mf/feta-ital-s.mf delete mode 100644 mf/feta-ital-z.mf diff --git a/ChangeLog b/ChangeLog index 4a4ad15932..889a96e556 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2005-02-05 Werner Lemberg + + * mf/feta-autometric.mf (fet_beginchar): Check whether `feta_group' + is defined. + + * mf/feta-alphabet.mf: Define `staffsize#'. + Include `feta-params.mf'. + s/staffheight/design_size/. + + * mf/feta-alphabet??.mf: s/staffheight/design_size/. + + * mf/feta-alphabet26.mf: Fix a serious bug (design size off by 8pt). + + * mf/feta-nummer-code.mf: Reformatted. + (draw_six): Use outline intersection to avoid a self-intersecting + path. + ("Numeral comma"): Fix serious outline glitches. This slightly + changes the glyph shape. + ("Numeral dash"): Use `draw_rounded_block'. + ("Numeral dot"): Use `drawdot'. + ("Numeral 1"): Assure identical tangent directions for the + intersection points of paths. The glyph shape improvement is only + visible at very high magnifications. + ("Numeral 2"): Use `solve' macro to make the lower right part of + the glyph outline touch the x axis exactly. This changes the + glyph shape. + Minor fixes for better overlap removal support. + ("Numeral 4"): Make lefter corner `rounder'. + ("Numeral 5"): Assure identical tangent directions for the + intersection points of paths. This improves the glyph shape at + high magnifications. + ("Numeral 7"): Use `solve' macro to make the upper right part of + the glyph outline touch the metrics box exactly. This changes the + glyph shape. + Avoid corner in the upper left part of the glyph (causing a minor + shape change). + + * mf/feta-ital-*.mf: Removed. Unused. + 2005-02-04 Han-Wen Nienhuys * input/regression/fill-line-test.ly: new file. diff --git a/mf/feta-alphabet.mf b/mf/feta-alphabet.mf index a4b672ab90..c3d1f09f97 100644 --- a/mf/feta-alphabet.mf +++ b/mf/feta-alphabet.mf @@ -1,20 +1,19 @@ +test := 0; - -test:=0; +staffsize# := design_size * pt#; input feta-autometric; input feta-macros; +input feta-params; -fet_beginfont("feta-alphabet", staffheight, "fetaNumber"); +fet_beginfont ("feta-alphabet", design_size, "fetaNumber"); mode_setup; -number_design_size := staffheight/2; -dynamic_design_size := 14 staffheight / 20; - +number_design_size := design_size / 2; +dynamic_design_size := 14 design_size / 20; input feta-nummer-code; input feta-din-code; -fet_endfont("feta-nummer"); - +fet_endfont ("feta-nummer"); diff --git a/mf/feta-alphabet11.mf b/mf/feta-alphabet11.mf index 3e1ae1404a..04ba4e3867 100644 --- a/mf/feta-alphabet11.mf +++ b/mf/feta-alphabet11.mf @@ -1,6 +1,6 @@ % part of LilyPond's pretty-but-neat music font -staffheight := 11.22; +design_size := 11.22; input feta-alphabet; end. diff --git a/mf/feta-alphabet13.mf b/mf/feta-alphabet13.mf index 93d286a378..d314f40d4d 100644 --- a/mf/feta-alphabet13.mf +++ b/mf/feta-alphabet13.mf @@ -1,6 +1,6 @@ % part of LilyPond's pretty-but-neat music font -staffheight := 12.60; +design_size := 12.60; input feta-alphabet; end. diff --git a/mf/feta-alphabet14.mf b/mf/feta-alphabet14.mf index 58cbf2b3b6..9a1bd2ee71 100644 --- a/mf/feta-alphabet14.mf +++ b/mf/feta-alphabet14.mf @@ -1,6 +1,6 @@ % part of LilyPond's pretty-but-neat music font -staffheight := 14.14; +design_size := 14.14; input feta-alphabet; end. diff --git a/mf/feta-alphabet16.mf b/mf/feta-alphabet16.mf index b5f7691adc..86eb9c8c89 100644 --- a/mf/feta-alphabet16.mf +++ b/mf/feta-alphabet16.mf @@ -1,6 +1,6 @@ % part of LilyPond's pretty-but-neat music font -staffheight := 15.87; +design_size := 15.87; input feta-alphabet; end. diff --git a/mf/feta-alphabet18.mf b/mf/feta-alphabet18.mf index 488b381bd7..db216c154b 100644 --- a/mf/feta-alphabet18.mf +++ b/mf/feta-alphabet18.mf @@ -1,6 +1,6 @@ % part of LilyPond's pretty-but-neat music font -staffheight := 17.82; +design_size := 17.82; input feta-alphabet; end. diff --git a/mf/feta-alphabet20.mf b/mf/feta-alphabet20.mf index 708f91ca0e..0affe39057 100644 --- a/mf/feta-alphabet20.mf +++ b/mf/feta-alphabet20.mf @@ -1,7 +1,7 @@ % feta-alphabet20.mf % part of LilyPond's pretty-but-neat music font -staffheight := 20; +design_size := 20; input feta-alphabet; end. diff --git a/mf/feta-alphabet23.mf b/mf/feta-alphabet23.mf index c0b678bf14..c8a725e59e 100644 --- a/mf/feta-alphabet23.mf +++ b/mf/feta-alphabet23.mf @@ -1,7 +1,7 @@ -% feta-alphabet20.mf +% feta-alphabet23.mf % part of LilyPond's pretty-but-neat music font -staffheight := 22.45; +design_size := 22.45; input feta-alphabet; end. diff --git a/mf/feta-alphabet26.mf b/mf/feta-alphabet26.mf index 488b381bd7..71af0403f9 100644 --- a/mf/feta-alphabet26.mf +++ b/mf/feta-alphabet26.mf @@ -1,6 +1,6 @@ % part of LilyPond's pretty-but-neat music font -staffheight := 17.82; +design_size := 25.20; input feta-alphabet; end. diff --git a/mf/feta-autometric.mf b/mf/feta-autometric.mf index 0d9f035869..0181d0746c 100644 --- a/mf/feta-autometric.mf +++ b/mf/feta-autometric.mf @@ -203,7 +203,12 @@ def fet_beginchar (expr name, id_lit) = % addition for mf2pt1 if known bp_per_pixel: - special "% MF2PT1: glyph_name " & feta_group & "." & idstr; + if known feta_group: + special "% MF2PT1: glyph_name " + & feta_group & "." & idstr; + else: + special "% MF2PT1: glyph_name " & idstr; + fi; fi; no_dimen_beginchar (incr code) name; diff --git a/mf/feta-ital-f.mf b/mf/feta-ital-f.mf deleted file mode 100644 index a0800cf0f0..0000000000 --- a/mf/feta-ital-f.mf +++ /dev/null @@ -1,40 +0,0 @@ -% ital-f.mf -% from itall.mf -% -% Computer Modern Italic lower case: -% This lowercase italic alphabet was prepared by D. E. Knuth in December, 1979, -% inspired by the Monotype faces used in {\sl The Art of Computer Programming}. -% The programs were revised for the new \MF\ conventions in 1985. - -% Character codes \0141 through \0172 are generated. -% not - -% cmchar "Italic letter f"; -% beginchar("f",max(1.5u#,stem#)+max(3.5u#,2flare#),asc_height#,desc_depth#); -"Dynamic letter f"; -beginchar(fcode ,max(1.5u#,stem#)+max(3.5u#,2flare#),asc_height#,desc_depth#); - -italcorr asc_height#*slant+.75u#; -adjust_fit(if monospace:u#,u# else: 0,0 fi); pickup fine.nib; -numeric theta; z88=(.5w-.5u,h); z89=(.5w+.5u,-d); theta=angle(z88-z89); -pos0(flare,0); pos1(hair,0); pos2(vair,90); -pos3(.5[hair,stem],180); pos4(stem,theta+90); -pos5(stem,theta-90); pos6(.5[hair,stem],0); -pos7(vair,-90); pos8(hair,-180); pos9(flare,-180); -rt x1r=hround(w+.25u); lft x8r=hround-.35u; x2=.6[x1,x4]; x7=.6[x8,x5]; -y9-.5flare=vround -.85d; y2-y0=y9-y7; top y2r=h+oo; bot y7r=-d-oo; -% y4=.25[x_height,h]; y5=.5[-d,y4]; -y4=x_height-.5bar; y5=y4; -z4=whatever[z88,z89]; z5=whatever[z88,z89]; -x3=.8[x2+x4-x88,x88]; x6=.8[x7+x5-x89,x89]; y3=.8[y4,y2]; y6=.8[y5,y7]; -bulb(2,1,0); bulb(7,8,9); % bulbs -filldraw stroke z2e{left}...z3e...{z89-z88}z4e; % upper arc -filldraw z4r--z5l--z5r--z4l--cycle; % stem -filldraw stroke z5e{z89-z88}...z6e...{left}z7e; % lower arc -pickup crisp.nib; pos20(bar,90); pos21(bar,90); -top y20r=top y21r=x_height; -%lft x20=lft x4r-.5stem-u; rt x21=rt x4l+.5stem+1.5u; -lft x20=lft x4r-.5stem-xbar; rt x21=rt x4l+.5stem+1.5xbar; -filldraw stroke z20e--z21e; % crossbar -math_fit(desc_depth#*slant+u#,x_height#*slant); -penlabels(0,1,2,3,4,5,6,7,8,9,20,21,88,89); endchar; diff --git a/mf/feta-ital-m.mf b/mf/feta-ital-m.mf deleted file mode 100644 index 73f1a8abc8..0000000000 --- a/mf/feta-ital-m.mf +++ /dev/null @@ -1,37 +0,0 @@ -% ital-m.mf -% from itall.mf -% -% Computer Modern Italic lower case: -% This lowercase italic alphabet was prepared by D. E. Knuth in December, 1979, -% inspired by the Monotype faces used in {\sl The Art of Computer Programming}. -% The programs were revised for the new \MF\ conventions in 1985. - -% Character codes \0141 through \0172 are generated. -% not - -% cmchar "Italic letter m"; -% beginchar("m",15u#,x_height#,0); -\"Dynamic letter m\"; -% beginchar(incr num,15u#,x_height#,0); -beginchar( 109 ,12u#, asc_height#,0); - -italcorr 1/3x_height#*slant+.5hair#+.5u#; -adjust_fit(if monospace:-1.5u#,-2u# else: 0,0 fi); pickup fine.nib; -numeric shaved_stem; shaved_stem=mfudged.stem; -save stem; stem=shaved_stem; -pos2(stem,0); x1=x2; -if monospace: pos1(stem,0); lft x1l=hround(2.5u-.5stem); top y1=h; -else: x0=0; lft x2l=hround(2.5u-.5stem); - hook_in(0,a,1); fi % opening hook -y2-.5stem=-oo; filldraw circ_stroke z2e--z1e; % left stem -x4+.5stem=hround(.5w+.5stem); ital_arch(2,3,4); % left arch -pos5(stem,0); y5=y2; x5=x4; -filldraw circ_stroke z5e--z4e; % middle stem -x7+.5stem=hround(w-2.5u+.5stem); -x8=x7-.25u; ital_arch(5,6,7); % right arch -if monospace: pos9(vair,90); x9=good.x .5[x8,w]; bot y9l=0; y8=1/3h; - pos8(stem,0); filldraw stroke z8e{-u,-x_height}...{right}z9e; % terminal -else: x9=w; hook_out(8,b,9)(skewed); fi % closing hook -filldraw stroke z7e{down}..{-u,-x_height}z8e; % right stem -math_fit(-2/3x_height#*slant+.5hair#+.5u#,ic#); -penlabels(0,a,1,2,3,4,5,6,7,8,9); endchar; diff --git a/mf/feta-ital-p.mf b/mf/feta-ital-p.mf deleted file mode 100644 index a1320364fe..0000000000 --- a/mf/feta-ital-p.mf +++ /dev/null @@ -1,29 +0,0 @@ -% ital-p.mf -% from itall.mf -% -% Computer Modern Italic lower case: -% This lowercase italic alphabet was prepared by D. E. Knuth in December, 1979, -% inspired by the Monotype faces used in {\sl The Art of Computer Programming}. -% The programs were revised for the new \MF\ conventions in 1985. - -% Character codes \0141 through \0172 are generated. -% not - -% cmchar "Italic letter p"; -% beginchar("p",9u#,x_height#,desc_depth#); -"Dynamic letter p"; -beginchar(112, 9u#,x_height#,desc_depth#); -italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi; -adjust_fit(0,0); pickup fine.nib; -x0=0; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2); % opening hook -pos4(hair,-180); pos5(vair,-90); pos6(curve,0); pos7(vair,90); -x4=x2; rt x6r=hround(w-1.5u+.5curve); x5=x7=.5[x4,x6]; -bot y5r=-oo; top y7r=h+oo; y4=y6=.5[y5,y7]; -filldraw stroke super_arc.e(4,5) & pulled_arc.e(5,6) - & pulled_arc.e(6,7) & super_arc.e(7,4); % bowl -pickup tiny.nib; pos2'(stem,0); pos3(stem,0); -z2=z2'; x3=x2; bot y3=-d; filldraw stroke z2'e--z3e; % stem -dish_serif(3,2',a,1/3,.75jut,b,1/3,jut); % serif -math_fit(-min(2/3x_height#*slant-.5hair#-.5u#, - 2u#-.5stem#-desc_depth#*slant),ic#); -penlabels(0,1,2,3,4,5,6,7); endchar; diff --git a/mf/feta-ital-r.mf b/mf/feta-ital-r.mf deleted file mode 100644 index b5a5e67a53..0000000000 --- a/mf/feta-ital-r.mf +++ /dev/null @@ -1,27 +0,0 @@ -% ital-r.mf -% from itall.mf -% -% Computer Modern Italic lower case: -% This lowercase italic alphabet was prepared by D. E. Knuth in December, 1979, -% inspired by the Monotype faces used in {\sl The Art of Computer Programming}. -% The programs were revised for the new \MF\ conventions in 1985. - -% Character codes \0141 through \0172 are generated. -% not - -% cmchar "Italic letter r"; -% beginchar("r",5.5u#+max(1.75u#,flare#),x_height#,0); -"Dynamic letter r"; -beginchar( 114 ,5.5u#+max(1.75u#,flare#),x_height#,0); - -italcorr x_height#*slant; -adjust_fit(if monospace:.25u#,.5u# else: 0,0 fi); pickup fine.nib; -x0=0; x2=x3; pos3(stem,0); lft x3l=hround(2.5u-.5stem); y3-.5stem=-oo; -hook_in(0,1,2); % opening hook -filldraw circ_stroke z3e--z2e; % left stem -pos3'(hair,180); z3'=z3; pos4(vair,90); pos5(hair,0); pos6(flare,0); -x4=w-.5u-max(1.75u,flare); rt x5r=hround(r-.5u); top y4r=h+oo; -filldraw stroke z3'e{up}...z4e{right}; % link -y6+.5flare=vround(bot y4l-.03x_height); bulb(4,5,6); % bulb -math_fit(-2/3x_height#*slant+.5hair#+.5u#,ic#-.5u#); -penlabels(0,1,2,3,4,5,6); endchar; diff --git a/mf/feta-ital-s.mf b/mf/feta-ital-s.mf deleted file mode 100644 index 31bbe575c1..0000000000 --- a/mf/feta-ital-s.mf +++ /dev/null @@ -1,34 +0,0 @@ -% ital-s.mf -% from itall.mf -% -% Computer Modern Italic lower case: -% This lowercase italic alphabet was prepared by D. E. Knuth in December, 1979, -% inspired by the Monotype faces used in {\sl The Art of Computer Programming}. -% The programs were revised for the new \MF\ conventions in 1985. - -% Character codes \0141 through \0172 are generated. -% not - -% cmchar "Italic letter s"; -% beginchar("s",5.25u#+max(1.75u#,flare#),x_height#,0); -"Dynamic letter s"; -beginchar(115 ,5.25u#+max(1.75u#,flare#),x_height#,0); -italcorr x_height#*slant-.5u#; -adjust_fit(0,0); pickup fine.nib; -numeric theta; theta=90-angle(40u,h); slope:=-h/40u; % angle at middle -pos2(vair,-90); pos0(max(fine.breadth,ess),theta); pos7(vair,-90); -x2l=x0=x7=.5w; top y2l=h+oo; bot y7r=-oo; -y0-.5ess=y7l+.55(y2r-y7l-ess); -lft x3l=hround u-eps; rt x6r=hround(w-.5u)+eps; -x3r-x3l=x6r-x6l=hround .5[vair,ess]-fine; -ellipse_set(2l,3l,4l,0l); ellipse_set(2r,3r,4r,0r); y3=y3r; -ellipse_set(7l,6l,5l,0l); ellipse_set(7r,6r,5r,0r); y6=y6r; -interim superness:=more_super; -filldraw stroke super_arc.e(2,3) & z3e{down} - ..z4e---z5e..z6e{down} & super_arc.e(6,7); % main stroke -pos1(hair,0); pos10(hround .75[hair,flare],0); -pos2'(vair,90); z2'=z2; -pos8(hair,-180); pos9(flare,-180); -rt x10r=hround(w-u)+2eps; lft x9r=hround .5u-2eps; y10=.78h; y9=.25h; -bulb(2',1,10); bulb(7,8,9); % bulbs -math_fit(0,ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar; diff --git a/mf/feta-ital-z.mf b/mf/feta-ital-z.mf deleted file mode 100644 index ba11a2b047..0000000000 --- a/mf/feta-ital-z.mf +++ /dev/null @@ -1,29 +0,0 @@ -% ital-z.mf -% from itall.mf -% -% Computer Modern Italic lower case: -% This lowercase italic alphabet was prepared by D. E. Knuth in December, 1979, -% inspired by the Monotype faces used in {\sl The Art of Computer Programming}. -% The programs were revised for the new \MF\ conventions in 1985. - -% Character codes \0141 through \0172 are generated. -%not - -% cmchar "Italic letter z"; -% beginchar("z",5.5u#+max(1.5u#,stem#),x_height#,0); -\"Dynamic letter z"; -beginchar(122,5.5u#+max(1.5u#,stem#),x_height#,0); -italcorr x_height#*slant+.5hair#; -adjust_fit(if monospace:.5u#,.5u# else: 0,0 fi); pickup fine.nib; -pos1(hair,0); pos2(stem,-90); pos3(vair,-90); pos4(hair,0); -lft x1l=hround(u-.5hair); x2=2.5u; x3=w-2u; rt x4r=hround(w-.5u); -top y1=.78h; top y2l=top y4=h+oo; y3=.825h; -pos5(hair,0); pos6(vair,-90); pos7(stem,-90); pos8(hair,0); -x5=x1; x6=2.5u; x7=w-2u; x8+.5hair=hround(w+.5hair-eps); -bot y5=bot y7r=-oo; y6=.175h; bot y8=.31h; -pair p; p=(z4-z5) yscaled 2; -filldraw stroke z1e{up}...z2e{right}..z3e{right}...{p}z4e; % upper bar -filldraw stroke z5e{p}...z6e{right}..{right}z7e...{up}z8e; % lower bar -filldraw stroke z5e{p}..{p}z4e; % diagonal -math_fit(0,1/3x_height#*slant+.5hair#+.5u#); -penlabels(1,2,3,4,5,6,7,8); endchar; diff --git a/mf/feta-nummer-code.mf b/mf/feta-nummer-code.mf index 3ba0ab25dc..1c1fa6d2ff 100644 --- a/mf/feta-nummer-code.mf +++ b/mf/feta-nummer-code.mf @@ -3,13 +3,12 @@ % part of LilyPond's pretty-but-neat music font % % source file of the Feta (not the Font-En-Tja) music font -% +% % (c) 1997--2005 Jan Nieuwenhuizen - -height#:= number_design_size; -space# := number_design_size/2; +height# := number_design_size; +space# := number_design_size / 2; font_x_height height#; font_normal_space space#; @@ -17,605 +16,858 @@ font_normal_space space#; % % DOCME! -%ugh. b and h are reused. +% +% ugh. b and h are reused. % -save b,h; 4h+b=1.15; 10h+b=1; -fatten:=number_design_size*h+b; - -save b,h; 4h+b=1.05; 10h+b=1; -widen:=number_design_size*h+b; +save b, h; +4h + b = 1.15; +10h + b = 1; +fatten := number_design_size * h + b; -tense=0.85; -thick#:=7/30height#*fatten; -thin#:=thick#/4*fatten + max(.1 (height# / 10 - 1), 0); +save b, h; +4h + b = 1.05; +10h + b = 1; +widen := number_design_size * h + b; -%% sqrt(.8 * blot_diameter#* thin#) ; -hair#:= thin# * .8 ; +tense = 0.85; +thick# := 7/30 height# * fatten; +thin# := thick# / 4 * fatten + max (.1 (height# / 10 - 1), 0); +%% sqrt (.8 * blot_diameter# * thin#); +hair# := thin# * .8; -flare#:=9/8 thick# + .75 (height# / 10 - 1); +flare# := 9/8 thick# + .75 (height# / 10 - 1); -save b,h; 4h+b=1/8; 10h+b=1/6; -kuulleke#:=thick#*number_design_size*h+b; -foot_top#:=thick#; -foot_width#:=9/4thick#; +save b, h; +4h + b = 1/8; +10h + b = 1/6; +kuulleke# := thick# * number_design_size * h + b; +foot_top# := thick#; +foot_width# := 9/4 thick#; % % These numbers were taken from a part that that the EJE violas played -% 1997 -- Probably Mendelssohn's ouverture Heimkehr aus der Fremde. +% 1997 -- Probably Mendelssohn's ouverture `Heimkehr aus der Fremde'. % + % -% TODO all the invocation of flare_path are weird -- -% the horizontal tangents should be more at the center of the +% TODO all the invocation of flare_path are weird -- +% the horizontal tangents should be more at the center of the % glyph. % -define_pixels(height,thick,thick,thin,hair,flare); -define_pixels(foot_top,foot_width); -define_pixels(kuulleke); +define_pixels (height, thick, thick, thin, hair, flare); +define_pixels (foot_top, foot_width); +define_pixels (kuulleke); + % % Yet Another Bulb Routine with smooth inside curve. % % alpha = start direction. -% beta = which side to turn to. +% beta = which side to turn to % flare = diameter of the bulb % line = diameter of line attachment % direction = is ink on left or right side (1 or -1) % - -% -% move_away_to = amount left (for 2) +% +% move_away_to = amount left (for 2) % turn_to = amount down (for 2 ) -% -def number_flare_path(expr pos,alpha,beta,line,flare, +% + +def number_flare_path (expr pos, alpha, beta, line, flare, + move_away_to, turn_to, taille, taille_ratio, + direction) = +begingroup; + save res; + path res; - move_away_to, - turn_to, taille, taille_ratio, - direction) = - begingroup; clearxy; -% z5 = z2 + 0.43* flare *dir (alpha - 1.5 beta); +% z5 = z2 + 0.43 * flare * dir (alpha - 1.5 beta); - z4 = (0.75 - taille) [z2r, z2l] + whatever* dir (alpha - beta) ; - z4 = (taille_ratio * taille) [z3l, z3r] + whatever* dir(alpha); - penpos1(line,180+beta+alpha); - z1r=pos; + z4 = (0.75 - taille) [z2r, z2l] + whatever * dir (alpha - beta); + z4 = (taille_ratio * taille) [z3l, z3r] + whatever * dir (alpha); - z2r = z1r + move_away_to *dir (alpha) + (line + turn_to) * dir(alpha+beta); - z3r = 0.5 [z2l,z2r] + 0.5 *flare *dir(alpha + beta); + z1r = pos; + z2r = z1r + move_away_to * dir (alpha) + + (line + turn_to) * dir (alpha + beta); + z3r = 0.5 [z2l, z2r] + 0.5 * flare * dir (alpha + beta); - penpos2(flare, alpha ); - penpos3(flare, alpha + beta); - penlabels(1, 2, 3, 4, 5); - pickup pencircle; + penpos1 (line, 180 + beta + alpha); + penpos2 (flare, alpha ); + penpos3 (flare, alpha + beta); - save p; - path p; - p := z1r{dir(alpha)} - .. z2r{dir(180+alpha-beta)} - .. z3r{dir(alpha+180)} - .. z2l{dir(alpha-beta)} + penlabels (1, 2, 3, 4, 5); + res := z1r{dir (alpha)} + .. z2r{dir (180 + alpha - beta)} + .. z3r{dir (alpha + 180)} + .. z2l{dir (alpha - beta)} %%% Two versions of the curve: one with z4, the other with z5. -% .. z5{dir(alpha- beta/2 )} - ..z4{dir(180+alpha+beta)} - ..z1l{dir(alpha+180)}; -% draw p ; - if direction = 1: - p - else: - reverse p - fi - endgroup - enddef; +% .. z5{dir (alpha - beta / 2)} + .. z4{dir (180 + alpha + beta)} + .. z1l{dir (alpha + 180)}; +% pickup pencircle; +% draw res; -def calc_kuulleke(expr w,alpha) = - begingroup; - save beta; beta=(alpha-90)/2; - save gamma; gamma=(90+alpha)/2; + if direction <> 1: + res := reverse res; + fi; - penpos1(w/cosd(alpha),alpha); - penpos2(hair,90+beta); - z2=z1l+(1/2hair/tand((alpha+90)/2))*dir(beta); +res +endgroup +enddef; - penpos3(hair,gamma-90); - z3=z1r-(1/2hair/tand((90-alpha)/2))*dir(gamma); - z4=z1+kuulleke*dir(alpha-90); - endgroup; - enddef; -% should make generic macro? +def calc_kuulleke (expr w, alpha) = +begingroup; + save beta, gamma; + + beta = (alpha - 90) / 2; + gamma = (90 + alpha) / 2; + + penpos1 (w / cosd (alpha), alpha); + penpos2 (hair, 90 + beta); + penpos3 (hair, gamma - 90); + + z2 = z1l + (1/2 hair / tand ((alpha + 90) / 2)) * dir (beta); + z3 = z1r - (1/2 hair / tand ((90 - alpha) / 2)) * dir (gamma); + z4 = z1 + kuulleke * dir (alpha - 90); +endgroup; +enddef; + + +% should make generic macro? % -def draw_foot(expr xpos) = - begingroup; +def draw_foot(expr xpos) = +begingroup; clearxy; - penpos1(thick,0); - z1=(xpos,foot_top); - penpos2(foot_width,0); - z2=(x1,0); - penpos3(hair,-90); - z3r=z2r; - penpos4(hair,90); - z4l=z2l; - z5=(x1,kuulleke); - penlabels(1,2,3,4); - fill z1..{right}z1r{down}..{right}z3l..z3r{left}..z5 - ..{left}z4l..z4r{right}..{up}z1l{right}..z1..cycle; - endgroup; - enddef; + + penpos1 (thick, 0); + penpos2 (foot_width, 0); + penpos3 (hair, -90); + penpos4 (hair, 90); + + z1= (xpos, foot_top); + z2= (x1, 0); + z3r = z2r; + z4l = z2l; + z5 = (x1, kuulleke); + + penlabels (1, 2, 3, 4); + + fill z1 + .. {right}z1r{down} + .. {right}z3l + .. z3r{left} + .. z5 + .. {left}z4l + .. z4r{right} + .. {up}z1l{right} + .. z1 + .. cycle; +endgroup; +enddef; + def draw_six = - set_char_box(0, .68 height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; + save outer_t, t; + save before, after, u, v; + path before, after; - penpos1(thin,90); - z1=(thick,h/2+thin-hair/2); - penpos2(hair,90); - - z2=(w/2,y1); + set_char_box (0, .68 height# * widen, 0, height#); - penpos3 (15/16 thick,0); - % yup, should use the path fract [] "everywhere" - x3r=w; + message "w:" & decimal w; + message "h:" & decimal h; + + penpos2 (hair, 90); + z2 = (w / 2, h / 2 + thin - hair / 2); + + penpos3 (15/16 thick, 0); + x3r = w; y3r = .5 [y4r, y2r]; - penpos4(hair,-90); - z4r=(x2,0); - penpos6(hair,90); + + penpos4 (hair, -90); + z4r = (x2, 0); + + penpos6 (hair, 90); x6r = .56 w; y6r = h; - penpos7(thick,180); - x7r=0; + penpos7 (thick, 180); + x7r = 0; y7r = .50 h; - penpos10(thick,180); - z10r=(0,y3); - penlabels(1,2,3,4,5,6,7,8,9,10,11); + penpos10 (thick, 180); + z10r = (0, y3); + + penlabels (range 1 thru 10); + + outer_t = 0.88; + t := tense; + before := z7{right} + .. z2r{right}; + after := z7r{up} + .. number_flare_path (z6r, 0, -90, hair, flare, + w - x6r - hair / 2, .16 h, + 0.05, 2.5, 1) + .. z7l{down}; + (u, v) = before intersectiontimes after; - save outer_t; outer_t= 0.88; - save t ; t := tense; - fill % draw - z7{right}..z2r{right} - ..tension outer_t - ..z3r{down} - ..tension outer_t - ..z4r{left} -% ..tension t - ..z7r{up} -% .. flare_path (z6r,0,-90,hair,flare, 1) - .. number_flare_path (z6r, 0,-90,hair,flare, - w - x6r -hair/2, .16 h, 0.05, 2.5, 1) - -% ..tension t - ..z7l{down} - .. {down}z10l -- cycle; - - unfill z2l{right}..tension t..z3l{down}..tension t - ..z4l{left}..tension t..z10l{up}..tension t..cycle; - enddef; + fill subpath (u, infinity) of before + ..tension outer_t.. z3r{down} + ..tension outer_t.. z4r{left} + .. subpath (0, v) of after + .. cycle; + + unfill z2l{right} + ..tension t.. z3l{down} + ..tension t.. z4l{left} + ..tension t.. z10l{up} + ..tension t.. cycle; +enddef; + save dot_diam; -dot_diam# = 7/8flare#; -define_pixels(dot_diam); +dot_diam# = 7/8 flare#; +define_pixels (dot_diam); + + +code := 31; % , 32 -code := 31; % , 32 -fet_beginchar("Space", "space") - set_char_box(0, space#, 0,height#); +fet_beginchar ("Space", "space"); + set_char_box (0, space#, 0, height#); fet_endchar; -code := 43; % , = 44 -% urg -fet_beginchar("Numeral comma", "comma") - set_char_box(0, dot_diam#, 3/2dot_diam#, dot_diam#); - pickup pencircle scaled dot_diam; - draw (dot_diam/2,dot_diam/2); - z0=(w/3,0); - alpha=65; - penpos1(thin,alpha+90); - z1l=(w/2,-1.5h+hair); - z2=(w,h/2); - pickup pencircle; - filldraw z1l{dir(alpha)}..{up}z2..{z0-z2}z0{right}..{dir(180+alpha)}z1r..cycle; - labels(0,1,2); - penlabels(1); +code := 43; % , = 44 + +fet_beginchar ("Numeral comma", "comma"); + save pat, pos; + path pat; + + set_char_box (0, dot_diam#, 3/2 dot_diam#, dot_diam#); + + pat := (dot_diam / 2, 0) + .. (dot_diam, dot_diam / 2) + .. (dot_diam / 2, dot_diam) + .. (0, dot_diam / 2) + .. cycle; + + pos = ypart (((w / 3, 0) -- (w / 3, dot_diam / 2)) + intersectiontimes pat); + z0 = point pos of pat; + + alpha = 65; + penpos1 (thin, alpha + 90); + + z1l = (w / 2, -1.5 h + hair); + z2 = (w, h / 2); + + pickup feta_fillpen; + + % include z0 to assist removal of overlaps + fill subpath (0,3) of pat + .. z0 + .. cycle; + filldraw z1l{dir(alpha)} + .. {up}z2 + -- z0{direction pos of pat} + ..tension 0.95.. {dir (180 + alpha)}z1r + .. cycle; + + labels (0, 2); + penlabels (1); fet_endchar; -fet_beginchar("Numeral dash", "hyphen") - set_char_box(0, height#/3, 0, height#); - pickup pencircle scaled thin; - lft x1 = -b; - rt x2 = w; - y1 = y2 = h/3; - draw z1 .. z2; + +fet_beginchar ("Numeral dash", "hyphen"); + set_char_box (0, height# / 3, 0, height#); + + draw_rounded_block ((-b, h / 3 - thin / 2), + (w, h / 3 + thin / 2), thin); fet_endchar; -fet_beginchar("Numeral dot", "period") - set_char_box(0, dot_diam#, 0, dot_diam#); + +fet_beginchar ("Numeral dot", "period"); + set_char_box (0, dot_diam#, 0, dot_diam#); + pickup pencircle scaled dot_diam; - draw (dot_diam/2,dot_diam/2); + + drawdot (dot_diam / 2, dot_diam / 2); fet_endchar; % skip slash -code := 47; % 0 = 48 - -fet_beginchar("Numeral 0", "zero") - set_char_box(0, 11/15height# * widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - penpos1(thin,90); - z1r=(w/2,h); - penpos2(thick,180); - z2r=(0,h/2); - penpos3(thin,-90); - z3r=(w/2,0); - penpos4(thick,0); - z4r=(w,h/2); - fill z1r..z2r..z3r..z4r..cycle; - save t; t=1/tense; - penlabels(1,2,3,4); - unfill z1l..tension t..z2l..tension t..z3l - ..tension t..z4l..tension t..cycle; +code := 47; % 0 = 48 + +fet_beginchar("Numeral 0", "zero"); + set_char_box (0, 11/15 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + penpos1 (thin, 90); + penpos2 (thick, 180); + penpos3 (thin,- 90); + penpos4 (thick, 0); + + z1r = (w / 2, h); + z2r = (0, h / 2); + z3r = (w / 2, 0); + z4r = (w, h / 2); + + fill z1r + .. z2r + .. z3r + .. z4r + .. cycle; + + save t; + t = 1 / tense; + + penlabels (1, 2, 3, 4); + + unfill z1l + ..tension t.. z2l + ..tension t.. z3l + ..tension t.. z4l + ..tension t.. cycle; fet_endchar; - -fet_beginchar("Numeral 1", "one") -% set_char_box(0, 19/30height#*widen, 0, height#); - set_char_box(0, 1/2foot_width#+3/2thick#+1/2hair#, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - - save alpha; alpha=0; - calc_kuulleke(thick,alpha); - z1=(3/2thick,height); - - penpos5(thick,0); - z5=(x1,foot_top); - - z6=(0,h/2); - save beta; beta=angle(z1l-z6); - penpos7(thin,beta-90); - z7l=z6; - penpos8(thin/cosd(beta),-90); - z8l=z1l; - penpos9(thin,beta-90); - z9r=z8r+(thin/cosd(beta))*(0,-1); - penlabels(1,2,3,4,5,6,7,8,9); - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l..z3r{down} - ..{down}z5r{left}..z5..{left}z5l{up}..{up}z2l..cycle; - fill z7l{dir(beta)}..{dir(beta)}z1l..z2r..z9r{up} - ..z9l{dir(180+beta)}..{dir(180+beta)}z7r..cycle; - penlabels(7,8,9); - - draw_foot(x1); + + +fet_beginchar ("Numeral 1", "one"); + save alpha, beta, gamma; + +% set_char_box (0, 19/30 height# * widen, 0, height#); + set_char_box (0, 1/2 foot_width# + 3/2 thick# + 1/2 hair#, + 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + alpha = 0; + calc_kuulleke (thick, alpha); + z1 = (3/2 thick, height); + + penpos5 (thick, 0); + z5 = (x1, foot_top); + + z6 = (0, h / 2); + beta = angle (z1l - z6); + + penpos7 (thin, beta - 90); + z7l = z6; + + penpos8 (thin / cosd (beta), -90); + z8l = z1l; + + penpos9 (thin, beta - 90); + z9r = z8r + (thin / cosd (beta)) * down; + + penlabels (range 1 thru 9); + + gamma = angle (length (z1r - z1), 2 kuulleke); + + fill z2r{dir (alpha - gamma)} + .. z4 + .. {dir (alpha + gamma)}z3l + .. z3r{down} + -- z5r + -- z5l + -- z2l{up} + .. cycle; + + fill z7l + -- z1l{dir (beta)} + .. {dir (alpha - gamma)}z2r + -- z9r{up} + .. {dir (180 + beta)}z9l + -- z7r{dir (180 + beta)} + .. {dir (beta)}cycle; + + draw_foot (x1); fet_endchar; -fet_beginchar("Numeral 2", "two") - set_char_box(0, 22/30 height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - clearxy; - save alpha; alpha=-45*widen; - save beta; beta=85; - save gamma; gamma=beta-10; + +fet_beginchar ("Numeral 2", "two"); + save tolerance; + save alpha, beta, gamma, theta; save flare_start_distance; + save t, pat, bow; + path pat, bow; + + set_char_box (0, 22/30 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + alpha = -45 * widen; + beta = 85; + gamma = beta - 10; + theta = 20 / widen; + + flare_start = 0.25; + + penpos1 (hair, 90 + beta); + z1 = (0, 0) + (1/2 sqrt (2) * hair) * dir (45); - flare_start = 0.25 ; - save theta; theta=20/widen; - penpos1(hair,90+beta); - z1=(0,0)+(1/2sqrt(2)*hair)*dir(45); - penpos3(hair,90+gamma); - z3=(w,thick)+(1/2sqrt(2)*hair)*dir(-135); - penpos2(thick, 90+alpha -15); - x2-x1=x3-x2; - y2=10/16 thick/widen; - fill z1r{dir(beta)}.. tension 0.9 .. {dir(alpha + 10)}z2r..{dir(gamma)}z3r - ..z3l{dir(180+gamma)}..{dir(180+alpha - 5)}z2l - ..{dir(180+beta)}z1l..cycle; - - penpos4(thick,0); - z4r=(w-thin/2, .71 h); - penpos5(hair,90); + penpos3 (hair,90 + gamma); + z3 = (w, thick) + (1/2 sqrt (2) * hair) * dir (-135); + + penpos2 (thick, 90 + alpha - 15); + x2 - x1 = x3 - x2; + y2 = 10/16 thick / widen; + + tolerance := epsilon; + + % Find proper tension to exactly touch the x axis. + % Later on we directly use `bow'. + vardef f (expr t) = + bow := z3l{dir (180 + gamma)} + ..tension t.. {dir (180 + alpha -5)}z2l; + ypart (directionpoint left of bow) < 0 + enddef; + + % the return value of `solve' is stored in a dummy variable + t = solve f (0.8, 1.2); + + fill z1r{dir (beta)} + ..tension 0.9.. {dir (alpha + 10)}z2r + .. {dir (gamma)}z3r + .. bow + .. {dir (180 + beta)}z1l + .. cycle; + + penpos4 (thick, 0); + z4r = (w - thin / 2, .71 h); + + penpos5 (hair, 90); y5r = h; - x5r = 9/20 w ; + x5r = 9/20 w; - penlabels(1,2,3,4); - penlabels(5,6); - save t; t=tense; + penlabels (range 1 thru 6); - save p; - path p ; - p := z1l{dir(beta)}..tension t..z4r{up} - .. number_flare_path(z5r,180,90,hair, 1.05 flare, - x5r - 1/2 hair, - .21 h, 0.006, 0.4, 1) - .. z4l{down}..tension t - ..{dir(180+beta)}z1r..cycle; + t := tense; - pickup pencircle scaled 1; -% draw p; - fill p; + pat := z1l{dir (beta)} + ..tension t.. z4r{up} + .. number_flare_path (z5r, 180, 90, hair, 1.05 flare, + x5r - 1/2 hair, .21 h, 0.006, 0.4, 1) + .. z4l{down} + ..tension t.. {dir (180 + beta)}z1r + -- cycle; +% pickup pencircle scaled 1; +% draw pat; + + fill pat; fet_endchar; %% -% TODO: should widen a bit. The right edge of the 3 bumps into next glyph in -% combinations +% TODO: should widen a bit. The right edge of the 3 bumps into next glyph in +% combinations % -fet_beginchar("Numeral 3", "three") - set_char_box(0, 2/3height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - penpos1(hair,-90); +fet_beginchar ("Numeral 3", "three"); + set_char_box (0, 2/3 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + penpos1 (hair, -90); + +% flare_start = 0.25; -% flare_start = 0.25 ; x1l = 36/80 w; y1l = h; - -% z1l=(17/16thick,h); - penpos2(7/8thick,180); - x2l= w-thick/8; - y2l = 3/4h + thick* 3/32; - penpos3(thin,90); - z3=(w/2,h/2+1/8thick); - penpos4(thin,90); - z4=(5/8thick+1/2thin,y3); - penpos5(thick,0); - x5r=w; - y5r = 17/64 h + thick/16; - - penpos6(hair,-90); - - x6r= 37/80 w; + +% z1l = (17/16 thick, h); + + penpos2 (7/8 thick, 180); + x2l = w - thick / 8; + y2l = 3/4 h + thick * 3/32; + + penpos3 (thin, 90); + z3 = (w / 2, h / 2 + 1/8 thick); + + penpos4 (thin, 90); + z4 = (5/8 thick + 1/2 thin, y3); + + penpos5 (thick, 0); + x5r = w; + y5r = 17/64 h + thick / 16; + + penpos6 (hair, -90); + x6r = 37/80 w; y6r = 0; - penpos7(3/2thin,90); - x7 = .83 w ; + + penpos7 (3/2 thin, 90); + x7 = .83 w; y7 = y3; - penlabels(1,2,3,4,5,6,7); - save alpha; alpha=25; - save t; t=tense; - save outer_t; outer_t := 0.93; - pickup pencircle scaled 1; + penlabels (range 1 thru 7); + + save alpha, t, outer_t; + alpha = 25; + t = tense; + outer_t := 0.93; + +% pickup pencircle scaled 1; % draw - fill - number_flare_path (z1l, 180, 90, hair, 7/8 flare, x1l - .5 hair, - .16 h, 0.06, 1.5, -1) - ..tension outer_t - .. z2l{down} - .. tension outer_t - ..z7r{dir(180+alpha)} - ..z7l{dir(-alpha)} - .. tension outer_t - ..z5r{down} - .. tension outer_t - .. number_flare_path (z6r, 180, -90, hair, flare, x6l, - .18 h, 0.06, 1.5, 1) - - .. z5l{up} - ..tension t - ..z3l{left} - ..z4l{left} - ..z4r{right} - ..z3r{right} - ..tension t - ..z2r{up} - ..tension t - .. cycle -; + fill number_flare_path (z1l, 180, 90, hair, 7/8 flare, x1l - .5 hair, + .16 h, 0.06, 1.5, -1) + ..tension outer_t.. z2l{down} + ..tension outer_t.. z7r{dir (180 + alpha)} + .. z7l{dir (-alpha)} + ..tension outer_t.. z5r{down} + ..tension outer_t.. number_flare_path (z6r, 180, -90, hair, + flare, x6l, .18 h, 0.06, + 1.5, 1) + .. z5l{up} + ..tension t.. z3l{left} + .. z4l{left} + .. z4r{right} + .. z3r{right} + ..tension t.. z2r{up} + ..tension t.. cycle; fet_endchar; - -fet_beginchar("Numeral 4", "four") - set_char_box(0, 4/5height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - - save alpha; alpha=0; - calc_kuulleke(3/2thick,alpha); - z1r=(w-3/4thick,height); - - z5=(thin,1/4height+thin); - save beta; beta=angle(z3r-z5); - penpos6(thin,-90); - z6l=z5; - penpos7(thin,-90); - y7=y6; x7=w-1/2thin; - penpos8(thin,-alpha); - z8r=z5; - penlabels(1,2,3,4,5,6,7); - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l - ..z3r{dir(180+beta)}..{dir(180+beta)}z8r{right} - ..{right}z7l..z7r{left}..{left}z6r..z8l{dir(beta)} - ..{up}z2l..cycle; +fet_beginchar ("Numeral 4", "four"); + save alpha, beta, gamma; + + set_char_box (0, 4/5 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + alpha = 0; + calc_kuulleke (3/2 thick, alpha); + + z1r = (w - 3/4 thick, height); + z5 = (thin, 1/4 height + thin); + + beta = angle (z3r - z5); + + penpos6 (thin, -90); + z6l = z5; + + penpos7 (thin, -90); + y7 = y6; + x7 = w - 1/2 thin; + + penpos8 (thin, -alpha); + z8r = z5; + + penlabels (range 1 thru 8); + + gamma = angle (length (z1r - z1), 2 kuulleke); + + fill z2r{dir (alpha - gamma)} + .. z4 + .. {dir (alpha + gamma)}z3l + .. {dir (180 + beta)}z3r + -- z8r + -- z7l{right} + .. {left}z7r + -- z6r{left} + ..tension 0.8 and 2.. z8l{dir (beta)} + .. {up}z2l + .. cycle; clearxy; - save alpha; alpha=beta; - calc_kuulleke(thick,alpha); - z1r=(w-3/4thick,height-(3/2thin)/cosd(alpha)); + alpha := beta; + calc_kuulleke (thick, alpha); - penpos5(thick,0); - z5=(x1,foot_top); - - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l - ..z3r{down}..{down}z5r{left}..z5..{left}z5l{up} - ..{up}z2l..cycle; - penlabels(1,2,3,4,5); + z1r = (w - 3/4 thick, height - (3/2 thin) / cosd (alpha)); - draw_foot(x5); -fet_endchar; + penpos5 (thick, 0); + z5 = (x1, foot_top); -fet_beginchar("Numeral 5", "five") - set_char_box(0, 27/40 height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - calc_kuulleke(w-thin,0); - - z1=(w/2+1/8thick,h); - save alpha; alpha=0; - penpos5(thin,0); - z5l=(x1l,h-15/16thick); - penpos6(hair,90-45); - z6=z5r+1/2hair*dir(-45); - penpos7(thin,0); - z7l=(x1l,h/2+thin-hair); - penlabels(1,2,3,4,5,6,7); - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l - ..z3r{dir(-135)}..{left}z6r..z6l{down}..z7r{down} - ..z7l{up}..{up}z2l..cycle; - penpos8(thin,90); - z8l=(x7r,y7r-1/16thick); - penpos9(thin,90); + gamma := angle (length (z1r - z1), 2 kuulleke); - - y9=10/16[y5,y7]; - x9 = .36 [x8r, x10r] ; + fill z2r{dir (alpha - gamma)} + .. z4 + .. {dir (alpha + gamma)}z3l + .. {down}z3r + -- z5r + -- z5l + -- z2l{up} + .. cycle; - penpos10(thick,0); - x10r = w+ hair/2; - y10r = 1/2[y9r,y11r]; - penpos11(hair,-90); - y11r = 0; - x11r = .7 [0, x10l]; + penlabels (1, 2, 3, 4, 5); - penlabels(8,9,10,11, 12); - save beta; beta=45; + draw_foot (x5); +fet_endchar; + +fet_beginchar ("Numeral 5", "five"); + save alpha, beta, gamma, delta; save inner_t, outer_t; - inner_t= 1.0; - outer_t= .85; - fill z8r{dir(beta)}..z9r{right} - ..tension outer_t - ..z10r{down} - .. number_flare_path (z11r, 180, -90, hair, flare, x11l, - .18 h, 0.06, 1.5, 1) - ..z11l{right} - ..tension inner_t - ..z10l{up} - ..tension inner_t - ..z9l{left}..z8l{dir(180+beta+10)}..cycle; + save pat; + path pat; + + set_char_box (0, 27/40 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + alpha = 0; + calc_kuulleke (w - thin, alpha); + + z1 = (w / 2 + 1/8 thick, h); + + penpos5 (thin, 0); + z5l = (x1l, h - 15/16 thick); + + penpos6 (hair, 90 - 45); + z6 = z5r + 1/2 hair * dir (-45); + + penpos7 (thin, 0); + z7l = (x1l, h / 2 + thin - hair); + + penlabels (range 1 thru 7); + + gamma = angle (length (z1r - z1), 2 kuulleke); + + pat := z2r{dir (alpha - gamma)} + .. z4 + .. {dir (alpha + gamma)}z3l + .. z3r{dir (-135)} + .. {left}z6r + .. {down}z6l + -- z7r{down} + .. {up}z7l + -- z2l{up} + .. cycle; + fill pat; + + beta = 45; + delta = 180 + beta + 10; + z8r = (x7r, y7r - 1/16 thick + thin); + z8l = directionpoint dir (delta) of + subpath (6, 7) of pat; + + penpos9 (thin, 90); + y9 = 10/16 [y5, y7]; + x9 = .36 [x8r, x10r]; + + penpos10 (thick, 0); + x10r = w + hair / 2; + y10r = 1/2 [y9r, y11r]; + + penpos11 (hair, -90); + y11r = 0; + x11r = .7 [0, x10l]; + penlabels (range 8 thru 12); + + inner_t = 1.0; + outer_t = .85; + + fill z8r {dir (beta)} + .. z9r{right} + ..tension outer_t.. z10r{down} + .. number_flare_path (z11r, 180, -90, hair, flare, x11l, + .18 h, 0.06, 1.5, 1) + .. z11l{right} + ..tension inner_t.. z10l{up} + ..tension inner_t.. z9l{left} + .. z8l{dir (delta)} + -- cycle; fet_endchar; -fet_beginchar("Numeral 6", "six") + +fet_beginchar ("Numeral 6", "six"); draw_six; fet_endchar; -fet_beginchar("Numeral 7", "seven") - set_char_box(0, 11/15height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - save alpha; alpha=-180; +fet_beginchar ("Numeral 7", "seven"); + save tolerance; + save alpha, beta, gamma, delta; + save bow; + path bow; + + set_char_box (0, 11/15 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + alpha = -180; + if true: - penpos1(3/2thick,180+alpha); - penpos2(hair,180+alpha-45); - z2=z1l+(1/4sqrt(2)*hair)*dir(alpha-135); - penpos3(hair,180+alpha+45); - z3=z1r+(1/4sqrt(2)*hair)*dir(alpha-45); - z4=z1+kuulleke*dir(alpha-90); + penpos1 (3/2 thick, 180 + alpha); + penpos2 (hair, 180 + alpha - 45); + penpos3 (hair, 180 + alpha + 45); + + z2 = z1l + (1/4 sqrt (2) * hair) * dir (alpha - 135); + z3 = z1r + (1/4 sqrt (2) * hair) * dir (alpha - 45); + z4 = z1 + kuulleke * dir (alpha - 90); else: - % shit, does not work - calc_kuulleke(3/2thick,-alpha); -fi - z1l=(thin,0); + % does not work + calc_kuulleke (3/2 thick, -alpha); +fi; + + z1l = (thin, 0); - save beta; beta=55; - penpos5(thin,90+beta); - z5=(w,h)+(1/2sqrt(2)*thin)*dir(-135); + beta = 55; + penpos5 (thin, 90 + beta); + z5 = (w, h) + (1/2 sqrt (2) * thin) * dir (-135); + + gamma = angle (length (z1r - z1), 2 kuulleke); + delta = 12; - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - save delta; delta=12; pickup pencircle; - fill z3l{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z2r.. - z2l{dir(beta+delta)}..{dir(beta)}z5r - ..z5l{dir(180+beta)}..{dir(delta-90)}z3r..cycle; - penlabels(1,2,3,4,5); - clearxy; - save alpha; alpha=-45*widen; - penpos1(1/2thick,90); - z1=(3/2thin,h-(thick+thin)/2); - penpos3(thin,90+beta); - z3=(w,h)+(1/2sqrt(2)*thin)*dir(-135); - penpos2(thick,90+alpha); - x2=1/2[x1,x3]-1/4thick; y2=h-15/16thick+thin*widen; - - penpos4(thin,0); - z4l=(0,h-thin/2); - penpos5(thin,0); - z5l=(0,h/2+thin/2); - - penpos6(9/8thick,90); - z6r=(thin,y1r+2/16thick); - - fill z1r{dir(beta)}..{dir(alpha)}z2r..{dir(beta)}z3r - ..z3l{dir(180+beta)}..{dir(180+alpha)}z2l - ..{dir(180+beta)}z1l..z6l{down}..{down}z5r - ..z5l{up}..{up}z4l..z4r{down}..{down}z6r..{right}cycle; - penlabels(1,2,3,4,5,6); + fill z3l{dir (alpha - gamma)} + .. z4 + .. {dir (alpha + gamma)}z2r + .. z2l{dir (beta + delta)} + .. {dir (beta)}z5r + .. z5l{dir (180 + beta)} + .. {dir (delta - 90)}z3r + .. cycle; + + penlabels (1, 2, 3, 4, 5); + + alpha := -45 * widen; + + penpos11 (1/2 thick, 90); + z11 = (3/2 thin, h - (thick + thin) / 2); + + penpos13 (thin, 90 + beta); + z13 = z5; + + penpos12 (thick, 90 + alpha); + x12 = 1/2 [x11, x13] - 1/4 thick; + y12 = h - 15/16 thick + thin * widen; + + penpos14 (thin, 0); + z14l = (0, h - thin / 2); + + penpos15 (thin, 0); + z15l = (0, h / 2 + thin / 2); + + penpos16 (9/8 thick, 90); + z16r = (thin, y11r + 2/16 thick); + + tolerance := epsilon; + + % Find proper tension to exactly touch the x axis. + % Later on we directly use `bow'. + vardef f (expr t) = + bow := z11r{dir (beta)} + ..tension t.. {dir (alpha)}z12r; + ypart (directionpoint right of bow) > h + enddef; + + % the return value of `solve' is stored in a dummy variable + t = solve f (0.8, 1.2); + + fill bow + .. {dir (beta)}z13r + -- z13l{dir (180 + beta)} + .. {dir (180 + alpha)}z12l + .. {dir (180 + beta)}z11l + .. {down}z16l + -- z15r{down} + .. {up}z15l + -- z14l{up} + .. {down}z14r + -- z16r{down} + ..tension 1.5.. {dir (beta)}cycle; + + penlabels (range 11 thru 16); fet_endchar; -fet_beginchar("Numeral 8", "eight") - set_char_box(0, 11/15height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - save alpha; alpha=60; - save beta; beta=alpha-15; - z1=(w/2,h/2+thick/8); - penpos2(14/8 thin,0); - z2=(w/3,h/2+thin); - penpos3(3/2thin,0); - z3l=(0,h/4+thin/2); - penpos4(hair,90); - - z4l=(x1 ,0); - penpos5(thick,90+90+alpha); - z5=z1+w/4*dir(alpha-90); - penpos6(thick,90+90+alpha); - z6=z1+(w/4-thin/2)*dir(90+alpha); - penpos7(hair,90); - z7r= (x1 + .02 w ,h); - penpos8(3/2thin,0); - z8r=(w-thin/2,3/4h+thin/2); - penpos9( 13/8 thin,0); - z9=(2/3w,h/2); - penlabels(1,2,3,4,5,6,7,8,9); - save t; t=tense; - fill z2r{dir(180+beta)}..z3r{down}..z4r{right} - ..z5r{dir(90+alpha)}..z6r{dir(90+alpha)} - ..tension t..z7r{right}..z8r{down}..z9r{dir(180+beta)} - ..z9l{dir(beta)}..z8l{up}..z7l{left}..z6l{dir(alpha-90)} - ..z5l{dir(alpha-90)}..tension t..z4l{left}..z3l{up} - ..z2l{dir(beta)}..cycle; + +fet_beginchar ("Numeral 8", "eight"); + save alpha, beta; + + set_char_box (0, 11/15 height# * widen, 0, height#); + + message "w:" & decimal w; + message "h:" & decimal h; + + alpha = 60; + beta = alpha - 15; + + z1 = (w / 2, h / 2 + thick / 8); + + penpos2 (14/8 thin, 0); + z2 = (w / 3, h / 2 + thin); + + penpos3 (3/2 thin, 0); + z3l = (0, h / 4 + thin / 2); + + penpos4 (hair, 90); + z4l = (x1, 0); + + penpos5 (thick, 90 + 90 + alpha); + z5 = z1 + w / 4 * dir (alpha - 90); + + penpos6 (thick, 90 + 90 + alpha); + z6 = z1 + (w / 4 - thin / 2) * dir (90 + alpha); + + penpos7 (hair, 90); + z7r = (x1 + .02 w, h); + + penpos8 (3/2 thin, 0); + z8r = (w - thin / 2, 3/4 h + thin / 2); + + penpos9 (13/8 thin, 0); + z9 = (2/3 w, h / 2); + + penlabels (range 1 thru 9); + + save t; + t = tense; + + fill z2r{dir (180 + beta)} + .. z3r{down} + .. z4r{right} + .. z5r{dir (90 + alpha)} + -- z6r{dir (90 + alpha)} + ..tension t.. z7r{right} + .. z8r{down} + .. {dir (180 + beta)}z9r + -- z9l{dir (beta)} + .. z8l{up} + .. z7l{left} + .. {dir (alpha - 90)}z6l + -- z5l{dir (alpha - 90)} + ..tension t.. z4l{left} + .. z3l{up} + .. {dir (beta)}z2l + -- cycle; fet_endchar; -fet_beginchar("Numeral 9", "nine") + +fet_beginchar ("Numeral 9", "nine"); draw_six; % xy_mirror_char; + currentpicture := currentpicture scaled -1; - currentpicture := currentpicture shifted (w,h); + currentpicture := currentpicture shifted (w, h); fet_endchar; -ligtable "3" : "3" kern 0.1 space#, "0" kern 0.1 space#; -ligtable "2" : "7" kern 0.15 space#; +ligtable "3": + "3" kern 0.1 space#, + "0" kern 0.1 space#; + +ligtable "2": + "7" kern 0.15 space#; -- 2.39.5