Re: Determine if a stem is present

2017-03-27 Thread Urs Liska


Am 27.03.2017 um 11:45 schrieb Thomas Morley:
> 2017-03-27 11:38 GMT+02:00 Urs Liska :
>> Hi all,
>>
>> I want to know if a given notehead has a stem attached. Obviously even
>> whole notes do have a stem object, but with zero extent.
>>
>> I've found the following calculation to be reliable, but I can't imagine
>> it has to be so complicated:
>>
>> (if (or (= +inf.0 (car stem-y-extent))
>> (= -inf.0 (car stem-y-extent))
>> (= +inf.0 (cdr stem-y-extent))
>> (= -inf.0 (cdr stem-y-extent)))
>>
>> (with stem-y-extent being the Y-extent property of the stem object).
>>
>> I think there should be some property I can ask directly about this? But
>> I didn't find any suspicious entry for Stem or stem-interface.
>>
>> Any suggestions?
>> Urs
> interval-sane?
>
> exp.:
>
> (interval-sane? (ly:stencil-extent empty-stencil X))
> --> #f
>
> Maybe grob::is-live? may help as well, didn't test that.

Ah, no, but it brought me in the right direction. While

(ly:grob-object notehead 'stem) does give an object
(ly:grob-property stem 'stencil) => '()

Thanks
Urs

>
>
> HTH,
>   Harm

-- 
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Determine if a stem is present

2017-03-27 Thread Thomas Morley
2017-03-27 11:38 GMT+02:00 Urs Liska :
> Hi all,
>
> I want to know if a given notehead has a stem attached. Obviously even
> whole notes do have a stem object, but with zero extent.
>
> I've found the following calculation to be reliable, but I can't imagine
> it has to be so complicated:
>
> (if (or (= +inf.0 (car stem-y-extent))
> (= -inf.0 (car stem-y-extent))
> (= +inf.0 (cdr stem-y-extent))
> (= -inf.0 (cdr stem-y-extent)))
>
> (with stem-y-extent being the Y-extent property of the stem object).
>
> I think there should be some property I can ask directly about this? But
> I didn't find any suspicious entry for Stem or stem-interface.
>
> Any suggestions?
> Urs

interval-sane?

exp.:

(interval-sane? (ly:stencil-extent empty-stencil X))
--> #f

Maybe grob::is-live? may help as well, didn't test that.


HTH,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Determine if a stem is present

2017-03-27 Thread Urs Liska
Hi all,

I want to know if a given notehead has a stem attached. Obviously even
whole notes do have a stem object, but with zero extent.

I've found the following calculation to be reliable, but I can't imagine
it has to be so complicated:

(if (or (= +inf.0 (car stem-y-extent))
(= -inf.0 (car stem-y-extent))
(= +inf.0 (cdr stem-y-extent))
(= -inf.0 (cdr stem-y-extent)))

(with stem-y-extent being the Y-extent property of the stem object).

I think there should be some property I can ask directly about this? But
I didn't find any suspicious entry for Stem or stem-interface.

Any suggestions?
Urs

-- 
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user