+
+2003-03-21 Juergen Reuter <reuter@ipd.uka.de>
+
+ * lily/breathing-sign.cc, lily/include/breathing-sign.hh,
+ scm/grob-description.scm: moved Michael's original breathing sign
+ code in brew_molecule() to divisio_minima(); provided new
+ brew_molecule() that effectively replaces the
+ Text_item::brew_molecule callback (with additional fallback to
+ Michael's original code); added callbacks for brewing divisio
+ maior/maxima and finalis
+
+ * gregorian-init.ly: added breathing sign shortcuts for virgula,
+ caesura, divisiominima, divisiomaior, divisiomaxima, and finalis
+
+ * script-init.ly: added shortfermata, longfermata,
+ verylongfermata, varcoda
+
+ * scm/script.scm, mf/feta-schrift.mf: added shortfermata,
+ longfermata, verylongfermata, varcomma, varcoda
+
2003-03-19 Mats Bengtsson <mats.bengtsson@s3.kth.se>
* Documentation/user/{tutorial.itely,refman.itely,internals.itely}:
TODO: --> see breathing-sign-engraver.cc
+ Extensions for ancient notation (C) 2003 by Juergen Reuter
*/
#include "staff-symbol-referencer.hh"
#include "dimensions.hh"
#include "direction.hh"
+#include "text-item.hh"
+#include "font-interface.hh"
+
+/*
+ * TODO: thickness should be a grob property (unit:
+ * stafflinethickness) rather than hardwired to (staff_space / 6).
+ */
MAKE_SCHEME_CALLBACK (Breathing_sign,brew_molecule,1);
SCM
Breathing_sign::brew_molecule (SCM smob)
{
- Grob * me = unsmob_grob (smob);
- Real space = Staff_symbol_referencer::staff_space (me);
-
- // todo: cfg'able.
- Interval i1 (0, space / 6), i2 (-space / 2, space / 2);
- Box b (i1, i2);
-
- return Lookup::filledbox (b).smobbed_copy ();
+ Grob *me = unsmob_grob (smob);
+ SCM text = me->get_grob_property ("text");
+ if (text == SCM_EOL)
+ return divisio_minima (smob);
+ SCM properties = Font_interface::font_alist_chain (me);
+ Molecule out;
+ out = Text_item::text2molecule (me, text, properties);
+ SCM space_scm = me->get_grob_property ("word-space");
+ if (gh_number_p (space_scm))
+ {
+ Molecule mol;
+ mol.set_empty (false);
+ out.add_at_edge (X_AXIS, RIGHT, mol, gh_scm2double (space_scm) *
+ Staff_symbol_referencer::staff_space (me), 0);
+ }
+ return out.smobbed_copy ();
}
/*
return l1.smobbed_copy();
}
+/*
+ Gregorian chant divisio minima. (Actually, this was the original
+ breathing sign by Michael. -- jr)
+ */
+MAKE_SCHEME_CALLBACK (Breathing_sign,divisio_minima,1);
+SCM
+Breathing_sign::divisio_minima (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Real staff_size;
+ Real thickness = me->get_paper ()->get_var ("linethickness");
+ SCM lt = me->get_grob_property ("thickness");
+ if (gh_number_p (lt))
+ thickness *= gh_scm2double (lt);
+ if (Staff_symbol_referencer::get_staff_symbol (me))
+ {
+ staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space;
+ }
+ else
+ staff_size = 0.0;
+
+ Real blotdiameter = me->get_paper ()->get_var ("blotdiameter");
+
+ /*
+ * Draw a small vertical line through the uppermost (or, depending
+ * on direction, lowermost) staff line.
+ */
+ Interval xdim (0, thickness);
+ Interval ydim (-0.5 * staff_space, +0.5 * staff_space);
+ Box b (xdim, ydim);
+ Molecule out = Lookup::roundfilledbox (b, blotdiameter);
+ return out.smobbed_copy ();
+}
+
+/*
+ Gregorian chant divisio maior.
+ */
+MAKE_SCHEME_CALLBACK (Breathing_sign,divisio_maior,1);
+SCM
+Breathing_sign::divisio_maior (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Real staff_size;
+ Real thickness = me->get_paper ()->get_var ("linethickness");
+ SCM lt = me->get_grob_property ("thickness");
+ if (gh_number_p (lt))
+ thickness *= gh_scm2double (lt);
+ if (Staff_symbol_referencer::get_staff_symbol (me))
+ {
+ staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space;
+ }
+ else
+ staff_size = 0.0;
+
+ Real blotdiameter = me->get_paper ()->get_var ("blotdiameter");
+
+ /*
+ * Draw a vertical line that is vertically centered in the staff
+ * (just like a bar). The height of this line should be a little
+ * more than half the size of the staff, such that the endings of
+ * the line are in the middle of a staff space.
+ */
+ int lines = Staff_symbol_referencer::line_count (me);
+ int height = lines / 2; // little more than half of staff size
+ if ((lines & 1) != (height & 1))
+ height++; // ensure endings are centered in staff space
+
+ Interval xdim (0, thickness);
+ Interval ydim (-0.5 * height, +0.5 * height);
+ Box b (xdim, ydim);
+ Molecule out = Lookup::roundfilledbox (b, blotdiameter);
+ return out.smobbed_copy ();
+}
+
+/*
+ Gregorian chant divisio maxima.
+ */
+MAKE_SCHEME_CALLBACK (Breathing_sign,divisio_maxima,1);
+SCM
+Breathing_sign::divisio_maxima (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Real staff_size;
+ Real thickness = me->get_paper ()->get_var ("linethickness");
+ SCM lt = me->get_grob_property ("thickness");
+ if (gh_number_p (lt))
+ thickness *= gh_scm2double (lt);
+ if (Staff_symbol_referencer::get_staff_symbol (me))
+ {
+ staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space;
+ }
+ else
+ staff_size = 0.0;
+
+ Real blotdiameter = me->get_paper ()->get_var ("blotdiameter");
+
+ // like a "|" type bar
+ Interval xdim (0, thickness);
+ Interval ydim (-0.5 * staff_size, +0.5 * staff_size);
+ Box b (xdim, ydim);
+ Molecule out = Lookup::roundfilledbox (b, blotdiameter);
+ return out.smobbed_copy ();
+}
+
+/*
+ Gregorian chant finalis.
+ */
+MAKE_SCHEME_CALLBACK (Breathing_sign,finalis,1);
+SCM
+Breathing_sign::finalis (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Real staff_size;
+ Real thickness = me->get_paper ()->get_var ("linethickness");
+ SCM lt = me->get_grob_property ("thickness");
+ if (gh_number_p (lt))
+ thickness *= gh_scm2double (lt);
+ if (Staff_symbol_referencer::get_staff_symbol (me))
+ {
+ staff_size = (Staff_symbol_referencer::line_count (me) - 1) * staff_space;
+ }
+ else
+ staff_size = 0.0;
+
+ Real blotdiameter = me->get_paper ()->get_var ("blotdiameter");
+
+ // like a "||" type bar
+ Interval xdim (0, thickness);
+ Interval ydim (-0.5 * staff_size, +0.5 * staff_size);
+ Box b (xdim, ydim);
+ Molecule line1 = Lookup::roundfilledbox (b, blotdiameter);
+ Molecule line2 (line1);
+ line2.translate_axis (0.5 * staff_space, X_AXIS);
+ line1.add_molecule (line2);
+
+ return line2.smobbed_copy ();
+}
MAKE_SCHEME_CALLBACK (Breathing_sign,offset_callback,2);
SCM
return gh_double2scm (inter_f * sz * d);
}
-
ADD_INTERFACE(Breathing_sign, "breathing-sign-interface",
"A breathing sign.",
"direction");
public:
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
DECLARE_SCHEME_CALLBACK (railtracks, (SCM ));
+ DECLARE_SCHEME_CALLBACK (divisio_minima, (SCM ));
+ DECLARE_SCHEME_CALLBACK (divisio_maior, (SCM ));
+ DECLARE_SCHEME_CALLBACK (divisio_maxima, (SCM ));
+ DECLARE_SCHEME_CALLBACK (finalis, (SCM ));
DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element, SCM axis));
static bool has_interface (Grob*);
\version "1.7.10"
+%%%%%%%%
+%%%%%%%% shortcuts common for all styles of gregorian chant notation
+%%%%%%%%
+
%
-% declare shortcuts for gregorian chant notation
+% declare head prefix shortcuts
%
-
virga =
\once \property Voice.LigatureHead \override #'virga = ##t
stropha =
\once \property Voice.LigatureHead \override #'quilisma = ##t
deminutum =
\once \property Voice.LigatureHead \override #'deminutum = ##t
+
+%
+% declare divisiones shortcuts
+%
+virgula = {
+ \once \property Voice.BreathingSign \override #'text = #"scripts-rcomma"
+ \once \property Voice.BreathingSign \override #'font-relative-size = #-1
+ \breathe
+}
+caesura = {
+ \once \property Voice.BreathingSign \override #'text = #"scripts-rvarcomma"
+ \once \property Voice.BreathingSign \override #'font-relative-size = #-1
+ \breathe
+}
+divisiominima = {
+ \once \property Voice.BreathingSign \override #'type = #'minima
+ \once \property Voice.BreathingSign \override #'molecule-callback = #Breathing_sign::divisio_minima
+ \breathe
+}
+divisiomaior = {
+ \once \property Voice.BreathingSign \override #'type = #'maior
+ \once \property Voice.BreathingSign \override #'molecule-callback = #Breathing_sign::divisio_maior
+ \once \property Voice.BreathingSign \override #'Y-offset-callbacks = #'()
+ \breathe
+}
+divisiomaxima = {
+ \once \property Voice.BreathingSign \override #'type = #'maxima
+ \once \property Voice.BreathingSign \override #'molecule-callback = #Breathing_sign::divisio_maxima
+ \once \property Voice.BreathingSign \override #'Y-offset-callbacks = #'()
+ \breathe
+}
+finalis = {
+ \once \property Voice.BreathingSign \override #'type = #'finalis
+ \once \property Voice.BreathingSign \override #'molecule-callback = #Breathing_sign::finalis
+ \once \property Voice.BreathingSign \override #'Y-offset-callbacks = #'()
+ \breathe
+}
staccatissimo = #(make-articulation "staccatissimo")
portato = #(make-articulation "portato")
fermata = #(make-articulation "fermata")
+shortfermata = #(make-articulation "shortfermata")
+longfermata = #(make-articulation "longfermata")
+verylongfermata = #(make-articulation "verylongfermata")
stopped = #(make-articulation "stopped")
staccato = #(make-articulation "staccato")
tenuto = #(make-articulation "tenuto")
downprall = #(make-articulation "downprall")
segno = #(make-articulation "segno")
coda = #(make-articulation "coda")
+varcoda = #(make-articulation "varcoda")
y_mirror_char;
fet_endchar;
+def draw_short_fermata =
+ save fat_factor, thinness, dot_radius;
+ set_char_box(staff_space#, staff_space#, 0, 2.2 staff_space#);
+ dot_radius# = 8/3*stafflinethickness#;
+ define_pixels(dot_radius)
+
+ fat_factor = .11;
+ thinness = 1.5 stafflinethickness;
+
+ pickup pencircle scaled thinness;
+ rt x2 = w;
+ lft x5 = -b;
+ bot y5 = 0;
+ top y3 = h;
+ y1 = y2 = y5;
+
+ x3 = 0;
+ z1 - z4 = whatever * (charwd, -charht);
+ z4 = fat_factor [z3, z5];
+
+ filldraw z1 -- z2 -- z3 -- z4 -- cycle;
+ draw z3 .. z5;
+
+ pickup pencircle scaled 2dot_radius;
+ x1 - 2x6 = x2;
+ bot y6 = -d;
+ drawdot z6;
+enddef;
+
+fet_beginchar("short fermata up", "ushortfermata", "ushortfermata")
+ draw_short_fermata;
+fet_endchar;
+
+fet_beginchar("short fermata down", "dshortfermata", "dshortfermata")
+ draw_short_fermata;
+ xy_mirror_char;
+fet_endchar;
+
+def draw_long_fermata =
+ save stemthick, beamheight, dot_radius, wd;
+ define_pixels(wd, dot_radius)
+
+ wd# = 2.5 staff_space#;
+ stemthick = 1.5 stafflinethickness;
+ beamheight = 4 stafflinethickness;
+ dot_radius# = 8/3*stafflinethickness#;
+ set_char_box(wd#/2, wd#/2, 0, 3/2 staff_space#);
+
+ draw_rounded_block((-b, h-beamheight), (w, h), blot_diameter);
+ draw_rounded_block((-b, -d),(-b+stemthick, h-stemthick), stemthick);
+ addto currentpicture also currentpicture xscaled -1;
+
+ pickup pencircle scaled 2dot_radius;
+ x4 = 0;
+ bot y4 = -d;
+ drawdot z4;
+enddef;
+
+fet_beginchar("long fermata up", "ulongfermata", "ulongfermata")
+ draw_long_fermata;
+fet_endchar;
+
+fet_beginchar("long fermata down", "dlongfermata", "dlongfermata")
+ draw_long_fermata;
+ y_mirror_char;
+fet_endchar;
+
+def draw_very_long_fermata =
+ save ibeamheight, obeamheight;
+ save ihwd, ohwd, iht, oht; % inner/outer half_width/height
+ save stemthick, dot_radius;
+ define_pixels(ihwd, ohwd, iht, oht, dot_radius)
+
+ ihwd# = 1.0 staff_space#;
+ ohwd# = 1.5 staff_space#;
+ iht# = 0.9 staff_space#;
+ oht# = 1.6 staff_space#;
+ stemthick = 1.5 stafflinethickness;
+ ibeamheight = 3 stafflinethickness;
+ obeamheight = 5 stafflinethickness;
+ dot_radius# = 8/3*stafflinethickness#;
+ set_char_box(ohwd#, ohwd#, 0, oht#);
+
+ draw_rounded_block((-ohwd, oht-obeamheight), (ohwd, oht), blot_diameter);
+ draw_rounded_block((-ohwd, 0),(-ohwd+stemthick, ohwd-stemthick), stemthick);
+ draw_rounded_block((-ihwd, iht-ibeamheight), (ihwd, iht), blot_diameter);
+ draw_rounded_block((-ihwd, 0),(-ihwd+stemthick, ihwd-stemthick), stemthick);
+ addto currentpicture also currentpicture xscaled -1;
+
+ pickup pencircle scaled 2dot_radius;
+ x4 = 0;
+ bot y4 = -d;
+ drawdot z4;
+enddef;
+
+fet_beginchar("very long fermata up", "uverylongfermata", "uverylongfermata")
+ draw_very_long_fermata;
+fet_endchar;
+
+fet_beginchar("very long fermata down", "dverylongfermata", "dverylongfermata")
+ draw_very_long_fermata;
+ y_mirror_char;
+fet_endchar;
+
%
% Thumbs are used in cello music.
% TODO : thumbs should look like the finger-font and should be placed in
fet_endchar;
+fet_beginchar("Varied Coda", "varcoda", "varcoda")
+ save thin, thick, codawidth, codaheight;
+ thin# = 1.2 stafflinethickness#;
+ thick# = 3.5 stafflinethickness#;
+ codawidth# = 2/3 staff_space#;
+ codaheight# = 1 staff_space#;
+ define_pixels(thin, thick, codawidth, codaheight);
+
+ set_char_box(codawidth#+thick#, codawidth#+thick#,
+ codaheight#+thick#, codaheight#+thick#);
+
+ x1 = -codawidth;
+ y1 = y2 - thin;
+ x2 = 0;
+ y2 = codaheight;
+ draw_rounded_block(z1, z2, thick);
+
+ x3 = x1;
+ y3 = -blot_diameter;
+ x4 = x1 + thick;
+ y4 = y2;
+ draw_rounded_block(z3, z4, thick);
+
+ addto currentpicture also currentpicture xscaled -1;
+ addto currentpicture also currentpicture yscaled -1;
+
+ draw_gridline((0,-h),(0,h),thin);
+ draw_gridline((-w,0),(w,0),thin);
+fet_endchar;
+
def draw_comma =
save alpha, thick, thin, ht;
alpha:=35;
xy_mirror_char;
fet_endchar;
+def draw_varcomma =
+ save thick, thin, ht, wd, alpha;
+ alpha:=35;
+ thin# = 1.2 stafflinethickness#;
+ thick# = 3 stafflinethickness#;
+ ht# = .6 staff_space#;
+ wd# = .25 staff_space#;
+ define_pixels(thin, thick, ht, alpha);
+ set_char_box(wd#, wd#, ht#, ht#);
+ z1 = (-b, -d);
+ z2 = (w, h);
+ draw_brush(z1, thin, z2, thick);
+enddef;
+
+fet_beginchar("Right Varied Comma","rvarcomma","rvarcomma");
+ draw_varcomma;
+fet_endchar;
+
+fet_beginchar("Left Varied Comma","lvarcomma","lvarcomma");
+ draw_varcomma;
+ xy_mirror_char;
+fet_endchar;
+
thick#:=1/24designsize;
define_blacker_pixels(thick);
(staff-bar . (minimum-space . 1.5))
(clef . (minimum-space . 2.0))
(first-note . (minimum-space . 1.0))
+ (right-edge . (extra-space . 0.1))
))
- (molecule-callback . ,Text_item::brew_molecule)
+ (molecule-callback . ,Breathing_sign::brew_molecule)
(lookup . name)
(font-family . music)
(text . "scripts-rcomma")
("fermata" .
((script-molecule . (feta . ("dfermata" . "ufermata")))
(direction . 1)))
+ ("shortfermata" .
+ ((script-molecule . (feta . ("dshortfermata" . "ushortfermata")))
+ (direction . 1)))
+ ("longfermata" .
+ ((script-molecule . (feta . ("dlongfermata" . "ulongfermata")))
+ (direction . 1)))
+ ("verylongfermata" .
+ ((script-molecule . (feta . ("dverylongfermata" . "uverylongfermata")))
+ (direction . 1)))
("stopped" .
((script-molecule . (feta . ("stopped" . "stopped")))
(direction . 1) ))
((script-molecule . (feta . ("lcomma" . "rcomma")))
(follow-into-staff . #t)
(direction . 1)))
+ ("varcomma" .
+ ((script-molecule . (feta . ("lvarcomma" . "rvarcomma")))
+ (follow-into-staff . #t)
+ (direction . 1)))
("upbow" .
((script-molecule . (feta . ("upbow" . "upbow")))
(direction . 1) ))
(direction . 1) ))
("coda" .
((script-molecule . (feta . ("coda" . "coda")))
+ (direction . 1) ))
+ ("varcoda" .
+ ((script-molecule . (feta . ("varcoda" . "varcoda")))
(direction . 1) )))
default-script-alist)
)