lilypond-user
[Top][All Lists]
Advanced

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

Re: Usage of ly:stencil-fonts ??


From: Thomas Morley
Subject: Re: Usage of ly:stencil-fonts ??
Date: Tue, 23 Oct 2018 23:23:21 +0200

Am Mo., 22. Okt. 2018 um 21:59 Uhr schrieb Torsten Hämmerle
<address@hidden>:
>
> Hi Harm,
>
> All these numbers are quite confusing at first glance. And at second and
> third glance, too.
> But they are nothing but conversion factors to switch units.
> And, unfortunately, LilyPond basically uses three concurrent units in
> parallel:
>
> - LilyPond units in staff-spaces
> - Pango units in mm
> - Typographic units in pt
>
>
> This said, I'll try to derive all the values you have found using the
> example of a standard 20-pt-staff with the corresponding standard text font
> size of 11pt.
> I will use a ridiculous number of decimal places to make it easier to
> compare the results to your scheme output.
>
> As LilyPond is a European program, there are no inches to be seen and we'll
> only use mm (millimetres).
> Both mm and pt are always absolute units (as printed on the final sheet),
> whereas a staff-space (let's call it 1sp) is always relative (depending on
> the current staff-size).
>
>
>
> pt value: conversion between pt and sp
>
> The 'pt values are the conversion factor from pt to staff-spaces:
> A 5-line 20-pt staff is 4sp high ==> 20pt = 4sp, in other words:
>
> 1pt = 0.2sp (resp: 'pt = 0.2)
>
> See? Multiply any value in pt by 'pt and you'll get staff-spaces.
>
> With a 10-pt staff, we get 'pt = 0.4 so that you have to multiply any
> pt-value by 0.4 to get the corresponding value in staff-spaces. The factor
> has to be twice as big because a 10pt staff is half the size of a 20pt
> staff.
>
>
> ancestor-pt value: conversion between pt and mm
>
> In markup (i.e. font environment), Pango fonts (metrics and size in mm!)
> come into play.
>
> This factor does not change when varying global-staff-size or anything,
> because both pt and mm are absolute units and the conversion factor always
> stays the same. Knowing how many mm or pt are in an inch, it's easy to
> derive the factor:
> 1in = 25.4mm
> 1in = 72.27pt
>
> 1pt = 0.3514598035145980351459803514598 mm
> This is your ancestor-pt value. :)
>
> Our standard 11pt-font therefore will be 3.8660578386605783... mm in size
> *Caveat:* the Pango font size from stencil-expr is not quite that, because
> there is some rounding applied to avoid buffering too many fonts with with
> microscopic size differences.
>
>
> text-font-size: Just the actual font size in pt
>
> The text-font-size displayed for a 20pt staff is 11pt (as suspected).
> When setting global-staff-size to 10pt, text-font-size will consequently
> only be half as big: 5.5pt.
>
>
> font and size form stencil-expr
>
> This is, as usual, the font size in (absolute) mm, but slightly quantized to
> avoid the buffering of too many differently-sized fonts with only
> microscopic font size differences.
>
> 3.865234375 is about what we'd expect for a standard 11pt font, applying
> \fontsize #2 will change this by a factor of 2^(2/6) = 1.2599210498 so that
> we get a
> 4.870927651... as reported (slight quanting/rounding effects).
>
>
> output-scale: converting staff-spaces into mm
>
> Finally, the output-scale factor is needed to transform LilyPond metrics (or
> \translate #'(a . b) operations) from staff spaces to Pango mm.
>
>
> In a 20pt standard stave, four staff-spaces will make up the 20pt, i.e. 1sp
> = 5pt.
> Using the pt-to-mm conversion factor (we want mm for Pango!), one
> staff-space is
> 1sp = 5pt = 1.7572990175... mm (that's your output-scale).
>
> If we change the staff-size to 16pt, we get
> 1pt = 4pt = 1,4058392... as output-scale.
>
>
> That's about all, I think…
>
> HTH,
> Torsten

Hi Torsten,

thanks for all the info, I'll need to study it thoroughly.

Btw, I meanwhile got LilyPond 2.8.8 working in an old LilyDev.
With this ancient version ly:stencil-fonts always returns '() as well.

Thanks,
  Harm



reply via email to

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