lilypond-user
[Top][All Lists]
Advanced

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

Re: Trouble with notation fonts when resizing


From: David Sumbler
Subject: Re: Trouble with notation fonts when resizing
Date: Sun, 13 May 2018 11:46:46 +0100

On Sun, 2018-05-13 at 00:59 -0600, Abraham Lee wrote:
> Hi, David!
> 
> On Sat, May 12, 2018 at 10:57 AM, David Sumbler <address@hidden>
> wrote:
> > On Sat, 2018-05-12 at 03:45 -0700, Torsten Hämmerle wrote:
> > > David Sumbler wrote
> > > > 
> > > > set-global-staff-size seems to be very buggy, and the newer
> > > > magnify-
> > > > staff (see Notation Ref. section 4.2.2) is recommended
> > > Hi David,
> > > 
> > > I wouldn't call set-global-staff-size buggy, it's still the way
> > to go
> > > if you
> > > want to change the global stave size.
> > > 
> > > \magnifyStaff is inteded to be used for scaling single staves
> > within
> > > a score
> > > and spacing will behave accordingly.
> > > 
> > > The problem Brent ran into is neither new nor does it come
> > > unexpected: When
> > > using custom fonts (no difference between text and music fonts
> > here),
> > > you'll
> > > have to tell LilyPond which size to use, and consequently you
> > always
> > > had to
> > > scaling factors.
> > > 
> > > Examples:
> > > When changing a document's default fonts by using pango-make-
> > font-
> > > tree,
> > > there should alway be a scaling factor such as
> > > (/ staff-height pt 20)
> > > if you want to use non-standard stave-sizes (i.e. stave-sizes
> > other
> > > than 20
> > > pt)
> > > 
> > > The same holds true for music fonts.
> > > 
> > > Therefore, Andrew's approach is the way to go.
> > > There is a nice  essay on alternative notations fonts
> > > <http://lilypondblog.org/2015/03/managing-alternative-fonts-with-
> > lily
> > > pond/>  
> > > by Urs Liska, giving an example:
> > > 
> > > \paper {
> > >   #(define fonts
> > >     (set-global-fonts
> > >       #:music "emmentaler"
> > >       #:brace "emmentaler"
> > >       #:roman "Century Schoolbook L"
> > >       #:sans "sans-serif"
> > >       #:typewriter "monospace"
> > >       #:factor (/ staff-height pt 20)
> > >   ))
> > > }
> > > 
> > > In Brent's original post, this #:factor entry was missing and
> > that's
> > > the
> > > reason why the gonville font wasn't properly sized.
> > > 
> > > All the best,
> > > Torsten
> > 
> > The problem I found over a year ago, and rediscovered yesterday is
> > that, even without changing any fonts from the default, using set-
> > global-staff-size more than once in the same input file (but
> > relating
> > to separate output files) causes huge problems with the layout of
> > text
> > in the second (or later) output file.  It is as if using this
> > command
> > sets various parameters, but then using it a second time (for a
> > different output file) does not set those parameters correctly.  I
> > would certainly call that buggy, particularly as the documentation
> > implies that it ought to be set-able independently for every
> > individual
> > \book section in an output file.
> What Torsten says is correct. And while the functionality is
> inconvenient due to its restricted outermost scope, it *does* work
> for every individual \book section with the appropriate order of
> events. What you need to realize is that you need to be explicit
> about this. For example, if I have an input file that has multiple
> \score blocks, but no explicit \book blocks, like this:
> 
> #(set-global-staff-size 16)
> \score { ...}
> 
> #(set-global-staff-size 18)
> \score {...}
> 
> then yes, only the final call to set-global-staff-size will be in
> effect because a \score block is *not* a \book block, so all \score
> blocks are affected and any previous call to set-global-staff-size is
> basically undone by the last one.  
> 
> Now, if you explicitly call \book like this:
> 
> #(set-global-staff-size 16)
> \book {
>   \score { ... }
> }
> 
> #(set-global-staff-size 18)
> \book {
>   \score { ... }
> }
> 
> then you will find that each \score gets the appropriate scaling, the
> first at 16pt and the second at 18pt. Just remember that the last
> call to set-global-staff-size resets both the main staff size and ALL
> the font choices and remains in effect from that point on until re-
> called before another \book block. The downside here is that calling
> a new \book block generates a new output file. So, if you want to
> have each \score inside the same file, you need to be ok with the
> other scaling mechanisms (like \magnifyStaff, etc.). As explained in
> section 4.2.2 of the NR, there's also this option:
> 
> \score {
>   ....
>   \layout {
>     #(layout-set-staff-size 16)
>   }
> }
> 
> which is supposed to set the staff size for that particular score,
> but I've noticed that some of the horizontal spacing still acts like
> it is using glyphs at the global staff size. See the attached image,
> which has the first \score at the default 20pt and the second at 14pt
> and the third at 26pt. Notice, in particular, the space between the
> clef and key signature and between the key signature and the time
> signature. I'd really love it if this were addressed properly via the
> layout-set-staff-size function. This isn't the only time I've seen
> spacing not being honored when the font is changed to something non-
> default, but that's for another thread.
>  
> > I haven't looked at the source code, and probably wouldn't be able
> > to
> > fathom it if I did, but I wonder if set-global-staff-size alters
> > some
> > parameters on the assumption that they are at their default values,
> > which of course can give a wrong result after a previous call.
> It does alter some parameters with each call, particularly the fonts
> (actually, the full "fonts" variable) and their sizes.
>  
> > Certainly for my purposes I have found set-global-staff-size
> > virtually
> > unusable, because it can produce crazy text layouts such as having
> > adjacent letters in a word overlapping each other.  However I am
> > delighted to say that putting (for instance)
> > \layout { Staff \magnifyStaff #4/5 }
> > at the appropriate point in a file gives me 16-point staves without
> > messing up the layout of titles etc.
> I certainly can't say that this has been my experience. I've found
> set-global-staff-size perfectly usable, but you just have to know
> what to expect when you call it and where its effects are felt.
> 
> Anyway, hopefully my explanation above is helpful.
> 
> Best,
> Abraham 

Thank you for all of that.  I couldn't readily reproduce the results I
was originally getting, because the relevant files have since been
edited extensively to get around the problems.

What I can say with virtual certainty is that I have always used
explicit \book blocks, so the problem did not arise there.

I have now started from the input file you suggested above, i.e.

#(set-global-staff-size 16)
 \book {
   \score { ... }
 }

#(set-global-staff-size 18)
 \book {
   \score { ... }
 }

and tested the outputs.  After considerable experimentation trying to reproduce 
the unacceptable results I had found in the past, I discover that my problem 
was caused by the use of \abs-fontsize on title-pages etc.  The reason that I 
used this perhaps unusual item was simply to try to get the same result on a 
score with 16-point staves and the instrumental parts with 20-point.  Of course 
I now realise that whilst \abs-fontsize changes the size of the font, it 
doesn't apparently alter its spacing.  Perhaps it should, because I can't 
imagine that anyone would ever find that particular characteristic very useful.

Since set-global-staff-size has to be set outside the \book block, and since it 
then affects all text (even titles and notes) within the block, it seems 
somewhat difficult to get around this problem.  Of course I could have one file 
to generate the actual pages of music, and another (not necessarily a LilyPond 
file) to generate the cover, title page and notes which precede the music 
itself, but I do prefer to have a single output file which covers the whole 
physical book.

In my early days of using LilyPond I constructed myBookTitleMarkupSixteen and 
myBookTitleMarkupTwenty variables to produce similar-sized title layouts at 
both staff sizes on the first page of music.  I could have done the same for 
the cover page etc. I suppose, but it does seem slightly absurd to have to 
write 2 different routines to produce identical outputs.  Using \magnifyStaff 
instead of set-global-staff-size does away with the necessity for such 
juggling.  Whether there are disadvantages to this approach I don't know, but 
so far I haven't discovered any.

How do other people deal with the problem that set-global-staff-size affects 
every printed item, and not just those that are directly associated with a 
staff?

David



reply via email to

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