]> git.donarmstrong.com Git - lilypond.git/commitdiff
2002-09-13 Juergen Reuter <reuter@ipd.uka.de>
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 13 Sep 2002 21:13:48 +0000 (21:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 13 Sep 2002 21:13:48 +0000 (21:13 +0000)
* lily/rests.ly: added comment on bogus warnings about missing flags

* lily/clef.cc, lily/rests.cc: added warning when font character
lookup fails.

* lily/rests.cc: workaround: consider missing ledgered rests in
ancient font.

* lily/rests.cc: bugfix: cleaned up font lookup code that handles
special cases of styles 'default' and 'classical'.  This should
also fix the behaviour of lily/multi-measure-rest.cc, which so far
did not consider styles 'default' and 'classical'.

ChangeLog
input/test/rests.ly
lily/clef.cc
lily/rest.cc

index 8388bff45521403d3d5351d0e6f2313f42591e43..1689e41a70d858b114e0c2da891bab95aa5f5911 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2002-09-13  Juergen Reuter  <reuter@ipd.uka.de>
+
+       * lily/rests.ly: added comment on bogus warnings about missing flags
+
+       * lily/clef.cc, lily/rests.cc: added warning when font character
+       lookup fails.
+
+       * lily/rests.cc: workaround: consider missing ledgered rests in
+       ancient font.
+
+       * lily/rests.cc: bugfix: cleaned up font lookup code that handles
+       special cases of styles 'default' and 'classical'.  This should
+       also fix the behaviour of lily/multi-measure-rest.cc, which so far
+       did not consider styles 'default' and 'classical'.
+
 2002-09-13  Rune Zedeler  <rune@zedeler.dk>
 
        * scm/drums.scm: "set" the automatic properties instead of
index 8b408d46cefbdff124d558b01fad47e7b7c90122..a1aa622d3005a4c8c5cab71b4df8fb4da561fcd0 100644 (file)
@@ -3,6 +3,10 @@
     texidoc = "rests in various styles."
 }
 
+% FIXME: Currently, this file produces "warning: flag `d-3' not found"
+% errors (and similar for "d7") from Stem::flag().  This is should not
+% happen, since there are no notes/stems in this example.
+
 \score { 
     \context Staff \notes\relative c {
        \property Staff.Rest \set #'style = #'mensural
@@ -28,7 +32,7 @@
     \paper {
        \translator {
            \StaffContext
-           %%%% The following looks good, but produces
+           %%%% FIXME: The following looks good, but produces
            %%%% lots of warnings:
            % \remove Bar_engraver
        }
index 9a2eec2e3a68d043f88f7a34a835b7fb07091e93..062d7b81efbd189f5666d90bc2773225aa499a4f 100644 (file)
@@ -19,7 +19,7 @@ MAKE_SCHEME_CALLBACK (Clef,before_line_breaking,1);
 SCM
 Clef::before_line_breaking (SCM smob)
 {
-  Item * s = unsmob_item (smob);
+  Item *s = unsmob_item (smob);
 
   SCM glyph = s->get_grob_property ("glyph-name");
   
@@ -51,16 +51,19 @@ MAKE_SCHEME_CALLBACK (Clef,brew_molecule,1)
 SCM
 Clef::brew_molecule (SCM smob) 
 {
-  Grob * sc = unsmob_grob (smob);
-  SCM glyph = sc->get_grob_property ("glyph-name");
-  if (gh_string_p (glyph))
-    {
-      return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).smobbed_copy ();
-    }
-  else
+  Grob *me = unsmob_grob (smob);
+  SCM glyph_scm = me->get_grob_property ("glyph-name");
+  if (!gh_string_p (glyph_scm))
+    return SCM_EOL;
+
+  String glyph = String (ly_scm2string (glyph_scm));
+  Font_metric *fm = Font_interface::get_default_font (me);
+  Molecule out = fm->find_by_name (glyph);
+  if (out.empty_b())
     {
-      return SCM_EOL;
+      me->warning (_f ("clef `%s' not found", glyph.to_str0 ()));
     }
+  return out.smobbed_copy ();
 }
 
 
index 9cdd9078c71148974e9852771f5105dd42209192..4f135a31caedf8b216dad16dabf3f3b440c3410d 100644 (file)
@@ -48,11 +48,10 @@ Rest::after_line_breaking (SCM smob)
 /*
   make this function easily usable in C++
  */
-
 String
-Rest::glyph_name (Grob * me, int balltype, String style)
+Rest::glyph_name (Grob *me, int balltype, String style)
 {
-  bool ledger_b =false;
+  bool ledgered_b = false;
 
   if (balltype == 0 || balltype == 1)
     {
@@ -63,18 +62,49 @@ Rest::glyph_name (Grob * me, int balltype, String style)
        Figure out when the rest is far enough outside the staff. This
        could bemore generic, but hey, we understand this even after
        dinner.
-       
        */
-      ledger_b = ledger_b || (balltype == 0 && (pos >= rad +2   || pos < -rad ));
-      ledger_b = ledger_b || (balltype == 1 &&
-                             (pos  <= -rad -2 || pos > rad));
+      ledgered_b |= (balltype == 0) && (pos >= +rad + 2 || pos < -rad);
+      ledgered_b |= (balltype == 1) && (pos <= -rad - 2 || pos > +rad);
     }
 
-  return ("rests-") + to_string (balltype)
-    + (ledger_b ? "o" : "") + style;
-}
+  String actual_style (style.to_str0 ());
+
+  if ((style == "mensural") || (style == "neo_mensural")) {
+
+    /*
+      FIXME: Currently, ancient font does not provide ledgered rests;
+      hence the "o" suffix in the glyph name is bogus.  But do we need
+      ledgered rests at all now that we can draw ledger lines with
+      variable width, length and blotdiameter? -- jr
+    */
+    ledgered_b = 0;
+
+    /*
+      There are no 32th/64th/128th mensural/neo_mensural rests.  In
+      these cases, revert back to default style.
+    */
+    if (balltype > 4)
+      actual_style = "";
+  }
+
+  if ((style == "classical") && (balltype != 2)) {
+    /*
+      classical style: revert back to default style for any rest other
+      than quarter rest
+    */
+    actual_style = "";
+  }
 
+  if (style == "default") {
+    /*
+      Some parts of lily still prefer style "default" over "".
+      Correct this here. -- jr
+    */
+    actual_style = "";
+  }
 
+  return ("rests-") + to_string (balltype) + (ledgered_b ? "o" : "") + actual_style;
+}
 
 
 MAKE_SCHEME_CALLBACK (Rest,brew_molecule,1);
@@ -91,20 +121,21 @@ Rest::brew_internal_molecule (SCM smob)
   int balltype = gh_scm2int (balltype_scm);
   
   String style; 
-  SCM style_sym =me->get_grob_property ("style");
-  if (gh_symbol_p (style_sym))
+  SCM style_scm = me->get_grob_property ("style");
+  if (gh_symbol_p (style_scm))
     {
-      style = ly_scm2string (scm_symbol_to_string (style_sym));
+      style = ly_scm2string (scm_symbol_to_string (style_scm));
     }
 
-  for(;;) {
-    String idx = glyph_name (me, balltype, style);
-    Molecule res = Font_interface::get_default_font (me)->find_by_name (idx);
-    if(res.empty_b() && style!="")
-      style="";
-    else
-      return res.smobbed_copy();
-  }
+  Font_metric *fm = Font_interface::get_default_font (me);
+  String font_char = glyph_name (me, balltype, style);
+  Molecule out = fm->find_by_name (font_char);
+  if (out.empty_b())
+    {
+      me->warning (_f ("rest `%s' not found, ", font_char.to_str0 ()));
+    }
+
+  return out.smobbed_copy();
 }
 
 SCM