Description: Draw the first and last hyphen closer to the syllable Author: mirabilos Applied-Upstream: master, commit:2c78cd4, v3.0 --- a/libmscore/lyrics.cpp +++ b/libmscore/lyrics.cpp @@ -22,7 +22,7 @@ namespace Ms { // some useful values: static const qreal HALF = 0.5; -static const qreal TWICE = 2.0; +static const qreal MINTWODASHES = 1.5; //--------------------------------------------------------- // searchNextLyrics @@ -881,13 +881,13 @@ void LyricsLineSegment::layout() else // if within system _numOfDashes = 0; // draw no dash } - else if (len < (Lyrics::LYRICS_DASH_DEFAULT_STEP * TWICE * sp)) { // if no room for two dashes + else if (len < (Lyrics::LYRICS_DASH_DEFAULT_STEP * MINTWODASHES * sp)) { // if no room for two dashes _numOfDashes = 1; // draw one dash if (_dashLength > len) // if no room for a full dash _dashLength = len; // shorten it } else - _numOfDashes = len / (Lyrics::LYRICS_DASH_DEFAULT_STEP * sp);// draw several dashes + _numOfDashes = len / (Lyrics::LYRICS_DASH_DEFAULT_STEP * sp) + 1;// draw several dashes } // set bounding box @@ -914,8 +914,8 @@ void LyricsLineSegment::draw(QPainter* p if (lyricsLine()->lyrics()->ticks() > 0) // melisma painter->drawLine(QPointF(), pos2()); else { // dash(es) - qreal step = pos2().x() / (_numOfDashes+1); - qreal x = step - _dashLength * HALF; + qreal step = pos2().x() / _numOfDashes; + qreal x = step * HALF - _dashLength * HALF; for (int i = 0; i < _numOfDashes; i++, x += step) painter->drawLine(QPointF(x, 0.0), QPointF(x + _dashLength, 0.0)); }