]> git.donarmstrong.com Git - lilypond.git/commitdiff
Juergen's patch
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Mar 2003 00:05:20 +0000 (00:05 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 22 Mar 2003 00:05:20 +0000 (00:05 +0000)
ChangeLog
lily/breathing-sign.cc
lily/include/breathing-sign.hh
ly/gregorian-init.ly
ly/script-init.ly
mf/feta-schrift.mf
scm/grob-description.scm
scm/script.scm

index 053a50fd3259b50732792a479bd4fd1a0d2296d7..7aa98f67d9f2e5992f5d48377dcd38e31ed74a6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+
+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}: 
index 63067deff1847cc86749361243101fa268246c5d..5233d4bf2b3ee378665c72513ec10588862ae45a 100644 (file)
@@ -7,6 +7,7 @@
 
   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 ();
 }
 
 /*
@@ -57,6 +73,147 @@ Breathing_sign::railtracks (SCM smob)
   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
@@ -76,7 +233,6 @@ Breathing_sign::offset_callback (SCM element_smob, SCM)
   return gh_double2scm (inter_f * sz * d);
 }
 
-
 ADD_INTERFACE(Breathing_sign, "breathing-sign-interface",
              "A breathing sign.",
              "direction");
index d2ad496ffb93f8dc832baeeeb0d4c7a1187d6eea..dd865e38fd029c2865b9d32fd0eef86d576fce04 100644 (file)
@@ -21,6 +21,10 @@ class Breathing_sign
 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*);
index 794c843200196e78dde4201e62818b89bed3dabc..19e6d76c4ecfeb2b829aa0fb3436d5f3907be635 100644 (file)
@@ -1,9 +1,12 @@
 \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 =
@@ -30,3 +33,40 @@ quilisma =
   \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
+}
index a1ac9851811de004d5969295b9edd4c64b41946d..dcb2f26bf615dd7d9119e4e01bdc533ec12ad02a 100644 (file)
@@ -15,6 +15,9 @@ marcato = #(make-articulation "marcato")
 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")
@@ -42,3 +45,4 @@ upprall = #(make-articulation "upprall")
 downprall = #(make-articulation "downprall")
 segno = #(make-articulation "segno")
 coda = #(make-articulation "coda")
+varcoda = #(make-articulation "varcoda")
index 0339af08691d07c9b0f6fa023b1c2069ae7083a8..9348bcbe74586fd4514ad8bbee67c00778299d81 100644 (file)
@@ -57,6 +57,110 @@ fet_beginchar("fermata down", "dfermata", "dfermata")
        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
@@ -708,6 +812,36 @@ fet_beginchar("Coda", "coda", "coda")
 
 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;
@@ -741,6 +875,29 @@ fet_beginchar("Left Comma","lcomma","lcomma");
        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);
 
index 44bc694e13c5d31975cfb1ed564ede3244db4159..bc66de7186a8f0c2bb93094cc7c40939ca68ef87 100644 (file)
                        (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")
index da60857e283906b1a1dd516d7df4c3ae4d1fa9d2..4e2ded26f9a1e87405a40aab3597f03689270557 100644 (file)
         ("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)
       )