[cairo] PDF: Font size is rounded

Adrian Johnson ajohnson at redneon.com
Fri Apr 1 11:52:48 UTC 2016


On 01/04/16 21:03, Kouhei Sutou wrote:
> Hi,
> 
> The specified font size of scaled TrueType font is rounded
> when PDF surface is used. Is it the expected behavior?

The PDF surface should turn off hinting metrics when generating PDF
output. Have you tried checking the metrics returned by
cairo_scaled_font_glyph_extents()?. Use cairo_set_font_options() to turn
off hinting metrics when doing this.


> 
> Details:
> 
> Here is a program that reproduces the behavior:
> https://savannah.nongnu.org/bugs/download.php?file_id=36806
> 
> Here is the output of the program:
> https://savannah.nongnu.org/bugs/download.php?file_id=36804
> 
> 8.000, 8.125, 8.250 and 8.375 are the same font size.
> 8.500, ... and 9.375 are the same font size.
> 
> It's caused since FreeType 2.4.6. FreeType 2.4.6 includes
> the change:
> http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b0962ac34e66052ccfee7996e5468f30d4bd5a72
> 
> If I revert the change by
> https://savannah.nongnu.org/bugs/download.php?file_id=36807 ,
> the program outputs the following PDF:
> https://savannah.nongnu.org/bugs/download.php?file_id=36805
> 
> In the PDF, 8.000 and 8.125 are the different font size.
> 
> 
> I send a question about whether the change is expected or
> not to FreeType developers
> https://savannah.nongnu.org/bugs/?47582 , a developer said
> that it's expected:
> https://savannah.nongnu.org/bugs/?47582#comment2
> 
> He also said that the use case may be better handled by
> high-level library:
> https://savannah.nongnu.org/bugs/?47582#comment8
> 
> So I send this question to here. Maybe I should send this
> question to Pango. Pango also has the same behavior with
> PangoCairoFontMap.
> 
> 
> Thanks,
> --
> kou
> 



More information about the cairo mailing list