From e5ed481bc531d0cc3c10cfda8f7064e26fef9ad3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 29 Oct 1997 17:06:46 +0100 Subject: [PATCH] patch::: 0.1.27: isi pl 27.om-je-te-helpen-met-je-ps-spul.jcn1 - embedded slurs: * bf: placements * added \embeddedtex * postscript is default * fixed \embeddedps * fixed mf: draw_slur * postscript macro: draw_slur --- NEWS | 8 +++ VERSION | 2 +- init/feta16.ly | 2 +- init/feta20.ly | 2 +- init/font-en-tja16.ly | 2 +- init/font-en-tja20.ly | 2 +- lily/tex-slur.cc | 24 ++++++--- mf/feta-sleur.mf | 44 ++++++++++++++--- tex/feta16.tex | 2 +- tex/feta20.tex | 2 +- tex/fetdefs.tex | 111 +++++++++++++++++++++++++++--------------- tex/font-en-tja16.tex | 2 +- tex/font-en-tja20.tex | 2 +- 13 files changed, 143 insertions(+), 62 deletions(-) diff --git a/NEWS b/NEWS index 45eba4d92b..f36c11d214 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +pl 27.om-je-te-helpen-met-je-ps-spul.jcn1 + - embedded slurs: + * bf: placements + * added \embeddedtex + * postscript is default + * fixed \embeddedps + * fixed mf: draw_slur + * postscript macro: draw_slur pl 27 - -t/--test switch for experimental stuff. diff --git a/VERSION b/VERSION index 34dc5b7113..624560da3b 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 TOPLEVEL_PATCH_LEVEL = 27 -TOPLEVEL_MY_PATCH_LEVEL = +TOPLEVEL_MY_PATCH_LEVEL = jcn1 # use the above to send patches, always empty for released version: # please don't move these comments up; the patch should fail if diff --git a/init/feta16.ly b/init/feta16.ly index d6b1849499..7a6f1c99f8 100644 --- a/init/feta16.ly +++ b/init/feta16.ly @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Wed Oct 29 09:54:00 1997 +% on Wed Oct 29 16:41:31 1997 % Do not edit % input from out/feta16.log % name=\symboltables { diff --git a/init/feta20.ly b/init/feta20.ly index 9d3e1e2de5..293a6f8701 100644 --- a/init/feta20.ly +++ b/init/feta20.ly @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Wed Oct 29 09:54:07 1997 +% on Wed Oct 29 16:41:35 1997 % Do not edit % input from out/feta20.log % name=\symboltables { diff --git a/init/font-en-tja16.ly b/init/font-en-tja16.ly index 1e6b32a344..f22e289f7f 100644 --- a/init/font-en-tja16.ly +++ b/init/font-en-tja16.ly @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Tue Oct 28 12:14:59 1997 +% on Tue Oct 28 20:43:44 1997 % Do not edit % input from out/font-en-tja16.log % name=\symboltables { diff --git a/init/font-en-tja20.ly b/init/font-en-tja20.ly index e96c126c3d..cab88471c5 100644 --- a/init/font-en-tja20.ly +++ b/init/font-en-tja20.ly @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Tue Oct 28 12:15:08 1997 +% on Tue Oct 28 20:44:01 1997 % Do not edit % input from out/font-en-tja20.log % name=\symboltables { diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index ea365069b2..081869d058 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -7,6 +7,7 @@ */ #include +#include "main.hh" #include "misc.hh" #include "lookup.hh" #include "molecule.hh" @@ -15,7 +16,6 @@ #include "paper-def.hh" #include "string-convert.hh" -#include "main.hh" static char direction_char (Direction y_sign) @@ -150,9 +150,9 @@ Lookup::slur (int dy , Real &dx, Direction dir) const // duh // let's try the embedded stuff bool embedded_b = experimental_features_global_b; + String embed; if (embedded_b) { - // huh, factor 8? Real fdy = dy*paper_l_->internote_f (); Real fdx = dx; String ps = "\\embeddedps{\n"; @@ -160,7 +160,7 @@ Lookup::slur (int dy , Real &dx, Direction dir) const ps += String_convert::int_str (fdx) + " " + String_convert::int_str (fdy) + " " + String_convert::int_str (dir) + - " drawslur}"; + " draw_slur}"; String mf = "\\embeddedmf{\n"; mf += "input feta-sleur;\n"; @@ -169,10 +169,9 @@ Lookup::slur (int dy , Real &dx, Direction dir) const + String_convert::int_str (fdy) + "),"; mf += String_convert::int_str (dir) + ");\n"; mf += "end.\n"; - ps += "}\n"; + mf += "}\n"; - s.tex_ = ps + mf; - return s; + embed = ps + mf; } Direction y_sign = (Direction) sign (dy); @@ -188,7 +187,13 @@ Lookup::slur (int dy , Real &dx, Direction dir) const if (large) { - return big_slur (dy, dx, dir); + s = big_slur (dy, dx, dir); + if (embedded_b) + { + s.tex_ = "\\embeddedtex{\n" + s.tex_ + "\n}\n"; + s.tex_ += embed; + } + return s; } Real orig_dx = dx; int widx = int (floor (dx/4.0)); // slurs better too small.. @@ -234,6 +239,11 @@ Lookup::slur (int dy , Real &dx, Direction dir) const assert (idx < 256); f+=String ("{") + String (idx) + "}"; s.tex_ = f; + if (embedded_b) + { + s.tex_ = "\\embeddedtex{\n" + s.tex_ + "\n}\n"; + s.tex_ += embed; + } s.translate_axis (dx/2, X_AXIS); return s; diff --git a/mf/feta-sleur.mf b/mf/feta-sleur.mf index 1eba2a6ce4..8c411fb382 100644 --- a/mf/feta-sleur.mf +++ b/mf/feta-sleur.mf @@ -1,22 +1,49 @@ -% feta-sleur.mf - +% feta-sleur.mf mode_setup; thin:=.2pt; thick:=5thin; -bow:=.2; +ybow:=.2; +abow:=1.5; + +def draw_slur(expr a,b,d) = + beginchar(0,0,0,0) "Embedded mf"; + % huh, factor 8? + z1=8a; + z2=8b; + save alpha; alpha=angle(z2-z1); + save len; len=length(z2-z1); + z3=(0,0); + z4=(len/2,len*ybow*d); + z5=(len,0); + save beta; beta=abow*angle(z4-z3); + penpos3(thin,90+beta); + penpos4(thick,90); + penpos5(thin,90-beta); + pickup pencircle; + path boogje; + boogje = z3l{dir(beta)}..z4l{right}..z5l{dir(-beta)} + ..z5r{dir(180-beta)}..z4r{left} + ..z3r{dir(180+beta)}..cycle; + penlabels(1,2,3,4,5); + boogje := boogje rotated alpha; + % silly mo*tex convenction +% boogje := boogje shifted ((x1-x2)/2,0); + fill boogje; + endchar; + enddef; def sign(expr a) = ((abs(a))/(a)) enddef; -def draw_slur(expr a,b,d) = +def xdraw_slur(expr a,b,d) = beginchar(0,0,0,0) "Embedded mf"; % huh, factor 8? z1=8a; z3=8b; save alpha; alpha=angle(z3-z1); - z2=(1/2[x1,x3],1/2[y1,y3])+d*bow*(x3-x1)*dir(alpha+90); - save beta; beta=d*sign(y3-y1)*1.5angle(z2-z1)-alpha; + z2=(1/2[x1,x3],1/2[y1,y3])+d*ybow*(x3-x1)*dir(alpha+90); + save beta; beta=d*sign(y3-y1)*abow*angle(z2-z1)-alpha; % message "d: "&decimal d; % message "dy: "& decimal sign(y3-y1); % message "alpha: "&decimal alpha; @@ -25,8 +52,9 @@ def draw_slur(expr a,b,d) = penpos2(thick,alpha+90); penpos3(thin,alpha-beta+90); pickup pencircle; - fill z1l{dir(alpha+beta)}..z2l{dir(alpha)}..z3l{dir(alpha-beta)} - ..z3r{dir(180+alpha-beta)}..z2r{dir(180+alpha)}..z1r{dir(180+alpha+beta)} + fill z1l{dir(alpha+beta)}..z2l{dir(alpha)} + ..z3l{dir(alpha-beta)}..z3r{dir(180+alpha-beta)} + ..z2r{dir(180+alpha)}..z1r{dir(180+alpha+beta)} ..cycle; penlabels(1,2,3); endchar; diff --git a/tex/feta16.tex b/tex/feta16.tex index 374dd6f6fe..3e54e30867 100644 --- a/tex/feta16.tex +++ b/tex/feta16.tex @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Wed Oct 29 09:54:00 1997 +% on Wed Oct 29 16:41:31 1997 % Do not edit % input from out/feta16.log % name diff --git a/tex/feta20.tex b/tex/feta20.tex index a4649fd93e..f86bcfaec3 100644 --- a/tex/feta20.tex +++ b/tex/feta20.tex @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Wed Oct 29 09:54:07 1997 +% on Wed Oct 29 16:41:35 1997 % Do not edit % input from out/feta20.log % name diff --git a/tex/fetdefs.tex b/tex/fetdefs.tex index 854441bb68..86f366e260 100644 --- a/tex/fetdefs.tex +++ b/tex/fetdefs.tex @@ -44,7 +44,6 @@ \openin\checkexists #1 \ifeof\checkexists \closein\checkexists - \relax \else \closein\checkexists \input #1 @@ -60,55 +59,91 @@ \immediate\closeout\embedfile } \def\turnOnExperimentalFeatures{ -% -% yeah. By far not finished yet. -% Don't do this by default. gs takes a long time to start in xdvi -% -\special{ps: /drawslur { - currentpoint /texoriginy exch def - /texoriginx exch def + +% draw a slur in embedded postscript +\special{ps: +/xbow 1 3 div def +/ybow 1 4 div def +/thin 0.2 def +/thick thin 5 mul def +/draw_slur { + % up or down? /dir exch def - /lift 30 def - /desty exch def - /destx exch def - /slurfactor .4 def - destx slurfactor mul - texoriginx add - desty slurfactor mul - texoriginy add - lift dir mul add - destx 1 slurfactor sub mul - texoriginx add - desty 1 slurfactor sub mul - texoriginy add - lift dir mul add - destx - texoriginx add - desty - texoriginy add - curveto - stroke -} def -} +% +% for mo*tex shift +% exch +% 1 copy /dx exch def +% exch +% + % calc angle alpha + 2 copy exch atan /alpha exch def + % calc len(gth) + 2 exp exch 2 exp add sqrt /len exch def +% + % add and calc z2, z3 + len xbow mul + len ybow mul dir mul + 1 xbow sub len mul + len ybow mul dir mul +% + % add z4, z1 + len 0 + 0 0 +% + % add and calc z5..z8 + 8 copy + thin dir mul sub + 8 2 roll + thin dir mul sub + 8 2 roll + thick dir mul sub + 8 2 roll + thick dir mul sub +% + % reverse order, must be cycle + 8 6 roll + 6 2 roll + 4 2 roll + 8 6 roll +% + % set z1..z4 + 16 8 roll +% + alpha rotate +% silly mo*tex convention +% dx 2 div -1 mul 0 translate + % draw z1..z4 + moveto curveto + % draw z5..z8 + lineto curveto + % cycle + 0 0 lineto + fill +} def } } +\def\embeddedtex#1{#1} \def\embeddedps#1{ - \special{ps: #1} + \special{ps: @beginspecial @setspecial #1 @endspecial} } \def\embeddedmf#1{ - \edef\embedid{feta-sleur-\number\embedcount} - \immediate\openout\embedfile=\embedid.mf - \global\advance\embedcount by 1 - \immediate\write\embedfile{#1} - \immediate\closeout\embedfile - \font\expandafter\embedid\expandafter=\embedid - \hbox{\embedid\char0} + \edef\embedid{feta-sleur-\number\embedcount} + \immediate\openout\embedfile=\embedid.mf + \global\advance\embedcount by 1 + \immediate\write\embedfile{#1} + \immediate\closeout\embedfile + \font\expandafter\embedid\expandafter=\embedid + \embedid\char0 } +\def\notex{\def\embeddedtex##1{}} \def\nopostscript{\def\embeddedps##1{}} \def\nometafont{\def\embeddedmf##1{}} +% dat heb je handig gedaan, lieverd! \nometafont +\nopostscript +%\notex \def\EndLilyPondOutput{ \storeembedcount diff --git a/tex/font-en-tja16.tex b/tex/font-en-tja16.tex index 4f32c77574..80ca21d7c6 100644 --- a/tex/font-en-tja16.tex +++ b/tex/font-en-tja16.tex @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Tue Oct 28 12:14:59 1997 +% on Tue Oct 28 20:43:44 1997 % Do not edit % input from out/font-en-tja16.log % name diff --git a/tex/font-en-tja20.tex b/tex/font-en-tja20.tex index 3222e2b9bf..7cdab66158 100644 --- a/tex/font-en-tja20.tex +++ b/tex/font-en-tja20.tex @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Tue Oct 28 12:15:08 1997 +% on Tue Oct 28 20:44:01 1997 % Do not edit % input from out/font-en-tja20.log % name -- 2.39.2