-
-/*
- Urg.
- This is almost text
- Problem is:
- * we have no kerning
- * symbols are at wrong place in font
-*/
-
-class Sustain_pedal : public Item
-{
-public:
- VIRTUAL_COPY_CONS (Score_element);
-
-protected:
- virtual Molecule do_brew_molecule () const;
- virtual void after_line_breaking ();
-};
-
-void
-Sustain_pedal::after_line_breaking ()
-{
- Side_position_interface i (this);
- Direction d = i.get_direction ();
- i.set_direction (d);
-}
-
-Molecule
-Sustain_pedal::do_brew_molecule () const
-{
- Molecule mol;
- SCM glyph = get_elt_property ("glyph");
- if (glyph == SCM_UNDEFINED)
- return mol;
- String text = ly_scm2string (glyph);
-
- for (int i = 0; i < text.length_i (); i++)
- {
- // leuke koor dump door tiepo, snapnie helemaal:
- //String idx = ("pedal-") + text[i];
- // urg, Byte* ??
- // braak: waarom vindt String het zo moeilijk om
- // String + char te doen?
- //String idx = "pedal-" + String (&text.byte_C ()[i], 1);
- String idx = String ("pedal-") + String (&text.byte_C ()[i], 1);
- Molecule m = lookup_l ()->afm_find (idx);
- if (m.empty_b ())
- continue;
- Real kern = 0;
- if (i)
- {
- SCM s = scm_eval (gh_list (ly_symbol2scm ("pedal-kerning"),
- ly_str02scm (String (&text.byte_C ()[i - 1], 1).ch_C ()),
- ly_str02scm (String (&text.byte_C ()[i], 1).ch_C ()),
- SCM_UNDEFINED));
- if (gh_number_p (s))
- {
- Staff_symbol_referencer_interface st (this);
- Real staff_space = st.staff_space ();
- kern = gh_scm2double (s) * staff_space;
- }
- }
- mol.add_at_edge (X_AXIS, RIGHT, m, kern);
- }
-
- return mol;
-}
-
-
-