]> git.donarmstrong.com Git - lilypond.git/commitdiff
2002-09-10 Juergen Reuter <reuter@ipd.uka.de>
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 10 Sep 2002 22:24:51 +0000 (22:24 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 10 Sep 2002 22:24:51 +0000 (22:24 +0000)
* lily/stem.cc: added warning when font symbol not found;
small cleanups

ChangeLog
lily/stem.cc

index eebd381a1021576d7ac5f32e4aa57884ffeebc34..52c23ae1ee670fd9952b15a4fef792443facde81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+
+2002-09-10  Juergen Reuter  <reuter@ipd.uka.de>
+
+       * lily/stem.cc: added warning when font symbol not found;
+       small cleanups
+
 2002-09-11  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * mf/GNUmakefile: make PFA for sauter CM fonts.
index 510ca1b60d38a3e300fbebd7cbd2e8fe4e838c0a..c9deff1dc9c019a8e72b2ea6cbb7e3fa7ce2c7d8 100644 (file)
@@ -533,17 +533,12 @@ Stem::flag (Grob*me)
    e.g. "stroke-style", maybe with values "" (i.e. no stroke),
    "single" and "double".  Needs more discussion.
   */
-  String style, fstyle, staffline_offs;
-  SCM fst = me->get_grob_property ("flag-style");
-  if (gh_string_p (fst))
-    {
-      fstyle = ly_scm2string (fst);
-    }
+  String style, staffline_offs;
 
-  SCM st = me->get_grob_property ("style");
-  if (gh_symbol_p (st))
+  SCM style_scm = me->get_grob_property ("style");
+  if (gh_symbol_p (style_scm))
     {
-      style = (ly_scm2string (scm_symbol_to_string (st)));
+      style = (ly_scm2string (scm_symbol_to_string (style_scm)));
     }
   else
     {
@@ -585,10 +580,9 @@ Stem::flag (Grob*me)
            
            --hwn.
          */
-         Grob *first = first_head(me);
-         int sz = Staff_symbol_referencer::line_count (me)-1;
-         int p = (int)rint (Staff_symbol_referencer::get_position (first));
-         staffline_offs = (((p ^ sz) & 0x1) == 0) ? "1" : "0";
+         int p = (int)rint (Staff_symbol_referencer::get_position (first_head (me)));
+         staffline_offs = Staff_symbol_referencer::on_staffline (me, p) ?
+           "1" : "0";
        }
       else
         {
@@ -599,14 +593,36 @@ Stem::flag (Grob*me)
     {
       staffline_offs = "";
     }
-  char c = (get_direction (me) == UP) ? 'u' : 'd';
-  String index_string
-    = String ("flags-") + style + to_string (c) + staffline_offs + to_string (duration_log (me));
-  Molecule m
-    = Font_interface::get_default_font (me)->find_by_name (index_string);
-  if (!fstyle.empty_b ())
-    m.add_molecule (Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_string (c) + fstyle));
-  return m;
+  char dir = (get_direction (me) == UP) ? 'u' : 'd';
+  String font_char =
+    style + to_string (dir) + staffline_offs + to_string (duration_log (me));
+  Font_metric *fm = Font_interface::get_default_font (me);
+  Molecule flag = fm->find_by_name ("flags-" + font_char);
+  if (flag.empty_b ())
+    {
+      me->warning (_f ("flag `%s' not found", font_char));
+    }
+
+  SCM stroke_scm = me->get_grob_property ("flag-style");
+  if (gh_string_p (stroke_scm))
+    {
+      String stroke = ly_scm2string (stroke_scm);
+      if (!stroke.empty_b ())
+       {
+         String font_char = to_string (dir) + stroke;
+         Molecule stroke = fm->find_by_name ("flags-" + font_char);
+         if (stroke.empty_b ())
+           {
+             me->warning (_f ("flag stroke `%s' not found", font_char));
+           }
+         else
+           {
+             flag.add_molecule (stroke);
+           }
+       }
+    }
+
+  return flag;
 }
 
 MAKE_SCHEME_CALLBACK (Stem,dim_callback,2);