diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /fonts/cun/cun.mf |
Initial commit
Diffstat (limited to 'fonts/cun/cun.mf')
-rw-r--r-- | fonts/cun/cun.mf | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/fonts/cun/cun.mf b/fonts/cun/cun.mf new file mode 100644 index 0000000000..7f0191d7a4 --- /dev/null +++ b/fonts/cun/cun.mf @@ -0,0 +1,201 @@ +%(c) 1992 by Jo Grant + +mode_def testing= + pixels_per_inch:=300*4; + blacker:=.1; + o_correction:=1; + fillin:=.01; + proofing:=2; + fontmaking:=0; + tracingtitles:=1; + enddef; +if unknown mode: +mode:=testing; fi +mode_setup; +turningcheck := 0; + +string style; +style := "classic"; +%style := "academic"; +%style := "academicbf"; + +if mode=testing: screenstrokes; fi + +% parameters that control what a wedge looks like. +width_to_length_ratio := 1/2; +tailang := 30; +costail := cosd tailang; +tantail := sind tailang/cosd tailang; + +u# = 1/384in#; +wedge_len# := 50u#; +letter_fit#:= 5u#; +wedge_wid# := wedge_len#*width_to_length_ratio; +tail_len# := wedge_wid#*costail; +stem_len# := wedge_len# - tail_len#; +tail_porp := tail_len#/wedge_len#; +stem_porp := stem_len#/wedge_len#; +let_height# := wedge_len#+wedge_wid#; +pen_thick# := wedge_len#/25; +half_big# := .5*let_height#*width_to_length_ratio; + +define_pixels(wedge_len, wedge_wid, tail_len, stem_len, let_height, pen_thick); +define_pixels(letter_fit); + +def wedgepen = pickup pencircle scaled pen_thick; enddef; + +def wedgesetup = + save V; + numeric V[]len, V[]width, V[]theta, V[]doit; + pair V[]pnt, V[]cw, V[]ccw; + + for n = 0 step 1 until 20: + wlen(n) := wedge_len; + wwid(n) := wedge_wid; + rot(n) := 0; + V[n]doit := 0; + endfor +enddef; + +def set (expr n) = + wccw(n) = wpnt(n) - ((V[n]len,-V[n]wid/2) rotated (rot(n))); + wcw(n) = wpnt(n) - ((V[n]len, V[n]wid/2) rotated (rot(n))); + V[n]doit := 1; +enddef; + +def drawwedges = + for n = 0 step 1 until 20: + if V[n]doit = 1: + % classic + if style = "classic": + wedgepen; + path cw, ccw, tail; + ccw = wpnt(n)..controls mid(n) and mid(n)..wccw(n); + tail = wccw(n)..controls .7[mid(n),wccw(n)] and .7[mid(n),wcw(n)]..wcw(n); + cw = wcw(n)..controls mid(n) and mid(n)..wpnt(n); + filldraw ccw & tail & cw & cycle; + drawdot wccw(n); + drawdot wcw(n); + fi; + % academic + if style = "academic": + wedgepen; + draw wpnt(n)--mid(n)--wccw(n)--wcw(n)--mid(n); + unfill edgein(mid(n), tback(n), pen_thick)-- + edgein(wccw(n), cwmid(n), pen_thick)-- + edgein(wcw(n), ccwmid(n), pen_thick)--cycle; + unfill edgein(mid(n), tback(n), pen_thick)-- + edgein(wccw(n), cwmid(n), pen_thick)-- + edgein(wcw(n), ccwmid(n), pen_thick)--cycle; + fi; +% % bf academic + if style = "academicbf": + wedgepen; + draw wpnt(n)--mid(n); + filldraw mid(n)--wccw(n)--wcw(n)--cycle; + fi; + fi; + endfor; +enddef; + +def edgein(expr from, to, amnt) = + ((from) + ((to) - (from))/length((to) - (from))*(amnt)) +enddef; + +def wedgeset(expr first, last) = + for n = first step 1 until last: + set(n); + endfor; + drawwedges; +enddef; + +def wlen(expr n) = + V[n]len +enddef; + +def wwid(expr n) = + V[n]wid +enddef; + +def wlenwid(expr n, l) = + V[n]len := l; V[n]wid := l*width_to_length_ratio +enddef; + +def rot(expr n) = + V[n]theta +enddef; + +def wpnt(expr n) = + V[n]pnt +enddef; + +def wccw(expr n) = + V[n]ccw +enddef; + +def wcw(expr n) = + V[n]cw +enddef; + +def tback(expr n) = + (.5[wcw(n), wccw(n)]) +enddef; + +def cwmid(expr n) = + (.5[wcw(n), mid(n)]) +enddef; + +def ccwmid(expr n) = + (.5[wccw(n), mid(n)]) +enddef; + +def wmid(expr n) = % identical to mid + ((wpnt(n) + wcw(n) + wccw(n))/3) +enddef; + +def mid(expr n) = + ((wpnt(n) + wcw(n) + wccw(n))/3) +enddef; + +def cen(expr n) = + (.5[tback(n), wpnt(n)]) +enddef; + +def mstem(expr n) = + (.5[mid(n), wpnt(n)]) +enddef; + +def tmid(expr n) = + ((mid(n) + wcw(n) + wccw(n))/3) +enddef; + +def adjust_fit(expr left_adj, right_adj) = + l := -hround(left_adj*hppp)-letter_fit; + interim xoffset := -l; + charwd := charwd+2letter_fit# + left_adj + right_adj; + r := l+hround(charwd*hppp); + w := r-hround(right_adj*hppp) - letter_fit; + enddef; + +def makebox(text r) = + r((-letter_fit,0), (w+letter_fit,0)); + r((-letter_fit,h), (w+letter_fit,h)); + r((-letter_fit,0), (-letter_fit,h)); + r((w+letter_fit,0), (w+letter_fit,h)); + r((0,0), (0,h)); + r((w,0), (w,h)); + if charic<>0: + r((w+charic*hppp,h.o_),(w+charic*hppp,.5h.o_)); + fi + enddef; + +extra_beginchar := extra_beginchar & "wedgesetup;adjust_fit(0,0);"; + +input cunsum; +%input cun0076; + +font_normal_space wedge_wid#; +font_normal_stretch wedge_wid#/3; +font_normal_shrink wedge_wid#/3; + +end; |