Bug 687654

Summary: t1_hinter__find_best_standard_width() always returns 0
Product: Ghostscript Reporter: Alex Cherepanov <alex>
Component: GeneralAssignee: leonardo <leonardo>
Status: NOTIFIED FIXED    
Severity: minor    
Priority: P4    
Version: master   
Hardware: All   
OS: All   
Customer: Word Size: ---
Attachments: patch1.txt
patch1.txt
patch2.txt
patch3.txt
patch4.txt
patch5.txt
patch6.txt
patch7.txt

Description Alex Cherepanov 2004-09-03 05:18:47 UTC
t1_hinter__find_best_standard_width() 
does some calculations but always returns 0.
Comment 1 Igor Melichev 2004-09-06 06:38:15 UTC
Created attachment 880 [details]
patch1.txt

I just tried the obvious fix for that code, and got results, which cannot be
qualified as a progression at 300dpi (i.e. not closer to Acrobat Reader 5). At
72dpi the difference is small, but doesn't look as a progression also. Likely
at small resolution it should return always 0 to force the standard stem width
(the Type 1 spec says so), but at bigger resolutions it may return other
values. Maybe 300dpi isn't a big resolution. So likely ignoring StemSnapH,
StemSnapV isn't a bad siolution, but the code to be simplified and commented.

Unfortunately I can't recall why it was coded so. Maybe at first time it was
coded with "return m", then changed for an experimenting, and then left so. In
any case, the Type 1 spec isn't so clear, so maybe "return 0" is the right
solution.
Comment 2 Igor Melichev 2004-09-06 06:40:23 UTC
BTW, Maybe StemSnapH, StemSnapV are for font substitution purpose only ?
Comment 3 Igor Melichev 2004-09-06 06:46:02 UTC
Likely FreeType 2 doesn't use StemSnapH, StemSnapV. I found a code that reads 
and copies them, but nothing more.
Comment 4 Igor Melichev 2004-09-09 05:28:23 UTC
There is some processing in UFST.
Comment 5 Igor Melichev 2004-09-09 06:41:21 UTC
I tried to return 'm' with the recent patch, but results are still not good.

I guess that StemSnap* to be adjusted to the pixel grid, and then decide 
whether to apply it. If deltas are pretty small, then adjust all to Std*W. With 
bigger deltas adjust to StemSnap*. With very big deltas don't adjust. Also need 
to verify our algorithm. Delaying this for better times.
Comment 6 leonardo 2006-01-18 23:26:19 UTC
Adobe Technical Note #5049 defines the logic.
Comment 7 leonardo 2006-01-20 06:46:17 UTC
Created attachment 1937 [details]
patch1.txt

An experimental patch according to Adobe Technical Note #5049.
Need to decide whether it is applicable at small resolutions.
Comment 8 leonardo 2006-01-21 02:47:55 UTC
Created attachment 1939 [details]
patch2.txt

A better experimental patch.
Comment 9 leonardo 2006-01-23 02:36:31 UTC
Created attachment 1943 [details]
patch3.txt

An improved patch - needs a visual testing with humans.
Comment 10 leonardo 2006-01-23 04:37:22 UTC
Created attachment 1945 [details]
patch4.txt

A better patch (Cygwin/gcc warning cleaned).
Comment 11 leonardo 2006-02-06 11:58:10 UTC
Created attachment 2000 [details]
patch5.txt

A more improved patch : debugged a mixing of pixel_gh, pixel_gw.
Comment 12 leonardo 2006-02-10 11:00:31 UTC
Created attachment 2026 [details]
patch6.txt

A better patch, includes a fix for t1_hinter__align_stem_commands start with an
off-curve pole.
Comment 13 leonardo 2006-02-10 12:48:04 UTC
Created attachment 2029 [details]
patch7.txt

The last patch skips too many poles, causing a regression with
S2_Digitalproof-Forum_x3k.pdf. Attaching a better one.
Comment 14 leonardo 2006-02-12 16:19:23 UTC
Patch to HEAD :
http://ghostscript.com/pipermail/gs-cvs/2006-February/006347.html

This patch also fixes the bug 688553.