]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tuplet-bracket.cc
* mf/GNUmakefile: always trace pfa fonts.
[lilypond.git] / lily / tuplet-bracket.cc
index 82cca6b7aeb0a69cc947e0a4bfd9ac31602a359f..306ff7b679258e8575d4a5e6af402342d8199db6 100644 (file)
@@ -150,15 +150,17 @@ Tuplet_bracket::brew_molecule (SCM smob)
   Real x1 = rgr->extent (commonx,X_AXIS)[RIGHT];
 
   Real w = x1 -x0;
-
+  
   Real ly = gh_scm2double (me->get_grob_property ("left-position"));
   Real ry = gh_scm2double (me->get_grob_property ("right-position"));  
   SCM number = me->get_grob_property ("text");
-  
+
+  Paper_def *pap = me->get_paper ();
   if (gh_string_p (number) && number_visibility)
     {
       SCM properties = Font_interface::font_alist_chain (me);
-      Molecule num = Text_item::interpret_new_markup (smob, properties, number);
+      SCM snum = Text_item::interpret_markup (pap->self_scm (), properties, number);
+      Molecule num = *unsmob_molecule (snum);
       num.align_to (X_AXIS, CENTER);
       num.translate_axis (w/2, X_AXIS);
       num.align_to (Y_AXIS, CENTER);
@@ -167,16 +169,29 @@ Tuplet_bracket::brew_molecule (SCM smob)
 
       mol.add_molecule (num);
     }
-      
-  if (bracket_visibility)      
+
+
+  /*
+    No bracket when it would be smaller than the number.
+
+    TODO: should use GAP in calculation too.
+   */
+  if (bracket_visibility && number_visibility
+      && mol.extent (X_AXIS).length () > w)
     {
-      Real  lt =  me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
+      bracket_visibility = false;
+    }
   
+  if (bracket_visibility)      
+    {
+      Real  lt =  pap->get_realvar (ly_symbol2scm ("linethickness"));
+
       SCM thick = me->get_grob_property ("thickness");
       if (gh_number_p (thick))
        lt *= gh_scm2double (thick);
-      
+
       SCM gap = me->get_grob_property ("gap");
+      
       SCM fl = me->get_grob_property ("bracket-flare");
       SCM eh = me->get_grob_property ("edge-height");
       SCM sp = me->get_grob_property ("shorten-pair");
@@ -185,11 +200,11 @@ Tuplet_bracket::brew_molecule (SCM smob)
       Drul_array<Real> height, flare, shorten;
       do {
        flare[d] =  height[d] = shorten[d] = 0.0;
-       if (ly_number_pair_p (fl))
+       if (is_number_pair (fl))
          flare[d] +=  gh_scm2double (index_get_cell (fl, d));
-       if (ly_number_pair_p (eh))
+       if (is_number_pair (eh))
          height[d] += gh_scm2double (index_get_cell (eh, d)) * - dir;
-       if (ly_number_pair_p (sp))
+       if (is_number_pair (sp))
          shorten[d] +=  gh_scm2double (index_get_cell (sp, d));
       }
       while (flip (&d) != LEFT);