[cairo] font size change only in large steps

Alois Treindl alois at astro.ch
Sat Sep 29 09:25:26 UTC 2018


It is important to know which version of cairo I am using.

The sample I posted earlier is run on cairo-1.14.8-2.el7.x86_64on RHEL7.5

The problem appeared only with the update of Redhat Linux from RHEL6 to 
RHEL7.

If I run the samples on the old machine, which has 
cairo-1.10.2-1.el6.x86_64, the fonts scale properly:

[alois at as81 devlop]$ ctest1  bitmap surface
9.0 pt on  Size: 45x7    9.0 pt off  Size: 45.7764x7
9.1 pt on  Size: 45x7    9.1 pt off  Size: 46.222x7
9.2 pt on  Size: 45x7    9.2 pt off  Size: 46.7418x7
9.3 pt on  Size: 46x7    9.3 pt off  Size: 47.1874x7
9.4 pt on  Size: 46x7    9.4 pt off  Size: 47.7072x7
9.5 pt on  Size: 46x7    9.5 pt off  Size: 48.1528x7
9.6 pt on  Size: 46x8    9.6 pt off  Size: 48.5984x8
9.7 pt on  Size: 46x8    9.7 pt off  Size: 49.1183x8
9.8 pt on  Size: 48x8    9.8 pt off  Size: 49.5639x8
9.9 pt on  Size: 53x8    9.9 pt off  Size: 50.0837x8
10.0 pt on  Size: 55x8    10.0 pt off  Size: 50.5293x8

[alois at as81 devlop]$ ctest2  PDF surface
9.0 pt on  Size: 45.4951x6.8125    9.0 pt off  Size: 45.4951x6.8125
9.1 pt on  Size: 45.9407x6.8125    9.1 pt off  Size: 45.9407x6.8125
9.2 pt on  Size: 46.4606x6.8125    9.2 pt off  Size: 46.4606x6.8125
9.3 pt on  Size: 46.9062x6.8125    9.3 pt off  Size: 46.9062x6.8125
9.4 pt on  Size: 47.426x6.8125    9.4 pt off  Size: 47.426x6.8125
9.5 pt on  Size: 48.1841x7.5625    9.5 pt off  Size: 48.1841x7.5625
9.6 pt on  Size: 48.6297x7.5625    9.6 pt off  Size: 48.6297x7.5625
9.7 pt on  Size: 49.1496x7.5625    9.7 pt off  Size: 49.1496x7.5625
9.8 pt on  Size: 49.5951x7.5625    9.8 pt off  Size: 49.5951x7.5625
9.9 pt on  Size: 50.115x7.5625    9.9 pt off  Size: 50.115x7.5625
10.0 pt on  Size: 50.5605x7.5625    10.0 pt off  Size: 50.5605x7.5625

What happened between cairo 1.10 and cairo 1.14 to cause this issue?


On 29.09.18 10:57, Alois Treindl wrote:
> sorry, sent html message again which this list dos not accept.
> I send a second time.
> ----
> I added font size changes to the example, and print extents with 
> metric on and off.
> The problem which I am addressing appears: font size changes only in 
> steps.
>
> 9.0 pt on  Size: 49x7    9.0 pt off  Size: 45.7764x7
> 9.1 pt on  Size: 49x7    9.1 pt off  Size: 45.7764x7
> 9.2 pt on  Size: 49x7    9.2 pt off  Size: 45.7764x7
> 9.3 pt on  Size: 49x7    9.3 pt off  Size: 45.7764x7
> 9.4 pt on  Size: 49x7    9.4 pt off  Size: 45.7764x7
> 9.5 pt on  Size: 51x7    9.5 pt off  Size: 50.5293x7
> 9.6 pt on  Size: 51x7    9.6 pt off  Size: 50.5293x7
> 9.7 pt on  Size: 51x7    9.7 pt off  Size: 50.5293x7
> 9.8 pt on  Size: 51x7    9.8 pt off  Size: 50.5293x7
> 9.9 pt on  Size: 51x7    9.9 pt off  Size: 50.5293x7
> 10.0 pt on  Size: 51x7    10.0 pt off  Size: 50.5293x7
>
> I ran also the same example but with PDF surface, and get as output:
> ctest2
> 9.0 pt on  Size: 45.4951x6.8125    9.0 pt off  Size: 45.4951x6.8125
> 9.1 pt on  Size: 45.4951x6.8125    9.1 pt off  Size: 45.4951x6.8125
> 9.2 pt on  Size: 45.4951x6.8125    9.2 pt off  Size: 45.4951x6.8125
> 9.3 pt on  Size: 45.4951x6.8125    9.3 pt off  Size: 45.4951x6.8125
> 9.4 pt on  Size: 45.4951x6.8125    9.4 pt off  Size: 45.4951x6.8125
> 9.5 pt on  Size: 50.5605x7.5625    9.5 pt off  Size: 50.5605x7.5625
> 9.6 pt on  Size: 50.5605x7.5625    9.6 pt off  Size: 50.5605x7.5625
> 9.7 pt on  Size: 50.5605x7.5625    9.7 pt off  Size: 50.5605x7.5625
> 9.8 pt on  Size: 50.5605x7.5625    9.8 pt off  Size: 50.5605x7.5625
> 9.9 pt on  Size: 50.5605x7.5625    9.9 pt off  Size: 50.5605x7.5625
> 10.0 pt on  Size: 50.5605x7.5625    10.0 pt off  Size: 50.5605x7.5625
>
> with PDF, metrics on or off makes no difference. But the font size 
> changes are in steps.
>
> On 29.09.18 08:12, Uli Schlachter wrote:
>> Hi,
>>
>> On 28.09.2018 14:10, Alois Treindl wrote:
>>> I noticed that cairo does not allow me to set a precise font size, 
>>> like 9.4 pt
>>> or 9.7 pt.
>>> What I get is exactly the same font size, for a range of font sizes.
>> Try disabling metrics hinting via CAIRO_HINT_METRICS_OFF. See the
>> attached example program. Per the docs, this metrics hinting quantizises
>> font metrics so that they are integer values in device space, i.e. does
>> exactly what you are trying to get rid of.
>>
>> You might also want to do cairo_font_options_set_hint_style(opt,
>> CAIRO_HINT_STYLE_NONE), depending on, well, if you want the font
>> outlines to be hinted or not.
>>
>> Cheers,
>> Uli
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20180929/c068ce13/attachment-0001.html>


More information about the cairo mailing list