]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/flag.cc
Merge remote-tracking branch 'origin/translation' into staging
[lilypond.git] / lily / flag.cc
index 77491befd6df84fb3d922718f7c7d82bfa73a5ce..58641d37b010d1613d0d7f5d087ea40a8408eac2 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -105,7 +105,7 @@ Flag::glyph_name (SCM smob)
 
   char dir = (d == UP) ? 'u' : 'd';
   string font_char = flag_style
-                     + to_string (dir) + staffline_offs + to_string (log);
+                     + ::to_string (dir) + staffline_offs + ::to_string (log);
   return ly_string2scm ("flags." + font_char);
 }
 
@@ -143,11 +143,11 @@ Flag::print (SCM smob)
       string stroke_style = ly_scm2string (stroke_style_scm);
       if (!stroke_style.empty ())
         {
-          string font_char = flag_style + to_string (dir) + stroke_style;
+          string font_char = flag_style + ::to_string (dir) + stroke_style;
           Stencil stroke = fm->find_by_name ("flags." + font_char);
           if (stroke.is_empty ())
             {
-              font_char = to_string (dir) + stroke_style;
+              font_char = ::to_string (dir) + stroke_style;
               stroke = fm->find_by_name ("flags." + font_char);
             }
           if (stroke.is_empty ())
@@ -186,11 +186,13 @@ Flag::internal_calc_y_offset (SCM smob, bool pure)
   Real blot
     = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
 
-  Real y2 = pure
-            ? stem->pure_height (stem, 0, INT_MAX)[d]
-            : stem->extent (stem, Y_AXIS)[d];
+  Interval stem_extent = pure
+                         ? stem->pure_height (stem, 0, INT_MAX)
+                         : stem->extent (stem, Y_AXIS);
 
-  return scm_from_double (y2 - d * blot / 2);
+  return scm_from_double (stem_extent.is_empty ()
+                          ? 0.0
+                          : stem_extent[d] - d * blot / 2);
 }
 
 MAKE_SCHEME_CALLBACK (Flag, calc_x_offset, 1);