]> git.donarmstrong.com Git - lilypond.git/commitdiff
Making flat flags available
authorThomas Morley <thomasmorley65@gmail.com>
Wed, 2 Oct 2013 21:31:50 +0000 (23:31 +0200)
committerThomas Morley <thomasmorley65@gmail.com>
Fri, 11 Oct 2013 19:39:02 +0000 (21:39 +0200)
Issue 3591

The markup-command 'note-ny-number' and the relvant regression-
tests are extended, too.
The sippet 'using-alternative-flag-styles.ly' from
Documentation/snippets/new/ isn't changed for now, will be tackled
in a follow up.

input/regression/flags-straight.ly
input/regression/markup-note-styles.ly
input/regression/markup-note.ly
scm/define-markup-commands.scm
scm/flag-styles.scm

index 80eb28c7f63de3586aa10e22dc0da8eb295ffd18..7e96536e6adde60dd9c00e9bd945f2d9c6c58299 100644 (file)
@@ -6,7 +6,7 @@
 
 
 % test notes, which will be shown in different styles:
-testnotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64 
+testnotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64
    c''8 d''16 c''32 d''64 \acciaccatura {\stemDown c''8 \stemNeutral} d''64  }
 
 {
@@ -19,9 +19,13 @@ testnotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64
   \mark "old straight (large angles)"
   \override Flag.stencil = #old-straight-flag
   \testnotes
+
+  \mark "flat"
+  \override Flag.stencil = #flat-flag
+  \testnotes
 %
 %   \mark "custom slant"
-% %   Custom straight flag. The parameters are: 
+% %   Custom straight flag. The parameters are:
 % %                flag thickness and spacing
 % %                up-flag angle and length
 % %               down-flag angle and length
index 224eaf69d0886fbdc3415874fc4227004ecdc690..f5fbc9b60d2671170f61920fbf415b857e78e8b7 100644 (file)
@@ -61,3 +61,12 @@ all note head styles and straight flags."
     \show-note-styles #'(default)
   }
 }
+
+\markup {
+  \column {
+    \combine \null \vspace #1
+    \underline "Flat-flag:"
+    \override #'(flag-style . flat-flag)
+    \show-note-styles #'(default)
+  }
+}
index 307336799b8493a96a3b366b2fb87577db2fd384..c600fab42f9d83e08242ea82fe5d4cecf8b96a56 100644 (file)
@@ -58,6 +58,7 @@ mrkp =
                     \override #'(style . mensural) \mrkp
                     \override #'(flag-style . modern-straight-flag) \mrkp
                     \override #'(flag-style . old-straight-flag) \mrkp
+                    \override #'(flag-style . flat-flag) \mrkp
             }
     }
     \override NoteHead.style = #'triangle
index 6de7c9a8f42fad8ca68f9909901862e78cb9323f..9e5528f5bb2a7eafa0d7eb1d6de990463245f650 100644 (file)
@@ -3319,8 +3319,8 @@ A feta brace in point size @var{size}, rotated 180 degrees.
 Construct a note symbol, with stem and flag.  By using fractional values for
 @var{dir}, longer or shorter stems can be obtained.
 Supports all note-head-styles.
-Supported flag-styles are @code{default}, @code{old-straight-flag} and
-@code{modern-straight-flag}.
+Supported flag-styles are @code{default}, @code{old-straight-flag},
+@code{modern-straight-flag} and @code{flat-flag}.
 
 @lilypond[verbatim,quote]
 \\markup {
@@ -3381,7 +3381,9 @@ Supported flag-styles are @code{default}, @code{old-straight-flag} and
            (raw-length (if stem-up upflag-length downflag-length))
            (angle (if stem-up upflag-angle downflag-angle))
            (flag-length (+ (* raw-length factor) half-stem-thickness))
-           (flag-end (polar->rectangular flag-length angle))
+           (flag-end (if (= angle 0)
+                         (cons flag-length (* half-stem-thickness dir))
+                         (polar->rectangular flag-length angle)))
            (thickness (* flag-thickness factor))
            (thickness-offset (cons 0 (* -1 thickness dir)))
            (spacing (* -1 flag-spacing factor dir))
@@ -3389,9 +3391,11 @@ Supported flag-styles are @code{default}, @code{old-straight-flag} and
            ;; The points of a round-filled-polygon need to be given in
            ;; clockwise order, otherwise the polygon will be enlarged by
            ;; blot-size*2!
-           (points (if stem-up (list start flag-end
-                                     (offset-add flag-end thickness-offset)
-                                     (offset-add start thickness-offset))
+           (points (if stem-up
+                       (list start
+                             flag-end
+                             (offset-add flag-end thickness-offset)
+                             (offset-add start thickness-offset))
                        (list start
                              (offset-add start thickness-offset)
                              (offset-add flag-end thickness-offset)
@@ -3456,10 +3460,12 @@ Supported flag-styles are @code{default}, @code{old-straight-flag} and
          ;; Straight-flags. Values taken from /scm/flag-style.scm
          (modern-straight-flag (straight-flag-mrkp 0.55 1 -18 1.1 22 1.2 dir))
          (old-straight-flag (straight-flag-mrkp 0.55 1 -45 1.2 45 1.4 dir))
+         (flat-flag (straight-flag-mrkp 0.55 1.0 0 1.0 0 1.0 dir))
          ;; Calculate a corrective to avoid a gap between
          ;; straight-flags and the stem.
          (flag-style-Y-corr (if (or (eq? flag-style 'modern-straight-flag)
-                                    (eq? flag-style 'old-straight-flag))
+                                    (eq? flag-style 'old-straight-flag)
+                                    (eq? flag-style 'flat-flag))
                                 (/ blot 10 (* -1 dir))
                                 0))
          (flaggl (and (> log 2)
@@ -3468,6 +3474,8 @@ Supported flag-styles are @code{default}, @code{old-straight-flag} and
                               modern-straight-flag)
                              ((eq? flag-style 'old-straight-flag)
                               old-straight-flag)
+                             ((eq? flag-style 'flat-flag)
+                              flat-flag)
                              (else
                               (ly:font-get-glyph font
                                                  (format #f (if ancient-flags?
index c8fea1ae5d8e655ee5d61701f61b7b577072dc47..59495ba40b884f33968a7f526f592a42bb590dc9 100644 (file)
@@ -16,7 +16,8 @@
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;;;  This file implements different flag styles in Scheme / GUILE, most
-;;;;  notably the old-straight-flag and the modern-straight-flag styles.
+;;;;  notably the old-straight-flag, the modern-straight-flag and the flat-flag
+;;;;  styles.
 
 
 (define-public (no-flag grob)
@@ -80,16 +81,22 @@ All lengths are scaled according to the font size of the note."
            (raw-length (if stem-up upflag-length downflag-length))
            (angle (if stem-up upflag-angle downflag-angle))
            (flag-length (+ (* raw-length factor) half-stem-thickness))
-           (flag-end (polar->rectangular flag-length angle))
+           ;; For flat flags the points to create the stencil using
+           ;; ly:round-filled-polygon need to be different concerning flag-end
+           (flag-end (if (= angle 0)
+                         (cons flag-length (* half-stem-thickness dir))
+                         (polar->rectangular flag-length angle)))
            (thickness (* flag-thickness factor))
            (thickness-offset (cons 0 (* -1 thickness dir)))
            (spacing (* -1 flag-spacing factor dir ))
            (start (cons (- half-stem-thickness) (* half-stem-thickness dir)))
            ;; The points of a round-filled-polygon need to be given in clockwise
            ;; order, otherwise the polygon will be enlarged by blot-size*2!
-           (points (if stem-up (list start flag-end
-                                     (offset-add flag-end thickness-offset)
-                                     (offset-add start thickness-offset))
+           (points (if stem-up
+                       (list start
+                             flag-end
+                             (offset-add flag-end thickness-offset)
+                             (offset-add start thickness-offset))
                        (list start
                              (offset-add start thickness-offset)
                              (offset-add flag-end thickness-offset)
@@ -118,6 +125,10 @@ of Bach, etc."
 flags are both 45 degrees."
   ((straight-flag 0.55 1 -45 1.2 45 1.4) grob))
 
+(define-public (flat-flag grob)
+  "Flat flag style.  The angles of the flags are both 0 degrees"
+  ((straight-flag 0.55 1.0 0 1.0 0 1.0) grob))
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;  Flags created from feta glyphs (normal and mensural flags)