From 17c4e911377e569d1c2b59d4d1530ea6fd5fc5c8 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Mon, 9 Nov 2009 19:00:57 +0100 Subject: [PATCH] Fix ancient clef/key incipits using Nicolas code. --- oly_settings_choralscore.ily | 1 + oly_settings_fullscore.ily | 1 + oly_settings_instrument.ily | 4 +++ oly_settings_names.ily | 6 ++--- oly_settings_vocalscore.ily | 5 ++++ orchestrallily.ily | 3 ++- sceaux_clef-key.ily | 62 +++++++++++++++++++++++++++++++++++--------- 7 files changed, 66 insertions(+), 16 deletions(-) diff --git a/oly_settings_choralscore.ily b/oly_settings_choralscore.ily index 5ff3ef7..551b51e 100644 --- a/oly_settings_choralscore.ily +++ b/oly_settings_choralscore.ily @@ -1,5 +1,6 @@ % lilypond input for Choral scores: A4, 5mm staff height #(ly:set-option 'relative-includes #t) +#(ly:set-option 'incipit #t) \include "oly_settings_fullscore.ily" % Don't print short instruments name, they are clear from the beginning diff --git a/oly_settings_fullscore.ily b/oly_settings_fullscore.ily index 92f3311..91108b5 100644 --- a/oly_settings_fullscore.ily +++ b/oly_settings_fullscore.ily @@ -1,6 +1,7 @@ % lilypond input for full scores % changes to the global score settings for full scores #(ly:set-option 'relative-includes #t) +#(ly:set-option 'incipit #t) \include "oly_settings_global.ily" % #(set-default-paper-size "a4") diff --git a/oly_settings_instrument.ily b/oly_settings_instrument.ily index ef19a08..8d49266 100644 --- a/oly_settings_instrument.ily +++ b/oly_settings_instrument.ily @@ -30,6 +30,10 @@ % No instrument names, they are already in the title/header! \remove "Instrument_name_engraver" } + \context { \PianoStaff + % No instrument names, they are already in the title/header! + \remove "Instrument_name_engraver" + } \context { \RemoveEmptyStaffContext % No instrument names, they are already in the title/header! (Removing diff --git a/oly_settings_names.ily b/oly_settings_names.ily index c8a7deb..82680f4 100644 --- a/oly_settings_names.ily +++ b/oly_settings_names.ily @@ -52,8 +52,8 @@ OIIaClef = \clef "bass" OIbClef = \clef "treble" OIIbClef = \clef "bass" BCClef = \clef "bass" -PfeIClef = \clef "treble" -PfeIIClef = \clef "bass" +PIClef = \clef "treble" +PIIClef = \clef "bass" @@ -105,7 +105,7 @@ OIIInstrumentName = "Organo II" BCInstrumentName = "Basso Continuo" OrganInstrumentName = "Organo" ContinuoInstrumentName = \OrganInstrumentName -PfeInstrumentName = "Pianoforte" +PInstrumentName = "Pianoforte" ChInstrumentTitle = "Coro" diff --git a/oly_settings_vocalscore.ily b/oly_settings_vocalscore.ily index 7ed652e..118053f 100644 --- a/oly_settings_vocalscore.ily +++ b/oly_settings_vocalscore.ily @@ -1,6 +1,7 @@ % lilypond input for vocal scores % changes to the full score settings for vocal scores #(ly:set-option 'relative-includes #t) +#(ly:set-option 'incipit #t) \include "oly_settings_choralscore.ily" % Use 27x19 cm paper, 1.5cm margins. @@ -15,3 +16,7 @@ % 5 mm staff height (piano should be 5.5, but that will be left as a future exercise) #(set-global-staff-size 14.5) + +\header { + instrument = \VocalScoreTitle +} \ No newline at end of file diff --git a/orchestrallily.ily b/orchestrallily.ily index 564dbc0..59ebe44 100644 --- a/orchestrallily.ily +++ b/orchestrallily.ily @@ -26,7 +26,6 @@ % Use relative include pathes! #(ly:set-option 'relative-includes #t) -\include "sceaux_clef-key.ily" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1600,3 +1599,5 @@ smallFlageolet = LicenseCCBY = \markup {Lizensiert unter / Licensed under: Creative Commons BY \with-url #"http://creativecommons.org/licenses/by/3.0/at/" {\translate #'(0 . -0.7) \epsfile #Y #3 #"orchestrallily/cc-by.eps" }} LicenseCCBYNC = \markup {Lizensiert unter / Licensed under: Creative Commons BY-NC \with-url #"http://creativecommons.org/licenses/by-nc/3.0/at/" {\translate #'(0 . -0.7) \epsfile #Y #3 #"orchestrallily/cc-by-nc.eps" }} LicenseNoRestrictions = \markup{\line {Die Ausgabe darf kopiert und ohne Einschränkungen aufgeführt werden. / May be copied and performed without restriction.}} + +\include "sceaux_clef-key.ily" diff --git a/sceaux_clef-key.ily b/sceaux_clef-key.ily index a8e6c77..6b0a326 100644 --- a/sceaux_clef-key.ily +++ b/sceaux_clef-key.ily @@ -8,8 +8,8 @@ %%% ancient-style %%% When true, use ancient clefs, instead of modern ones. %%% -%%% non-incipit -%%% When true, do not print incipit in modern style. +%%% incipit +%%% When true, do print incipit showing ancient keys/clefs in modern style. %%% %%% Music functions %%% =============== @@ -44,23 +44,60 @@ #(set-object-property! 'old-key 'backend-type? ly:music?) #(set-object-property! 'old-key 'backend-doc "Incipit key music") -#(ly:add-option 'ancient-style #f - "Whether old clefs / keys should be printed (if provided)") -#(ly:add-option 'incipit #t - "Whether to print an incipit with the old key / clef (if provided). - If the 'ancient-style option is set to ##t, this option has no effect.") +% #(ly:add-option 'ancient-style #f +% "Whether old clefs / keys should be printed (if provided)") +% #(ly:add-option 'incipit #t +% "Whether to print an incipit with the old key / clef (if provided). +% If the 'ancient-style option is set to ##t, this option has no effect.") #(define-public (filter-empty l) (filter (lambda (x) (not (null? x))) l)) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Workaround by Neil puttock (on lilypond-devel): +% The incipit might not contain any notes, in which case, lilypond will +% not use the width of the prefactory material (clefs, keys, etc) to +% determine the width of the staff lines. This function calculates the +% width and sets the 'width property accordingly +#(define-public (incipit-after-line-breaking grob) + (let* ((system (ly:grob-system grob)) + (elts (ly:grob-object system 'elements)) + (break-alignment #f)) + + (for-each + (lambda (x) + (let ((elt (ly:grob-array-ref elts x))) + (if (grob::has-interface elt + 'break-alignment-interface) + (set! break-alignment elt)))) + (iota (ly:grob-array-length elts))) + + (if break-alignment + (set! (ly:grob-property grob 'width) + (+ (ly:output-def-lookup (ly:grob-layout grob) 'indent) + (interval-length + (interval-widen + (ly:grob-extent break-alignment system X) 0.4))))))) + + #(define-public (create-incipit-score grob instrument-name) (let ((clef (ly:grob-property grob 'old-clef)) (key (ly:grob-property grob 'old-key))) (if (or (ly:music? clef) (ly:music? key)) (let* ((music (make-music 'SequentialMusic - 'elements (filter-empty (list + 'elements (filter-empty (list + ; Workaround: Calculate the actual width of the key/clef + (make-music + 'ContextSpeccedMusic + 'context-type 'Score + 'element (make-music + 'OverrideProperty + 'pop-first #t + 'grob-property-path (list 'after-line-breaking) + 'grob-value incipit-after-line-breaking + 'symbol 'StaffSymbol)) (make-music 'ContextSpeccedMusic 'context-type 'Staff @@ -103,8 +140,11 @@ (not (eqv? #t (ly:get-option 'ancient-style))))) (create-incipit-score grob name) #f))) - (if incipit-score - (grob-interpret-markup grob (markup #:score incipit-score)) + (if (not (eqv? #f incipit-score)) + (begin + (set! (ly:grob-property grob 'self-alignment-X) RIGHT) + (set! (ly:grob-property grob 'padding) 0) + (grob-interpret-markup grob (markup #:score incipit-score))) (if (and (markup? name) (!= (ly:item-break-dir left-bound) CENTER)) (grob-interpret-markup grob name) (ly:grob-suicide! grob))))) @@ -113,8 +153,6 @@ \layout { \context { \Staff - \override InstrumentName #'self-alignment-X = #RIGHT - \override InstrumentName #'padding = #0 \override InstrumentName #'stencil = #system-start-text::incipit-print instrumentName = "" } -- 2.11.4.GIT