X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fhyphen-engraver.cc;h=24b8665e80d111ffd9d401af5e474d083ddfceef;hb=50bbf0233e7cb45a295d95f5e355e64aad762d70;hp=989c8fb32cba3e9ad0abfc82aa88e77d141f0351;hpb=cc676c5aadd45985251b5d60fa23eed1ed98f6e6;p=lilypond.git diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index 989c8fb32c..24b8665e80 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -1,11 +1,22 @@ /* - hyphen-engraver.cc -- implement Hyphen_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter - - (c) 1999--2006 Glen Prideaux , + Copyright (C) 1999--2010 Glen Prideaux , Han-Wen Nienhuys , Jan Nieuwenhuizen + + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "engraver.hh" @@ -25,6 +36,7 @@ class Hyphen_engraver : public Engraver Spanner *hyphen_; Spanner *finished_hyphen_; + bool current_lyric_is_skip_; public: TRANSLATOR_DECLARATIONS (Hyphen_engraver); @@ -42,6 +54,7 @@ protected: Hyphen_engraver::Hyphen_engraver () { + current_lyric_is_skip_ = false; hyphen_ = 0; finished_hyphen_ = 0; finished_ev_ = 0; @@ -52,14 +65,16 @@ void Hyphen_engraver::acknowledge_lyric_syllable (Grob_info i) { Item *item = i.item (); + SCM text = item->get_property ("text"); + current_lyric_is_skip_ = ly_is_equal (text, scm_from_locale_string (" ")); - if (!hyphen_) + if (!hyphen_ && !current_lyric_is_skip_) hyphen_ = make_spanner ("LyricSpace", item->self_scm ()); if (hyphen_) hyphen_->set_bound (LEFT, item); - if (finished_hyphen_) + if (finished_hyphen_ && !current_lyric_is_skip_) finished_hyphen_->set_bound (RIGHT, item); } @@ -127,7 +142,7 @@ Hyphen_engraver::stop_translation_timestep () finished_ev_ = 0; } - if (finished_hyphen_ && hyphen_) + if (finished_hyphen_ && hyphen_ && !current_lyric_is_skip_) { programming_error ("hyphen not finished yet"); finished_hyphen_ = 0; @@ -147,9 +162,16 @@ Hyphen_engraver::stop_translation_timestep () ADD_ACKNOWLEDGER (Hyphen_engraver, lyric_syllable); ADD_TRANSLATOR (Hyphen_engraver, - /* doc */ "Create lyric hyphens and " - "distance constraints between words.", - /* create */ "LyricHyphen LyricSpace", - /* accept */ "hyphen-event", - /* read */ "", - /* write */ ""); + /* doc */ + "Create lyric hyphens and distance constraints between words.", + + /* create */ + "LyricHyphen " + "LyricSpace ", + + /* read */ + "", + + /* write */ + "" + );