]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4716 Improve note-by-number to deal better with flag-styles
authorThomas Morley <thomasmorley65@gmail.com>
Sun, 27 Dec 2015 21:33:12 +0000 (22:33 +0100)
committerThomas Morley <thomasmorley65@gmail.com>
Sun, 3 Jan 2016 15:03:02 +0000 (16:03 +0100)
- Per default every ancient note-head will get a mensural-style-flag.
- overriding flag-style will now always work with supported styles:
  default, straight- and flat-flags and (neo-)mensural-flags

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

index f5fbc9b60d2671170f61920fbf415b857e78e8b7..316a87c2a6409c254fdfc1656c75d69b2de5e743 100644 (file)
@@ -1,14 +1,15 @@
-\version "2.17.19"
+\version "2.19.35"
 
 \header {
   texidoc = "@code{\\note-by-number} and @code{\\note} support
-all note head styles and straight flags."
+all note head styles and all flag styles (default, straight, flat, mensural)."
 }
 
 #(define styles-list
   '(default altdefault
     baroque neomensural
     mensural petrucci
+    semipetrucci blackpetrucci
     harmonic harmonic-black
     harmonic-mixed diamond
     cross xcircle
@@ -35,6 +36,8 @@ all note head styles and straight flags."
                                '(-3 -2 -1 0 1 2 3 4 5 6))))))))
                        styles))))
 
+%% Testing all combinations of note-head/flag-styles would be too much
+%% Thus, limited examples
 \markup {
   \column {
     \combine \null \vspace #1
@@ -49,7 +52,7 @@ all note head styles and straight flags."
     \combine \null \vspace #1
     \underline "Modern-straight-flag:"
     \override #'(flag-style . modern-straight-flag)
-    \show-note-styles #'(default)
+    \show-note-styles #'(default mensural)
   }
 }
 
@@ -70,3 +73,12 @@ all note head styles and straight flags."
     \show-note-styles #'(default)
   }
 }
+
+\markup {
+  \column {
+    \combine \null \vspace #1
+    \underline "default-flag:"
+    \override #'(flag-style . default)
+    \show-note-styles #'(default mensural)
+  }
+}
index 362080ed9b8d72a1ede07d5d13911296b6823e9a..e22e467f1e2258d1daccb00bb9c07a7ebebc6171 100644 (file)
@@ -3543,9 +3543,12 @@ 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.
+Supports all note-head-styles.  Ancient note-head-styles will get
+mensural-style-flags.  @code{flag-style} may be overridden independently.
 Supported flag-styles are @code{default}, @code{old-straight-flag},
-@code{modern-straight-flag} and @code{flat-flag}.
+@code{modern-straight-flag}, @code{flat-flag}, @code{mensural} and
+@code{neomensural}.  The latter two flag-styles will both result in
+mensural-flags.  Both are supplied for convenience.
 
 @lilypond[verbatim,quote]
 \\markup {
@@ -3556,7 +3559,8 @@ Supported flag-styles are @code{default}, @code{old-straight-flag},
 @end lilypond"
   (define (get-glyph-name-candidates dir log style)
     (map (lambda (dir-name)
-           (format #f "noteheads.~a~a" dir-name
+           (format #f "noteheads.~a~a"
+                   dir-name
                    (if (and (symbol? style)
                             (not (equal? 'default style)))
                        (select-head-glyph style (min log 2))
@@ -3642,7 +3646,9 @@ Supported flag-styles are @code{default}, @code{old-straight-flag},
                                  (sign dir) log 'default))
                 result)))
          (head-glyph (ly:font-get-glyph font head-glyph-name))
-         (ancient-flags? (or (eq? style 'mensural) (eq? style 'neomensural)))
+         (ancient-flags?
+           (member style
+                   '(mensural neomensural petrucci semipetrucci blackpetrucci)))
          (attach-indices (ly:note-head::stem-attachment font head-glyph-name))
          (stem-length (* size-factor (max 3 (- log 1))))
          ;; With ancient-flags we want a tighter stem
@@ -3658,7 +3664,10 @@ Supported flag-styles are @code{default}, @code{old-straight-flag},
                                (cdr attach-indices)))))
          ;; For a tighter stem (with ancient-flags) the stem-width has to be
          ;; adjusted.
-         (stem-X-corr (if ancient-flags? (* 0.5 dir stem-thickness) 0))
+         (stem-X-corr
+           (if (or ancient-flags?
+                   (member flag-style '(mensural neomensural)))
+                   (* 0.5 dir stem-thickness) 0))
          (stem-glyph (and (> log 0)
                           (ly:round-filled-box
                            (ordered-cons (+ stem-X-corr (car attach-off))
@@ -3696,11 +3705,15 @@ Supported flag-styles are @code{default}, @code{old-straight-flag},
                               flat-flag)
                              (else
                               (ly:font-get-glyph font
-                                                 (format #f (if ancient-flags?
-                                                                "flags.mensural~a2~a"
-                                                                "flags.~a~a")
-                                                         (if (> dir 0) "u" "d")
-                                                         log))))
+                                (format #f
+                                        (if (or (member flag-style
+                                                        '(mensural neomensural))
+                                                (and ancient-flags?
+                                                     (null? flag-style)))
+                                            "flags.mensural~a2~a"
+                                            "flags.~a~a")
+                                        (if (> dir 0) "u" "d")
+                                        log))))
                        (cons (+ (car attach-off)
                                 ;; For tighter stems (with ancient-flags) the
                                 ;; flag has to be adjusted different.