From 064d3724b88e6a8b82dc2b5e0c4d9a3b50250fde Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Sun, 14 Sep 2008 18:35:15 +0100 Subject: [PATCH] Piano pedal markup test --- lily/piano-pedal-engraver.cc | 3 ++- lily/sustain-pedal.cc | 38 ++++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index b3021cb..d99fb54 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -22,6 +22,7 @@ #include "staff-symbol-referencer.hh" #include "stream-event.hh" #include "string-convert.hh" +#include "text-interface.hh" #include "warn.hh" #include "spanner.hh" #include "item.hh" @@ -322,7 +323,7 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, bool mixed) s = scm_car (strings); } - if (scm_is_string (s)) + if (Text_interface::is_markup (s)) { const char *propname = p->type_->pedal_c_str_; diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index 8056ea8..6ca6c6e 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -8,6 +8,8 @@ #include "grob.hh" #include "stencil.hh" #include "font-interface.hh" +#include "output-def.hh" +#include "text-interface.hh" // update comment --hwn /* @@ -41,26 +43,34 @@ Sustain_pedal::print (SCM smob) Stencil mol; SCM glyph = e->get_property ("text"); - if (!scm_is_string (glyph)) - return mol.smobbed_copy (); + + if (scm_is_string (glyph)) + { - string text = ly_scm2string (glyph); + string text = ly_scm2string (glyph); - for (ssize i = 0; i < text.length (); i++) - { - string idx ("pedal."); - if (text.substr (i, 3) == "Ped") + for (ssize i = 0; i < text.length (); i++) { - idx += "Ped"; - i += 2; + string idx ("pedal."); + if (text.substr (i, 3) == "Ped") + { + idx += "Ped"; + i += 2; + } + else + idx += string (&text.c_str ()[i], 1); + Stencil m = Font_interface::get_default_font (e)->find_by_name (idx); + if (!m.is_empty ()) + mol.add_at_edge (X_AXIS, RIGHT, m, 0); } - else - idx += string (&text.c_str ()[i], 1); - Stencil m = Font_interface::get_default_font (e)->find_by_name (idx); - if (!m.is_empty ()) - mol.add_at_edge (X_AXIS, RIGHT, m, 0); } + else if (Text_interface::is_markup (glyph)) + { + SCM chain = Font_interface::text_font_alist_chain (e); + return Text_interface::interpret_markup (e->layout ()->self_scm (), + chain, glyph); + } return mol.smobbed_copy (); } -- 1.5.4.3