Re: Imprecise font scaling

2024-02-10 Thread Werner LEMBERG

>> However, 2 * 3.86523438 = 7.73046876 != 7.73242188.

> I'm quite sure this is because of
>
>  int pango_size = static_cast (
>     std::lround (static_cast (requested_size) * PANGO_SCALE));
>
>
> in lily/font-select.cc, which we cannot really do anything about,
> because the Pango API
>
> https://docs.gtk.org/Pango/method.FontDescription.set_size.html
>
> expects an integer size scaled by PANGO_SCALE, which is 1024. That
> is, we are limited to a precision of 1/1024 points on the font size.

Shall we document this somehow?


Werner


Re: Imprecise font scaling

2024-02-10 Thread Jean Abou Samra
> Shall we document this somehow?

Not everything is necessarily worth documenting.



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


Re: Imprecise font scaling

2024-02-10 Thread Jean Abou Samra

I'm running the following code

\version "2.25.12"
\markup { LOL }
\markup { \magnify #2.0 LOL }

and the results are not really precise. When producing --eps, the relevant 
output lines are

/C059-Roman 3.86523438 output-scale div selectfont
/C059-Roman 7.73242188 output-scale div selectfont

However, 2 * 3.86523438 = 7.73046876 != 7.73242188. Basically the same 
behaviour can be observed when using Cairo (both for EPS and SVG).
> (Producing SVG without Cairo is pretty disastrous in this regard, but
> that doesn't bother me too much at the moment.)


I'm quite sure this is because of

  int pango_size = static_cast (
std::lround (static_cast (requested_size) * PANGO_SCALE));

in lily/font-select.cc, which we cannot really do anything about, because
the Pango API

https://docs.gtk.org/Pango/method.FontDescription.set_size.html

expects an integer size scaled by PANGO_SCALE, which is 1024. That is, we are
limited to a precision of 1/1024 points on the font size.






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


Re: Imprecise font scaling

2024-02-10 Thread Jean Abou Samra
Sorry, my mail client changed the formatting in a way I didn't expect.
Resending.

> I'm running the following code
> 
> \version "2.25.12"
> \markup { LOL }
> \markup { \magnify #2.0 LOL }
> 
> and the results are not really precise. When producing --eps, the relevant
> output lines are
> 
> /C059-Roman 3.86523438 output-scale div selectfont
> /C059-Roman 7.73242188 output-scale div selectfont
> 
> However, 2 * 3.86523438 = 7.73046876 != 7.73242188. Basically the same
> behaviour
> can be observed when using Cairo (both for EPS and SVG).
> (Producing SVG without Cairo is pretty disastrous in this regard, but
> that doesn't bother me too much at the moment.)


I'm quite sure this is because of


 int pango_size = static_cast (
    std::lround (static_cast (requested_size) * PANGO_SCALE));


in lily/font-select.cc, which we cannot really do anything about, because
the Pango API

https://docs.gtk.org/Pango/method.FontDescription.set_size.html

expects an integer size scaled by PANGO_SCALE, which is 1024. That is, we are
limited to a precision of 1/1024 points on the font size.




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


Re: Imprecise font scaling

2024-02-10 Thread Alexander Slávik


"
…expects an integer size scaled by PANGO_SCALE, which is 1024. That is, we
are


limited to a precision of 1/1024 points on the font size.
"



An "evidence" for this might be that the difference
7.73242188 - 7.73046876

is pretty close to 2/1024.




AS