markup-command boxing the real printed ink?

2021-04-20 Thread Thomas Morley
Hi all,

consider:

\markup
  \override #'(box-padding . 0) \box \fontsize #15 \musicglyph #"f"

The bounding box of the forte-sign does not describe its real printed
ink and thus it sticks out of \box.
While this is on purpose and fine in almost all cases, I want to
define a markup-command boxing the real printed ink. The outcome
should be like the manual adjusted:

\markup
  \override #'(box-padding . 0)
  \box
  \with-dimensions #'(-2.3 . 9.92) #'(-3.85 . 10.8)
  \fontsize #15 \musicglyph #"f"

Hints?

Thanks,
  Harm



Re: markup-command boxing the real printed ink?

2021-04-20 Thread Valentin Petzel
Hello Harm,

This is probably quite hard to do. Basically the problem here is that Lilypond 
does not in fact know the actual extent of the stencil. So to get that you’d 
somehow need to draw the stencil. So eighter you’d need to implement a custom 
drawing routine for "drawing" stencils within Lilypond, or you could try to do 
a function that takes a stencil, creates a new book containing that stencil, 
you’d then postprocess that file with a script that determines the actual 
extent and writes it into an auxiliary file, which is then included and gives 
the first function a value for overriding the extent.

Cheers,
Valentin

signature.asc
Description: This is a digitally signed message part.


Re: markup-command boxing the real printed ink?

2021-04-20 Thread David Kastrup
Valentin Petzel  writes:

> Hello Harm,
>
> This is probably quite hard to do. Basically the problem here is that
> Lilypond does not in fact know the actual extent of the stencil. So to
> get that you’d somehow need to draw the stencil. So eighter you’d need
> to implement a custom drawing routine for "drawing" stencils within
> Lilypond, or you could try to do a function that takes a stencil,
> creates a new book containing that stencil, you’d then postprocess
> that file with a script that determines the actual extent and writes
> it into an auxiliary file, which is then included and gives the first
> function a value for overriding the extent.

You do realise that LilyPond processes outlines?  It would seem that
what Harm is asking for is recalculating markup bounding box dimensions
from its outline.  That would seem to require some C++ code I think, but
not at the low level you suggest.  More like adding something similar to
"with-outline" support to lily/stencil-integral.cc and
lily/stencil-interpret.cc .

-- 
David Kastrup



Re: markup-command boxing the real printed ink?

2021-04-20 Thread Thomas Morley
Am Di., 20. Apr. 2021 um 15:45 Uhr schrieb David Kastrup :
>
> Valentin Petzel  writes:
>
> > Hello Harm,
> >
> > This is probably quite hard to do. Basically the problem here is that
> > Lilypond does not in fact know the actual extent of the stencil. So to
> > get that you’d somehow need to draw the stencil. So eighter you’d need
> > to implement a custom drawing routine for "drawing" stencils within
> > Lilypond, or you could try to do a function that takes a stencil,
> > creates a new book containing that stencil, you’d then postprocess
> > that file with a script that determines the actual extent and writes
> > it into an auxiliary file, which is then included and gives the first
> > function a value for overriding the extent.
>
> You do realise that LilyPond processes outlines?  It would seem that
> what Harm is asking for is recalculating markup bounding box dimensions
> from its outline.  That would seem to require some C++ code I think, but
> not at the low level you suggest.  More like adding something similar to
> "with-outline" support to lily/stencil-integral.cc and
> lily/stencil-interpret.cc .
>
> --
> David Kastrup

We have the markup-command \with-outline.
Alas, it looks not like what I would need and tbh, I've no clue how to
use it, no example there.

$ git grep "with-outline"
lily/stencil-integral.cc:  else if (scm_is_eq (head, ly_symbol2scm
("with-outline")))
lily/stencil-interpret.cc:  else if (scm_is_eq (head,
ly_symbol2scm ("with-outline")))
lily/stencil.cc:   scm_list_3 (ly_symbol2scm
("with-outline"),
scm/define-markup-commands.scm:(define-markup-command (with-outline
layout props outline arg)
scm/define-stencil-commands.scm:with-outline
scm/stencil.scm: ((eq? head 'with-outline) (interpret (cadr expr)))

shows no doc/code-example as well.

Anyway:

I stumbled across the problem while looking at
https://lists.gnu.org/archive/html/lilypond-user/2021-03/msg00187.html
There's the complain note-by-number note working nicely with the Scorlatti-font.
For testing, I took the font from https://github.com/OpenLilyPondFonts.

Further investigation showed Scorlatti-note-heads exceed the bounding
box. With this in mind I asked here.
Meanwhile I noticed that this holds for use in notemode as well (the
up-Stem is always a little off).
Same for lilyjazz from there. gonville is fine. Didn't test the others

This leads to the conclusion that this scorlatti-font is unusable.

Not sure whether there are free variants of these font out there.

Thanks,
  Harm



Re: markup-command boxing the real printed ink?

2021-04-20 Thread Thomas Morley
Am Di., 20. Apr. 2021 um 16:39 Uhr schrieb Thomas Morley
:
>
> Am Di., 20. Apr. 2021 um 15:45 Uhr schrieb David Kastrup :
> >
> > Valentin Petzel  writes:
> >
> > > Hello Harm,
> > >
> > > This is probably quite hard to do. Basically the problem here is that
> > > Lilypond does not in fact know the actual extent of the stencil. So to
> > > get that you’d somehow need to draw the stencil. So eighter you’d need
> > > to implement a custom drawing routine for "drawing" stencils within
> > > Lilypond, or you could try to do a function that takes a stencil,
> > > creates a new book containing that stencil, you’d then postprocess
> > > that file with a script that determines the actual extent and writes
> > > it into an auxiliary file, which is then included and gives the first
> > > function a value for overriding the extent.
> >
> > You do realise that LilyPond processes outlines?  It would seem that
> > what Harm is asking for is recalculating markup bounding box dimensions
> > from its outline.  That would seem to require some C++ code I think, but
> > not at the low level you suggest.  More like adding something similar to
> > "with-outline" support to lily/stencil-integral.cc and
> > lily/stencil-interpret.cc .
> >
> > --
> > David Kastrup
>
> We have the markup-command \with-outline.
> Alas, it looks not like what I would need and tbh, I've no clue how to
> use it, no example there.
>
> $ git grep "with-outline"
> lily/stencil-integral.cc:  else if (scm_is_eq (head, ly_symbol2scm
> ("with-outline")))
> lily/stencil-interpret.cc:  else if (scm_is_eq (head,
> ly_symbol2scm ("with-outline")))
> lily/stencil.cc:   scm_list_3 (ly_symbol2scm
> ("with-outline"),
> scm/define-markup-commands.scm:(define-markup-command (with-outline
> layout props outline arg)
> scm/define-stencil-commands.scm:with-outline
> scm/stencil.scm: ((eq? head 'with-outline) (interpret (cadr expr)))
>
> shows no doc/code-example as well.
>
> Anyway:
>
> I stumbled across the problem while looking at
> https://lists.gnu.org/archive/html/lilypond-user/2021-03/msg00187.html
> There's the complain note-by-number note working nicely with the 
> Scorlatti-font.
> For testing, I took the font from https://github.com/OpenLilyPondFonts.
>
> Further investigation showed Scorlatti-note-heads exceed the bounding
> box. With this in mind I asked here.

Screw below, I was viewing artifacts of my insufficient pdf-viewer.
Which leads to the question whether the method how it works in
notemode could be made accessible via scheme.

> Meanwhile I noticed that this holds for use in notemode as well (the
> up-Stem is always a little off).
> Same for lilyjazz from there. gonville is fine. Didn't test the others
>
> This leads to the conclusion that this scorlatti-font is unusable.
>
> Not sure whether there are free variants of these font out there.
>
> Thanks,
>   Harm



Re: markup-command boxing the real printed ink?

2021-04-20 Thread Valentin Petzel
Hello David,

That is a very different thing. with-outline simply tells the outputter to use 
a different stencil for calculating the skylines of a stencil. The problem 
here is that Lilypond relies on the stencil basically telling it’s extent. The 
problem Harm has is that this extent might be smaller than the actual size of 
the printed symbol.

So Harm is looking for a way to determine the acutal printed size of a symbol.

And no, Lilypond does not draw this stuff internally. I mean, Lilypond relies 
on Ghostscript to draw it’s output. If Lilypond wanted to do this, it would 
need it’s own PostScript interpreter.

Cheers,
Valentin

signature.asc
Description: This is a digitally signed message part.


Re: markup-command boxing the real printed ink?

2021-04-20 Thread Jean Abou Samra



Le 20/04/2021 à 16:59, Valentin Petzel a écrit :

Hello David,

That is a very different thing. with-outline simply tells the outputter to use
a different stencil for calculating the skylines of a stencil. The problem
here is that Lilypond relies on the stencil basically telling it’s extent. The
problem Harm has is that this extent might be smaller than the actual size of
the printed symbol.

So Harm is looking for a way to determine the acutal printed size of a symbol.

And no, Lilypond does not draw this stuff internally. I mean, Lilypond relies
on Ghostscript to draw it’s output. If Lilypond wanted to do this, it would
need it’s own PostScript interpreter.



Hello Valentin,

Compile the file

#(ly:set-option 'debug-skylines)
{ c'^\f }

and I think you will realize you are wrong. Skylines are
a concept of LilyPond,not PostScript. The skylines are
determined algorithmically and used foraccurate spacing
of the music. LilyPond doesn't need to understand PostScript
for that: it has its own internal representation of stencils,
and the fonts are not PostScript.

The problem is that there are no Scheme-accessible interfaces
for dealing with skylines. The smobification is superficial,
and I think it's for performance, because skyline construction
takes up a non-negligible part of the compilation time.

Regards,
Jean




Re: Center align Bar numbers to first note in first measures on new lines

2021-04-20 Thread Jean Abou Samra


Le 20/04/2021 à 14:22, F M a écrit :
Centering a stencil on another stencil (unimi.it) 

Centering markup on note heads automatically (unimi.it) 



I also found these two snippets in the repository, perhaps they could 
be adapted to centering bar numbers over note columns. Thank you for 
your time and interest.


Hello,

Something like this, then?

Best,
Jean



\version "2.23.3"

#(define (group-extent grobs refpoint axis)
   (reduce interval-union
   empty-interval
   (map
 (lambda (grob)
   (ly:grob-extent grob refpoint axis))
 grobs)))

#(define fake-musical-when-first
   (grob-transformer 'after-line-breaking
 (lambda (bar-number dummy)
   (let* ((sys (ly:grob-system bar-number))
  (columns (ly:grob-object sys 'columns))
  (break-alignment (ly:grob-parent bar-number X))
  (bar-number-column (ly:grob-parent break-alignment X))
  (first-column (ly:grob-array-ref columns 0))
  (first-musical-column (ly:grob-array-ref columns 1))
  (is-first (eq? bar-number-column first-column)))
 (if is-first
 (let* ((refpoint (ly:grob-common-refpoint bar-number 
first-musical-column X))
    (musical-elements (ly:grob-object 
first-musical-column 'elements))

    (element-list (ly:grob-array->list musical-elements))
    (note-columns (filter (lambda (g)
    (grob::has-interface g 
'note-column-interface))

  element-list)))
   (ly:grob-translate-axis!
 bar-number
 (- (interval-center
  (group-extent note-columns refpoint X))
    (interval-center (ly:grob-extent bar-number 
refpoint X)))

 X)))

\layout {
  \context {
    \Score
    \override BarNumber.after-line-breaking = #fake-musical-when-first
    \override BarNumber.break-visibility = ##(#f #t #t)
    \override BarNumber.outside-staff-priority = 1000
  }
}


<<
  \set Score.currentBarNumber = 5
  {
    c'1
    \break
    4_"Marcato" e' f' g'
    a' b' c' d'
    \break
     g' g' g'
  }
  {
    c'1
    1
    1
    1
  }
>>





Re: markup-command boxing the real printed ink?

2021-04-20 Thread Valentin Petzel
Hm, you’re right. But if you replace this by something directly drawn with 
PostScript commands, you’ll see that Lilypond does not have any idea about 
what’s there. So I guess Lilypond is able to handle stencil it knows very 
well.

And yes, Skylines are a concept of Lilypond, but Lilypond does not really 
„know” how the score looks. Lilypond thinks in objects that physically bounded 
by a skyline box. As you have shown, Lilypond is able to refine this into 
polygons for the standard symbols (for which we can quite easily find ways to 
get this actual information, as these things are eighter glyphs or lines).

But this still does not solve the Problem that Lilypond is not actually able 
to „see” where there is black stuff in an arbitrary stencil.

Cheers,
Valentin

signature.asc
Description: This is a digitally signed message part.


Re: markup-command boxing the real printed ink?

2021-04-20 Thread David Kastrup
Valentin Petzel  writes:

> Hm, you’re right. But if you replace this by something directly drawn with 
> PostScript commands, you’ll see that Lilypond does not have any idea about 
> what’s there.

About what's *there*.  Namely in images drawn by *user-written*
PostScript code.

> So I guess Lilypond is able to handle stencil it knows very well.

And it knows by far most of them very well.

> And yes, Skylines are a concept of Lilypond, but Lilypond does not
> really „know” how the score looks. Lilypond thinks in objects that
> physically bounded by a skyline box. As you have shown, Lilypond is
> able to refine this into polygons for the standard symbols (for which
> we can quite easily find ways to get this actual information, as these
> things are eighter glyphs or lines).
>
> But this still does not solve the Problem that Lilypond is not
> actually able to „see” where there is black stuff in an arbitrary
> stencil.

Is there a particular purpose in shifting the goalposts until we have an
insoluble problem unrelated to what Harm is asking about?

-- 
David Kastrup



Noob can't make 2nd stanza lyrics

2021-04-20 Thread Stephane Krims
Hi all,

I'm trying to make a vocal chart for a folk tune, but can't seem to figure out 
how to make the 2nd stanza appear.

I'm reticent about attaching the file here due to intellectual property 
concerns, but i've attached another file with the layout of what i've come up 
with so far. I've used an online template that i don't completely understand, 
so that might have something to do with it.

Can anyone tell me where the lyrics are supposed to go?

Thanks,
Stéphane


ylj troubleshooting.ly
Description: ylj troubleshooting.ly


re: Noob can't make 2nd stanza lyrics

2021-04-20 Thread Remy CLAVERIE
Hi Stéphane,

 

I think you need to have several Lyrics like :

 

altoWords_A = \lyricmode {
    \set stanza = "1. "
  % 1st verse and chorus

}

 

altoWords_B = \lyricmode {
    \set stanza = "2. "
  % 2nd verse and chorus

}

 

altoWords_C = \lyricmode {
    \set stanza = "3. "
  % 3rd verse and chorus

}

 

and add them in the context

HTH

Rémy

 

> Message du 21/04/21 08:41
> De : "Stephane Krims" 
> A : "lilypond-user@gnu.org" 

> Copie à : 
> Objet : Noob can't make 2nd stanza lyrics
> 
>
Hi all,

>
I'm trying to make a vocal chart for a folk tune, but can't seem to figure out 
how to make the 2nd stanza appear.

>
I'm reticent about attaching the file here due to intellectual property 
concerns, but i've attached another file with the layout of what i've come up 
with so far. I've used an online template that i don't completely understand, 
so that might have something to do with it.

>
Can anyone tell me where the lyrics are supposed to go?

>
Thanks,
Stéphane

>
> [ ylj troubleshooting.ly (2.2 Ko) ]