2015-12-31 3:23 GMT+01:00 Kieren MacMillan <[email protected]>: > Hi Harm, > > Now that my custom ottavation function isn’t overriding the stencil, how do I > adjust all of the parameters I had set in the “bound-details” version (e.g., > X, Y, padding, right-broken.X, etc.)? > > Thanks, > Kieren. > > p.s. My original function was simply extended from the example in the > [current] docs: > <http://www.lilypond.org/doc/v2.19/Documentation/notation/displaying-pitches#ottava-brackets> > Perhaps that should be changed, if it’s not the recommended method?
Hi Kieren,
I made some fundamental research about spanners with line-interface
and those with additional line-spanner-interface.
Code, pdf, log attached. Their behaviour is inconsistent, to say the least.
Regarding default OttavaBracket:
It doesn't have line-spanner-interface, i.e. the following properties
are basically _not_ supported (but may be by another interface, p.e.
thickness):
bound-details
extra-dy
gap
left-bound-info
note-columns
right-bound-info
simple-Y
thickness
to-barline
If you switch the stencil to ly:line-spanner::print you basically
loose access to (again, some of them may be supported by other
interfaces, like minimum-length, didn't test this, though):
edge-height
bracket-flare
shorten-pair
minimum-length
but you would be able to use the ones from line-spanner-interface.
Right now this is a one-or-the-other.
(Ofcourse a property-setting may not take any effect, if the
stencil-procedure doesn't use it. Though, this is always true.)
It is discussable whether OttavaBracket should behave more like other
spanners with line-spanner-interface. I guess the main reason why
OttavaBracket is done as it is, was to have edge-height and
bracket-flare user-settable.
Though, this may be possible even if the stencil-procedure would
listen to the properties from line-spanner-interface.
This would mean to rewrite the stencil, ofcourse. C++ work, which I
can't do myself.
Maybe more later.
Cheers,
Harm
P.S.: Up to now I found it impossible to override certain properties
of the first part of a broken OttavaBracket, like the length of the
line.
Hairpin has the 'broken-bound-padding at least, but none of the
others, if I'm not mistaken.
spanner-test-01.pdf
Description: Adobe PDF document
all spanners supporting line-interface: DynamicTextSpanner Episema Glissando Hairpin HorizontalBracket LigatureBracket OttavaBracket PianoPedalBracket TextSpanner TrillSpanner TupletBracket VoiceFollower VoltaBracket spanners supporting line-interface AND line-spanner-interface: DynamicTextSpanner Episema Glissando TextSpanner TrillSpanner VoiceFollower spanners supporting line-interface but NOT line-spanner-interface: Hairpin HorizontalBracket LigatureBracket OttavaBracket PianoPedalBracket TupletBracket VoltaBracket line-interface properties: arrow-length arrow-width dash-fraction dash-period style thickness zigzag-length zigzag-width line-spanner-interface properties: bound-details extra-dy gap left-bound-info note-columns right-bound-info simple-Y thickness to-barline ottava-bracket-interface properties: edge-height bracket-flare shorten-pair minimum-length
\version "2.14.2"
%% up to "2.19.32"
%% early 2.19.-versions may fail, though
%%%% Get and print info about spanners with line-(spanner-)interface and
%%%% properties of line-(spanner-)interface and ottava-bracket-interface
%%{
%% Send the info to a file, called <my-file-name>.log:
#(define print-to-file? #t)
%% To display in terminal uncomment
%#(set! print-to-file? #f)
#(define port
(if print-to-file?
(let* ((output-name
(if (string-ci<? (lilypond-version) "2.19.32")
(ly:parser-output-name parser)
(ly:parser-output-name)))
(outfilename (format "~a.log" output-name))
(outfile (open-output-file outfilename)))
(if (output-port? outfile)
(begin
(format #t "\n\tprinting to ~a" outfilename)
outfile)
(ly:error
(_ "Unable to open output file ~a to print the information")
outfilename)))
#t))
%% display which spanner-grobs have
%% - line-interface
%% - line-interface and line-spanner-interface
%% - line-interface but not line-spanner-interface
#(let* ((all-spanners
(filter
(lambda (e)
(and (assoc-get 'stencil (cdr e))
(eq? 'Spanner
(assoc-get 'class (assoc-get 'meta (cdr e))))))
all-grob-descriptions))
(all-spanners-with-line-interface
(filter
(lambda (x)
(let ((spanner-ifaces
(assoc-get 'interfaces (assoc-get 'meta (cdr x)))))
(member 'line-interface spanner-ifaces)))
all-spanners))
(all-spanner-names-with-line-interface
(map car all-spanners-with-line-interface))
(all-spanners-with-line-spanner-interface
(filter
(lambda (x)
(let ((spanner-ifaces
(assoc-get 'interfaces (assoc-get 'meta (cdr x)))))
(member 'line-spanner-interface spanner-ifaces)))
all-spanners))
(all-spanner-names-with-line-spanner-interface
(map car all-spanners-with-line-spanner-interface)))
(format port
"\nall spanners supporting line-interface:\n")
(for-each
(lambda (e) (format port "\t~a\n" e))
all-spanner-names-with-line-interface)
(format port
"\nspanners supporting line-interface AND line-spanner-interface:\n")
(for-each
(lambda (e) (format port "\t~a\n" e))
all-spanner-names-with-line-spanner-interface)
(format port
"\nspanners supporting line-interface but NOT line-spanner-interface:\n")
(for-each
(lambda (e) (format port "\t~a\n" e))
(lset-difference
eq?
all-spanner-names-with-line-interface
all-spanner-names-with-line-spanner-interface)))
%% Display which properties are available by
%% - line-interface
%% - line-spanner-interface
%% - ottava-bracket-interface
#(define (supported-properties iface)
(let ((iface-info (hashq-get-handle (ly:all-grob-interfaces) iface)))
(last iface-info)))
#(let ((line-spanner-interface-props
(supported-properties 'line-spanner-interface))
(line-interface-props
(supported-properties 'line-interface))
(ottava-bracket-props
(supported-properties 'ottava-bracket-interface)))
(format port "\nline-interface properties:\n")
(for-each
(lambda (e) (format port "\t~a\n" e))
line-interface-props)
(format port "\nline-spanner-interface properties:\n")
(for-each
(lambda (e) (format port "\t~a\n" e))
line-spanner-interface-props)
(format port "\nottava-bracket-interface properties:\n")
(for-each
(lambda (e) (format port "\t~a\n" e))
ottava-bracket-props))
#(if (output-port? port) (close-output-port port))
%}
%%%% Testing printed output of spanners with line-(spanner-)interface
%%%% Only overrides for color and solid-style are applied
mus = \relative c {
\ottava #-2
\times 1/1 {
a2\>\startTextSpan\startTrillSpan\sustainOn b\glissando
\break
\time 2/2
\clef alto
\key cis \major
c d\!\stopTextSpan\stopTrillSpan\sustainOff
}
\ottava #0
\key c \major
R1
\ottava #-2
\times 1/1 {
a2\>\startTextSpan\startTrillSpan\sustainOn b\glissando
\break
c d\!\stopTextSpan\stopTrillSpan\sustainOff
}
\ottava #0
}
\score {
\new StaffGroup
<<
\new Staff { c''1\cresc c''2 c''2\! R1 c''1\cresc c''2 c''2\! }
\new Staff \mus
\new Staff \repeat unfold 5 R1
>>
%% Using old #'-syntax to make it compile with older versions
%% tested with 2.14.2 uo to 2.19.32
\layout {
\context {
\Staff
\override OttavaBracket #'color = #blue
\override PianoPedalBracket #'color = #blue
pedalSustainStyle = #'bracket
}
\context {
\Voice
\override DynamicTextSpanner #'color = #red
\override Glissando #'color = #red
\override TextSpanner #'color = #red
\override TrillSpanner #'color = #red
\override Hairpin #'color = #blue
\override TupletBracket #'color = #blue
\override TextSpanner #'style = #'solid
\override DynamicTextSpanner #'style = #'solid
\override TextSpanner #'bound-details #'left #'text = #"tp"
\override Glissando #'breakable = ##t
}
}
\header {
title = #(format #f "~a" (lilypond-version))
piece = \markup \column {
"TESTING SPANNERS"
"from top to bottom:"
DynamicTextSpanner
TextSpanner
TrillSpanner
TupletBracket
Glissando
Hairpin
OttavaBracket
PianoPedalBracket
}
opus =
\markup \column {
"Spanners"
"- with line-spanner-interface are colored red"
"- with line-interface but without line-spanner-interface are colored blue"
}
}
}
\paper { print-all-headers = ##t }
\pointAndClickOff
_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
