Font questions about absolute

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Font questions about absolute

Reggie
Hello everyone. I understand you always have the option to use absolute font
for markup, tempo, and other markings for fonts. However is there a chart or
cheat "sheet" showing the conversion or what the current font is without
always refercing the documentation internals? For example, if I'm in
frescobaldi and I'm using a text override something = #4 for font size, how
do I know roughly what that absolute size is without looking up in the
internals for the default of whatever object I am overriding? That is slow I
find.

Is there any easy way to quickly see or convert absolutely font to #3 or #5
and so on? In frescobaldi like a function() or something. Thank you for any
help.

Do you suggest new and beginner users like myself use absolute font sizes
for things like tempo instrument changes and tempo changes? What do you  all
do?



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Font questions about absolute

Aaron Hill
On 2019-05-11 10:52 am, Reggie wrote:
> Is there any easy way to quickly see or convert absolutely font to #3
> or #5
> and so on? In frescobaldi like a function() or something. Thank you for
> any
> help.

Within \markup, you can use \abs-fontsize to get a specific size that
will not scale based on the global staff size.  That does not require
any conversion.

If you are trying to set the relative font size of a grob that produces
text and you want it to match a specific absolute font size, then you
are going to need to break out your calculator and do some arithmetic.  
(LilyPond has some Scheme functions to assist here.)

One thing to understand is the logarithmic scale that LilyPond uses for
relative font sizes.  A value of 6 results in doubling the size of a
font, whereas a value of -6 will halve the size of the font.  Each
increment of 6 in either direction is another doubling or halving.  So
in this system, adding an amount on the logarithmic scale results in
multiplying the value on the linear scale.

The magstep and magnification->font-size procedures help with converting
between linear and logarithmic.  So (magstep 6) will produce 2.0 as
output, and (magnification->font-size 1/2) will produce -6.0 as output.  
But if you need to do the math by hand, here are those functions:

   magstep(x) = 2 ^ (x / 6)
   magnification->font-size(x) = 6 * log_2(x)

(Recall that a logarithm of any one base can be used to compute the
logarithm of any other base.  So to compute the base-two log above using
the natural log is simply: ln(x) / ln(2).)

Another thing to be aware of is how the global staff size plays into
font size.  The default is a 20pt staff (5pt staff spaces) and a
resulting font size of 11pt.  The ratio of 11/20 is important, since if
you were to shrink the staff size to 16, for example, the resulting font
will be 16 * 11/20 = 8.8.

Putting this together, we can calculate precisely what the resulting
font size would be given our knowledge of the global staff size and the
relative font size of a text element.  Likewise, we can determine a
relative font size that will result in an absolute font size.

For the first case--going from relative to absolute--let us assume we
have a staff size of 18 and our grob's font-size is 2.  The global font
size is 18 x 11/20 = 9.9 and the magnification factor is 2^(2/6) ~=
1.26, so our result is approximately 12.5pt.  And in Scheme, we could
say:

   (* 18 11/20 (magstep 2))
   --> 12.4732183939592

For the second case--going from absolute to relative--let us assume we
have a staff size of 24 and need to set the grob's font-size so that the
result is exactly 18pt.  The global font size is 24 * 11/20 = 13.2.  To
get from 13.2 to 18 requires a magnification of 18 / 13.2 ~= 1.36.  
This, in the logarithm scale, is 6 * log_2(1.36) ~= 2.68.  In Scheme, we
do:

   (magnification->font-size (/ 18 (* 24 11/20)))
   --> 2.68475386182733

Now all that said, is this "easy"?  Depends on your comfortability with
maths, I suppose.  I usually stick to relative font sizes and do not
concern myself with the absolutes, since it is my eye that determines
whether something is big enough or small enough, not a ruler.

Of course, I recently did have to use the above computations when I was
typesetting hymns for projection.  I needed to have the flexibility of
changing the staff size independent of the lyric font size as I was
experimenting with what would look good.  So rather than have to compute
things by hand, I used something similar to the absolute-to-relative
Scheme code above.


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Font questions about absolute

Reggie
Aaron Hill wrote

> On 2019-05-11 10:52 am, Reggie wrote:
>> Is there any easy way to quickly see or convert absolutely font to #3
>> or #5
>> and so on? In frescobaldi like a function() or something. Thank you for
>> any
>> help.
>
> Within \markup, you can use \abs-fontsize to get a specific size that
> will not scale based on the global staff size.  That does not require
> any conversion.
> I usually stick to relative font sizes and do not concern myself with the
> absolutes, since it is my eye that determines whether something is big
> enough or small enough, not a ruler.
>
> -- Aaron Hill
>
> _______________________________________________
> lilypond-user mailing list

> lilypond-user@

> https://lists.gnu.org/mailman/listinfo/lilypond-user

Aaron wow yes I understand the maths perfectly that's my area. Thank you
your answer is perfect. But as I understand the Gould engraving book and
other font "normal" standards, how does one handle font size then regardless
of staff size and paperr? For example, let's say a publshing house wants
"all tempo marks must be 14pt roman" or "all expressive font must be 12pt in
parts and 14pt in score"? If the size of your paper and staff size could
change depending on the size of ensemble, would you then still use absolute
font sizes to align with explicit needs for font rules? Or would you
personally eye ball font size and use relative and get it close enough to
absolute font size. I don't understand the best practice if you want to in
the end have a certain set point size for certain markings with variable
paper sizes.




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Font questions about absolute

Aaron Hill
On 2019-05-11 12:53 pm, Reggie wrote:

> Aaron wow yes I understand the maths perfectly that's my area. Thank
> you
> your answer is perfect. But as I understand the Gould engraving book
> and
> other font "normal" standards, how does one handle font size then
> regardless
> of staff size and paperr? For example, let's say a publshing house
> wants
> "all tempo marks must be 14pt roman" or "all expressive font must be
> 12pt in
> parts and 14pt in score"? If the size of your paper and staff size
> could
> change depending on the size of ensemble, would you then still use
> absolute
> font sizes to align with explicit needs for font rules? Or would you
> personally eye ball font size and use relative and get it close enough
> to
> absolute font size. I don't understand the best practice if you want to
> in
> the end have a certain set point size for certain markings with
> variable
> paper sizes.

I cannot comment on how to organize projects for clients/publishing
houses, as all of my work is largely personal.  (Well, technically, it
is for my church; but I have had the final say on stylistic issues like
staff and font size.)

But providing you have determined what staff size you intend to use,
everything else should essentially be fixed.  That should give you a
basis to ensure that any elements that need a strict font size can have
it.

If the staff size is variable between different outputs, you may have to
use the math I showed if you are trying to get an exact match.  Consider
the following:

%%%%
\version "2.19.82"

#(set-global-staff-size 14)

#(define (defaultpaper-text-font-size)
   (module-ref
     (ly:output-def-scope (ly:parser-lookup '$defaultpaper))
     'text-font-size))

#(define (abs->font-size size)
   (magnification->font-size
     (/ size (defaultpaper-text-font-size))))

\score {
   <<
     \new Staff {
       b'4^\markup { "qxb" \abs-fontsize #12 "qxb" }
     }
     \new Lyrics \lyricmode {
       \markup { "qxb" \abs-fontsize #20 "qxb" } 4
     }
   >>

   \layout {
     \context {
       \Staff
       \override TextScript.font-size = #(abs->font-size 12)
     }
     \context {
       \Lyrics
       \override LyricText.font-size = #(abs->font-size 20)
     }
   }
}
%%%%

You should see identically sized "qxb" text even when you change the
global staff size.

NOTE: Manual use of things like make-pango-font-tree introduce the
possibility that text-font-size is not an accurate value.  Providing one
is following the recommended practice of setting the scaling factor,
then things should work.

Also NOTE: Setting the fontSize context property will impact the
results, since that applies in addition to the font-size property of a
grob.


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user