lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making flat flags available (issue 14303044)


From: thomasmorley65
Subject: Making flat flags available (issue 14303044)
Date: Wed, 02 Oct 2013 22:05:03 +0000

Reviewers: ,

Message:
Please review.

Description:
Making flat flags available

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.

Please review this at https://codereview.appspot.com/14303044/

Affected files (+41, -12 lines):
  M input/regression/flags-straight.ly
  M input/regression/markup-note-styles.ly
  M input/regression/markup-note.ly
  M scm/define-markup-commands.scm
  M scm/flag-styles.scm


Index: input/regression/flags-straight.ly
diff --git a/input/regression/flags-straight.ly b/input/regression/flags-straight.ly index 80eb28c7f63de3586aa10e22dc0da8eb295ffd18..2d0c5280475d65245d5f5768437c9074d11dc711 100644
--- a/input/regression/flags-straight.ly
+++ b/input/regression/flags-straight.ly
@@ -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 }

 {
@@ -21,7 +21,7 @@ testnotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64
   \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: input/regression/markup-note-styles.ly
diff --git a/input/regression/markup-note-styles.ly b/input/regression/markup-note-styles.ly index 224eaf69d0886fbdc3415874fc4227004ecdc690..f5fbc9b60d2671170f61920fbf415b857e78e8b7 100644
--- a/input/regression/markup-note-styles.ly
+++ b/input/regression/markup-note-styles.ly
@@ -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: input/regression/markup-note.ly
diff --git a/input/regression/markup-note.ly b/input/regression/markup-note.ly index 307336799b8493a96a3b366b2fb87577db2fd384..c600fab42f9d83e08242ea82fe5d4cecf8b96a56 100644
--- a/input/regression/markup-note.ly
+++ b/input/regression/markup-note.ly
@@ -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: scm/define-markup-commands.scm
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index 6de7c9a8f42fad8ca68f9909901862e78cb9323f..5326629534aa49525f16cffc21de6d555beefa1f 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -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: scm/flag-styles.scm
diff --git a/scm/flag-styles.scm b/scm/flag-styles.scm
index c8fea1ae5d8e655ee5d61701f61b7b577072dc47..9fc058122c88cdfd0b9dcb105284591ab80ee4c5 100644
--- a/scm/flag-styles.scm
+++ b/scm/flag-styles.scm
@@ -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 abd 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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]