lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instrument names


From: Keith OHara
Subject: Re: Instrument names
Date: Thu, 26 Jul 2012 02:32:42 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Phil Holmes <email <at> philholmes.net> writes:

> I've done the looking into the code that I can manage.  I know that indents 
> are worked in output-def.cc:line_dimensions_int.  This returns a linewidth 
> and an indent, with a normal indent when called with second parameter 0, 
> otherwise it's a short-indent.  So it would be easy to add something to the 
> indent here to take account of intrument names.
> 
> The instrument name is created in instrument-name-engraver.cc.  This makes a 
> Spanner *text_spanner_; with text_spanner_ = make_spanner ("InstrumentName", 
> SCM_EOL);
> 
> So it appears that there is a Spanner called InstrumentName with the details 
> of the instrument name.  Is there any way of accessing this within 
> output-def.cc?

The InstrumentName spanners can change when an instrument changes, or
whenever the user feels like changing the text.  The short-indent will
affect line breaking, which could affect which instrument name goes at
the front of each line.  Even if output-def.cc can find all the 
InstrumentName spanners, it is hard to know which ones to pull information
from.

Maybe each Instrument_name_engraver, one for each staff, could push 
information to a central location.  I think there is some way for an 
engraver to refer to its Output_def, and call its set_variable().

Whenever an engraver sees a new (short)instrumentName (or maybe just
once upon initialization based on instrumentNames set in \with{} blocks)
the engraver could estimate the length of the text, in paper units, compare
to a layout variable 'instrument_name_length' or 'short_name_length' as 
appropriate, and overwrite that variable if the text they will be setting
is longer than the length posted so far.

The layout variable 'indent' might then be initialized to a Scheme 
expression that returns the longer of 'instrument_name_length' and
'default_indent'.  That way a user can take control by explicitly setting 
\layout{ indent = 8\mm }.

Other concerns are, any difference between 'indent' in \layout and \paper
blocks, and making 'default_indent' scale properly with paper size.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]