Bug 701165 - Bold fonts come out with gaps
Summary: Bold fonts come out with gaps
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Transparency (show other bugs)
Version: 9.27
Hardware: PC Linux
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-05 08:51 UTC by na
Modified: 2023-05-11 13:07 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
Generated PNGs and PDF (103.61 KB, application/zip)
2019-06-05 08:51 UTC, na
Details
Generated PNG in master (26.04 KB, image/png)
2020-12-30 01:37 UTC, Peter Cherepanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description na 2019-06-05 08:51:42 UTC
Created attachment 17633 [details]
Generated PNGs and PDF

Hi,

when processing the attached PDF with Ghostscript in newer versions the resulting PNG contains "gaps" within the font whereas with older Ghostscript versions the result is as expected.

Command used: gs -q -dSAFER -dBATCH  -dDOINTERPOLATE -dJPEGQ=90  -dFirstPage=1 -dLastPage=1  -dNOPAUSE -sDEVICE=jpeg -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile='prod_73_1559634485_20_gs21.png' 'prod_73_1559634485_20.pdf'
Comment 1 Ken Sharp 2019-06-05 09:22:52 UTC
Nothing to do with images. 'Looks like' this is an artifically emboldened font using stroke+fill to achieve the bold effect. Possibly the scan conversion is incorrect in that its not butting the fill precisely to the inner edge of the stroke.

Could also be a clipping problem, more investigation required.
Comment 2 Ken Sharp 2019-06-05 14:02:05 UTC
The problem here is the use of GraphicsAlphaBits. What this does (effectively) is reduce the sharpness of graphics edges, it 'blurs' the edge.

In the case of this file what we have is a font which is not bold, but has been made to appear bold by drawing a thick line around the edge of it. This has been done by setting the text rendering mode to 2 (fill and then stroke) with a wide linewidth.

It appears that the stroke alphabits are being created by blending with a white buffer, instead of the black drawn by the initial fill of the letter shapes.

This first appears in this commit:

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=dc09d291658c1758fe2a0a02776e66355f56b09a

As implied by the commit, using -dNOTRANSPARENCY causes the problem to go away. It doesn't look to me like the transparency operations actually do anything useful in this file, they seem to have been specified purely in order to ensure that each of the Form gtoups (also pointless, since they are only used once) is 'Isolated' in transparency terms.

I'm assigning this to Michael to look at, but my advice would be to simply drop the GraphicsAlphaBits and TextAlphaBits from your command line. You are rendering to JPEG output which should produce blurry enough output for anyone.
Comment 3 Peter Cherepanov 2020-12-30 01:37:32 UTC
Created attachment 20411 [details]
Generated PNG in master

This bug appears to have been fixed in the master branch.
Comment 4 Ken Sharp 2023-05-11 08:55:54 UTC
As per Peter's comment #3, this seems to work, presumably fixed as part of some other bug.