[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Finally I found out about "\myStaffSize 20"
From: |
Eyolf Ostrem |
Subject: |
Finally I found out about "\myStaffSize 20" |
Date: |
Thu, 17 Aug 2006 00:40:36 +0200 |
User-agent: |
KMail/1.9.4 |
Seemingly a simple task: I want to change the global staff size of my score,
AND I want some other fonts than the defaults.
I've broken my head over this one, and I think I've got it now, but I also
think it shouldn't have taken such an effort.
If one wants EITHER to change the size OR the fonts, the documentation is good
enough, if cryptic:
10.5.1 Setting global staff size
To set the global staff size, use set-global-staff-size.
#(set-global-staff-size 14)
This sets the global default size to 14pt staff height and scales all fonts
accordingly.
Fine. It does, unless one tries it together with the instructions for changing
the default font:
8.1.7 Font selection:
It is also possible to change the default font family for the entire document.
This is done by calling the make-pango-font-tree from within the \paper
block. The function takes names for the font families to use for roman, sans
serif and monospaced text. For example,
\paper {
myStaffSize = #20
#(define fonts
(make-pango-font-tree "Times New Roman"
"Nimbus Sans"
"Luxi Mono"
(/myStaffSize 20)))
}
The two taken together ( #(set-global-staff-size 14), myStaffSize = #20, and
(/myStaffSize 20) ) gives ridiculously big note symbols on a small staff.
I've looked around for explanations of this, both the mysterious "myStaffSize"
and the even more mysterious "20" after it, but haven't found it, neither in
the documentation, nor in the source code, nor in this forum, other than in
other posts asking how to do it.
I found this in /usr/share/lilypond/scm/font.scm:
(define-public (make-pango-font-tree roman-str sans-str typewrite-str factor)
(let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
(add-music-fonts n factor)
(add-pango-fonts n 'roman roman-str factor)
(add-pango-fonts n 'sans sans-str factor)
(add-pango-fonts n 'typewriter typewrite-str factor)
n))
I figured that "factor" in the place where (\myStaffSize 20) meant that it was
some kind of scaling factor, so that if I set them to the same value, it
would scale 1:1 -- which it does, but only relative to the default font size.
In the end, after some trial and error with Kruler and Kcalc, I found the
solution, which, as it turned out, is ridiculously simple, but obscure:
- myStaffSize is a random variable name. It can be changed to 'bolg' in both
places, and it still works.
- If set-global-staff-size is changed, \myStaffSize (or \bolg) should be
changed to the same value.
- AND - most importantly: "20" should remain the same. Apparently, it's a
hard-coded default value against which all other font size modifications are
measured.
Why this has to be so, eludes me, but I'm sure there is a good reason for it.
But I think it would be a good idea to include these points in the manual. It
would have saved me - and I guess also others - a lot of confusion.
Eyolf
--
... Had this been an actual emergency, we would have fled in terror,
and you would not have been informed.
- Finally I found out about "\myStaffSize 20",
Eyolf Ostrem <=