Bug 688552

Summary: A poor grid fitting when a flex hint is missing.
Product: Ghostscript Reporter: leonardo <leonardo>
Component: Graphics LibraryAssignee: leonardo <leonardo>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---
Attachments: d.bmp.zip
86554321-.pdf
patch.txt

Description leonardo 2006-02-10 11:09:45 UTC
When a glyph outline includes a local extremum with a very low curvity, and the 
curvity sign is opposite to the sign of the nearest global extremum, the grid 
fitting appears bad unless a flex hint is specified. 

This problem happens while rendering 86554321.pdf with patch6 attached to the 
bug 687654. It happens because trhe hinter determines the outer stem boundary 
by the curvity sign.
Comment 1 leonardo 2006-02-10 11:13:45 UTC
Created attachment 2027 [details]
d.bmp.zip

A visual trace diagram that illustrates the problem. See the ununiform stem
width near the glyph top (blue line is the source glyph, the green line is the
grid-fitted glyph).
Comment 2 leonardo 2006-02-10 11:16:36 UTC
Created attachment 2028 [details]
86554321-.pdf

A simplified test case. We re-distilled 86554321.pdf with Ghostscript to drop
the password protection, then removed unrelated objects with Acrobat 5.
Comment 3 leonardo 2006-02-10 11:23:17 UTC
In the test case the problem happens due to a poor hinting of the font Palatino-
Roman, which is substituted with URWPalladioL-Roma, which is distributed with 
Ghostscript in p052003l.pfb . In the attached test case it is an embedded 
subset, but while a regular rendering of 86554321.pdf it's a resident font.
Comment 4 leonardo 2006-02-10 11:29:23 UTC
Rather it would be useful to fix the URW font, we believe that we should 
improve the Type 1 hinter against such effects, because the problem may happen 
with a TrueType font, because our topological grid fitting doesn't recognize 
flex. Need to decide wheather the flex recognition to be a part of Type 1 
hinter against poor fonts, or it must be a part of the topological grid fitting 
(in this case we won't waste processor time for verifying good Type 1,2 
glyphs). For now we prefer the forst for better rendering quality in general.
Comment 5 leonardo 2006-02-10 11:31:08 UTC
I meant "we prefer the first".
Comment 6 leonardo 2006-02-16 12:00:42 UTC
Created attachment 2046 [details]
patch.txt

Saving a copy of a patch I'm working on. It's not ready yet.
Comment 7 leonardo 2006-02-21 04:53:26 UTC
Patch to HEAD :
http://ghostscript.com/pipermail/gs-cvs/2006-February/006358.html
It fixes this bug and several other problems in the hinter.
Comment 8 leonardo 2006-02-24 08:19:02 UTC
One more patch :
http://ghostscript.com/pipermail/gs-cvs/2006-February/006378.html