From 9914ef8e286a14037ca2d56768c9f9433d1fcaf7 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Tue, 1 Nov 2011 18:14:36 +0000 Subject: [PATCH] Add slashChordSeparator Issue 1572 and issue 1503 - Allow choice of chord modifier separator independently of chord inversion separator, since conventionally the latter is always a slash (hence the term "slash chords"), whereas the former seldom involves slashes. --- Documentation/notation/chords.itely | 37 +++++++++++++++++++++-- input/regression/chord-slash-separator.ly | 11 +++++++ ly/engraver-init.ly | 3 +- scm/chord-ignatzek-names.scm | 5 +-- scm/define-context-properties.scm | 3 ++ 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 input/regression/chord-slash-separator.ly diff --git a/Documentation/notation/chords.itely b/Documentation/notation/chords.itely index 50ac2bf9ed..92d01477f8 100644 --- a/Documentation/notation/chords.itely +++ b/Documentation/notation/chords.itely @@ -631,9 +631,40 @@ bass note can be printed in lower case. @item chordNameSeparator -Different parts of a chord name are normally separated by a slash. -By setting @code{chordNameSeparator}, you can use any desired markup -for a separator. +Different parts of a chord name are normally separated by a small +amount of horizontal space. By setting @code{chordNameSeparator}, you +can use any desired markup for a separator. This does not affect the +separator between a chord and its bass note; to customize that, use +@code{slashChordSeparator}. + +@lilypond[verbatim,quote,ragged-right] +\chords { + c4:7.9- c:7.9-/g + \set chordNameSeparator = \markup { "/" } + \break + c4:7.9- c:7.9-/g +} +@end lilypond + +@funindex slashChordSeparator + +@item slashChordSeparator + +Chords can be played over a bass note other than the conventional root +of the chord. These are known as ``inversions'' or ``slash chords'', +because the default way of notating them is with a forward slash +between the main chord and the bass note. Therefore the value of +@code{slashChordSeparator} defaults to a forward slash, but you can +change it to any markup you choose. + +@lilypond[verbatim,quote,ragged-right] +\chords { + c4:7.9- c:7.9-/g + \set slashChordSeparator = \markup { " over " } + \break + c4:7.9- c:7.9-/g +} +@end lilypond @funindex chordNameExceptions diff --git a/input/regression/chord-slash-separator.ly b/input/regression/chord-slash-separator.ly new file mode 100644 index 0000000000..6abbcdbcd7 --- /dev/null +++ b/input/regression/chord-slash-separator.ly @@ -0,0 +1,11 @@ +\version "2.15.16" +\header { + texidoc = "The layout of chord inversions can be tuned with +@code{slashChordSeparator}." +} + +\chords { + des/c + \set slashChordSeparator = " over " + des/c +} diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index a416974ba0..71a191d4b4 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -647,7 +647,8 @@ automatically when an output definition (a @code{\score} or chordNameFunction = #ignatzek-chord-names majorSevenSymbol = #whiteTriangleMarkup chordNameLowercaseMinor = ##f - chordNameSeparator = #(make-simple-markup "/") + chordNameSeparator = #(make-hspace-markup 0.5) + slashChordSeparator = #(make-simple-markup "/") chordNameExceptions = #ignatzekExceptions chordNoteNamer = #'() chordRootNamer = #note-name->markup diff --git a/scm/chord-ignatzek-names.scm b/scm/chord-ignatzek-names.scm index dbff86a8b0..6aad896795 100644 --- a/scm/chord-ignatzek-names.scm +++ b/scm/chord-ignatzek-names.scm @@ -168,6 +168,7 @@ work than classifying the pitches." (make-line-markup total))) (let* ((sep (ly:context-property context 'chordNameSeparator)) + (slashsep (ly:context-property context 'slashChordSeparator)) (root-markup (name-root root lowercase-root?)) (add-markups (map (lambda (x) (glue-word-to-step "add" x)) addition-pitches)) @@ -183,7 +184,7 @@ work than classifying the pitches." suffixes add-markups) sep)) (base-stuff (if (ly:pitch? bass-pitch) - (list sep (name-note bass-pitch #f)) + (list slashsep (name-note bass-pitch #f)) '()))) (set! base-stuff @@ -209,7 +210,7 @@ work than classifying the pitches." ,exception-markup . ,(if (ly:pitch? bass-pitch) - (list (ly:context-property context 'chordNameSeparator) + (list (ly:context-property context 'slashChordSeparator) (name-note bass-pitch #f)) '())))) diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index fb2994f383..32595e759e 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -148,6 +148,9 @@ of pitches to chord names.") (chordNameLowercaseMinor ,boolean? "Downcase roots of minor chords?") (chordNameSeparator ,markup? "The markup object used to separate parts of a chord name.") + (slashChordSeparator ,markup? "The markup object used to separate +a chord name from its root note in case of inversions or slash +chords.") (chordNoteNamer ,procedure? "A function that converts from a pitch object to a text markup. Used for single pitches.") (chordPrefixSpacer ,number? "The space added between the root -- 2.39.2