+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.
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
% 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 {
% 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 {
% 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 {
% 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 {
*/
#include <math.h>
+#include "main.hh"
#include "misc.hh"
#include "lookup.hh"
#include "molecule.hh"
#include "paper-def.hh"
#include "string-convert.hh"
-#include "main.hh"
static char
direction_char (Direction y_sign)
// 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";
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";
+ 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);
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..
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;
-% 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;
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;
% 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
% 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
\openin\checkexists #1
\ifeof\checkexists
\closein\checkexists
- \relax
\else
\closein\checkexists
\input #1
\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
% 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
% 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