[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incipit with default noteheads possible?
From: |
David Kastrup |
Subject: |
Re: Incipit with default noteheads possible? |
Date: |
Thu, 25 Jan 2024 01:50:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hajo Baess <habae@posteo.de> writes:
> This works for the note heads, but if there happen to be accidentals
> around (in my project this is the case), they remain mensural style. Is
> there another override for this, too?
>
> Am Mittwoch, dem 24.01.2024 um 16:14 +0200 schrieb YTG 1234:
>> > I have tried an override ( \override
>> > Staff.NoteHead.style = #'default )
>>
>> Note heads are drawn in Voice, so you can just omit the context name.
>> \override NoteHead.style = #'default
>>
>> The more fundamental issue here, though, is that \incipit is
>> hardcoded
>> to create a MensuralStaff context. Does anyone know how to replicate
>> its
>> effect with a normal Staff, short of just substituting in its source
>> code?
How about this?
\version "2.24.2"
incipit =
#(define-music-function (incipit-music) (ly:music?)
(_i "Output @var{incipit-music} as an incipit.
@var{incipit-music} is typeset within a @code{MensuralStaff} context; the result
is positioned before the main staff (as part of an @code{InstrumentName} grob)
to indicate the music's original notation.")
#{
\once \override Staff.InstrumentName.stencil =
#(lambda (grob)
(let* ((instrument-name (ly:grob-property grob 'long-text))
(align-x (ly:grob-property grob 'self-alignment-X 0))
(align-y (ly:grob-property grob 'self-alignment-Y 0)))
(unless (and (music-is-of-type? incipit-music 'context-specification)
(assq (ly:music-property incipit-music 'context-type)
(ly:output-find-context-def (ly:grob-layout grob)
'Staff)))
;; not a staff-like context
(set! incipit-music (context-spec-music incipit-music
'MensuralStaff)))
(set! (ly:music-property incipit-music 'create-new) #t)
(set! (ly:music-property incipit-music 'property-operations)
(append (ly:music-property incipit-music 'property-operations)
`((push InstrumentName ,align-x self-alignment-X)
(push InstrumentName ,align-y self-alignment-Y)
(assign instrumentName ,instrument-name))))
(set! (ly:grob-property grob 'long-text)
#{ \markup \score { #incipit-music
\layout {
$(ly:grob-layout grob)
indent-incipit-default = 15\mm
line-width = #(primitive-eval
'(or
(false-if-exception indent)
indent-incipit-default))
indent = #(primitive-eval
'(or
(false-if-exception (- line-width incipit-width))
(* 0.5
line-width)))
ragged-right = ##f
ragged-last = ##f
system-count = 1
}
}
#})
(set! (ly:grob-property grob 'self-alignment-Y) #f)
;; Do 'self-alignment-X RIGHT only for the first InstrumentName, which
;; actually is the incipit. Otherwise self-alignment-X for the
;; shortInstrumentName is not longer settable.
(let ((parts (ly:spanner-broken-into (ly:grob-original grob))))
(if (and (pair? parts) (equal? grob (car parts)))
(ly:grob-set-property! grob 'self-alignment-X RIGHT)))
(system-start-text::print grob)))
#}
)
\language "deutsch"
Incipit = \relative c'' {
\clef treble \time 4/4
\omit Staff.TimeSignature
\hide Stem
%\mark "A D FIS CIS"
< a, d fis cis' >
}
noten = \relative c'' {
\clef treble \key f \major \time 4/4
c4 d e f \bar "|."
}
\score {
\new Staff
<<
\incipit \new Staff \Incipit
\set Staff.instrumentName = "Violino discordato"
\noten
>>
\layout {
indent = 4\cm
incipit-width = 1\cm
}
}
--
David Kastrup