From 27f9ebef47a058db8befc5cb05bd63375144fc01 Mon Sep 17 00:00:00 2001 From: Thomas Morley Date: Mon, 2 Jan 2017 14:12:42 +0000 Subject: [PATCH] Issue 4983 Let crossStaff hide non-default-style flags Return empty-stencil for all flags using the code provided in flag-styles.scm, if the style property is 'no-flag as set by the crossStaff-function. --- scm/flag-styles.scm | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scm/flag-styles.scm b/scm/flag-styles.scm index a2ddf3a9dd..ab61921851 100644 --- a/scm/flag-styles.scm +++ b/scm/flag-styles.scm @@ -97,14 +97,16 @@ All lengths are scaled according to the font size of the note." ;; Log for 1/8 is 3, so we need to subtract 3 (flag-stencil (buildflag stencil (- log 3) stencil spacing)) (stroke-style (ly:grob-property grob 'stroke-style))) - (if (equal? stroke-style "grace") - (add-stroke-straight flag-stencil grob - dir log - stroke-style - flag-end flag-length - thickness - (* half-stem-thickness 2)) - flag-stencil)))) + (cond ((eq? (ly:grob-property grob 'style) 'no-flag) + empty-stencil) + ((equal? stroke-style "grace") + (add-stroke-straight flag-stencil grob + dir log + stroke-style + flag-end flag-length + thickness + (* half-stem-thickness 2))) + (else flag-stencil))))) (define-public (modern-straight-flag grob) "Modern straight flag style (for composers like Stockhausen, Boulez, etc.). @@ -174,10 +176,12 @@ flag stencil." (dir (if (eqv? (ly:grob-property stem-grob 'direction) UP) "u" "d")) (flag (retrieve-glyph-flag flag-style dir dir-modifier grob)) (stroke-style (ly:grob-property grob 'stroke-style))) - (if (null? stroke-style) - flag - (add-stroke-glyph flag grob dir stroke-style flag-style)))) - + (cond ((eq? (ly:grob-property grob 'style) 'no-flag) + empty-stencil) + ((null? stroke-style) + flag) + (else + (add-stroke-glyph flag grob dir stroke-style flag-style))))) (define-public (mensural-flag grob) @@ -205,7 +209,6 @@ a flag always touches a staff line." (create-glyph-flag "mensural" modifier grob))) - (define ((glyph-flag flag-style) grob) "Simulatesthe default way of generating flags: Look up glyphs @code{flags.style[ud][1234]} from the feta font and use it for the flag @@ -214,13 +217,11 @@ stencil." (export glyph-flag) - (define-public (normal-flag grob) "Create a default flag." (create-glyph-flag "" "" grob)) - (define-public (default-flag grob) "Create a flag stencil for the stem. Its style will be derived from the @code{'style} Flag property. By default, @code{lilypond} uses a @@ -242,5 +243,6 @@ at will. The correct way to do this is: (cond ((equal? flag-style "") (normal-flag grob)) ((equal? flag-style "mensural") (mensural-flag grob)) - ((equal? flag-style "no-flag") (no-flag grob)) + ((equal? flag-style "no-flag") empty-stencil) (else ((glyph-flag flag-style) grob))))) + -- 2.39.2