lilypond-user
[Top][All Lists]
Advanced

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

Re: Scope of context properties


From: Masaki, Akikazu
Subject: Re: Scope of context properties
Date: Tue, 22 Mar 2022 22:35:57 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

Thanks! That makes sense!
Simply, order of precedence and where a property is defined cause such 
behavior, I see.

Akikazu



On 2022/03/22 21:00, Jean Abou Samra wrote:
Le 22/03/2022 à 05:01, Masaki, Akikazu a écrit :
Hello all,

In Learning Manual
3.3.4 Modifying context properties
http://lilypond.org/doc/v2.22/Documentation/learning/modifying-context-properties.html
"---
The clefGlyph property will take effect only if it is set in the Staff
context, but some properties can be set in more than one context.
---"

How do I know which properties can be set in more than one context?
I can't find info from Internals Reference.


By the way, clefGlyph takes effect in the Score too, like extraNatural.

\version "2.22"
{ \set Score.clefGlyph = "clefs.C" 1 }

On the other hand, for example, ottavationMarkups is valid only in the Staff.
What is essential difference between them?



You can set any property in any context, but of course it will only
have an effect if you set it in a place LilyPond where is going to
read it. So how does LilyPond look up properties? When it wants
a property in a context, it reads it in the context, and if undefined,
falls back to the parent context, then to the parent of the parent,
etc., until a value is found. That way, you can override properties
in the Score context and have them take effect on all Staff contexts,
but this only applies if the Staff contexts themselves don't have
their own settings for the property in question. clefGlyph is unset
by default in Staff, so the value in Score will get used. On the
other hand, the definition of the Staff context has a setting for
ottavationMarkups, as you can see from
http://lilypond.org/doc/v2.23/Documentation/internals/staff
That means it will take precedence. If you don't want it to, remove
this value.

\version "2.22.2"

%% Takes effect
{
   \set Score.clefGlyph = "clefs.C"
   1
}

%% No effect
{
   \set Score.ottavationMarkups = #ottavation-ordinals
   \ottava 1
   1
}

%% Takes effect
{
   \set Score.ottavationMarkups = #ottavation-ordinals
   \unset Staff.ottavationMarkups
   \ottava 1
   1
}

Is that clear?

Jean




reply via email to

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