Package: musescore2 / 2.3.2+dfsg4-16

upstream/lyrics-hyphen-syllable-closer.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Description: Draw the first and last hyphen closer to the syllable
Author: mirabilos <m@mirbsd.org>
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));
             }