Bug 690281 - Font cache affects rendering
Summary: Font cache affects rendering
Status: RESOLVED LATER
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Text (show other bugs)
Version: master
Hardware: Macintosh MacOS X
: P4 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-10 09:36 UTC by Marcos H. Woehrmann
Modified: 2011-05-11 23:05 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
test.ps (90 bytes, application/postscript)
2009-02-10 09:36 UTC, Marcos H. Woehrmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2009-02-10 09:36:13 UTC
There is a difference in character rendering with the font cache enable and disabled:

  bin/gs -sDEVICE=ppmraw -o '|md5sum' -r300 ./test.ps
  bin/gs -sDEVICE=ppmraw -o '|md5sum' -r300-dNOCACHE  ./test.ps

This is with gshead (r9466).
Comment 1 Marcos H. Woehrmann 2009-02-10 09:36:30 UTC
Created attachment 4783 [details]
test.ps
Comment 2 Ralph Giles 2009-02-10 10:09:06 UTC
Interesting. I can reproduce (actually, I used a similar file with Times-Roman
instead of Helvetica) on my MacBook Pro (x86_32, 1 GB ram, MacOS 10.4.11) but
not on my desktop (x86_64, 3.2 GB ram, Ubuntu Linux 8.04.2).
Comment 3 Marcos H. Woehrmann 2009-02-10 10:33:21 UTC
For me it fails on my MacBook Pro and my Ubuntu 7.10 x86_64 box  (btw, has this become the de-facto 
standard Artifex developer configuration?  a MacBook Pro and an x86_64 desktop machine running 
Ubuntu?).
Comment 4 Henry Stiles 2009-02-10 10:41:28 UTC
-ZP shows the outlines are rendered in different coordinate systems, so I don't
know this is worth messing with.
Comment 5 Ralph Giles 2009-02-10 11:28:40 UTC
Marcos: somewhat common, at least. But I hope my next macbook is also x86_64. :)
Comment 6 Marcos H. Woehrmann 2009-02-10 17:29:57 UTC
A related issue:

Bug 690232 was resolved by making the font cache deterministic, but this shouldn't have affected the 
output.  A glyph that was removed because the cache was full should just have been re-rendered with 
the same bitmap, having a minor effect on performance but not the output bitmap.

This difference can be demonstrated with gshead (r9466 or later) and 13-03_mhw.PS (attached) with 
the following command line:

  bin/gs -r600 -sDEVICE=tiff24nc -o test.tif ./13-03_mhw.PS

Changing the initial pdir->hash value in gsfont.c from 42 to 19 will result in bitmap differences on 
pages 2, 3, and 4.  Note that not all values results in a bitmap change; only about 20% of the possible 
values of pdir->hash do (for example, 95, 44, 18, 96, 70, 31, 90, and 55 all produce bitmaps identical 
to 42).
Comment 7 Marcos H. Woehrmann 2009-02-10 17:32:34 UTC
Created attachment 4787 [details]
13-03_mhw.PS
Comment 8 Marcos H. Woehrmann 2009-02-11 15:06:30 UTC
Further data:

if you change -r300 in the command line in comment #0 to -r400 or -r100 there is no difference with 
and without -dNOCACHE
Comment 9 Ray Johnston 2009-02-12 09:57:11 UTC
Close based on comment #6.
Comment 10 Henry Stiles 2009-02-12 11:22:46 UTC
reopening for further study.
Comment 11 Henry Stiles 2009-10-23 08:19:32 UTC
see 690841 for possible solution.
Comment 12 Ken Sharp 2009-10-24 02:47:10 UTC
I did check this with the odd clipping behaviour in gxchar.c, which only affects
type 3 fonts. 13-03_mhw.ps does trigger this check (test.ps doesn't, its a type
1 font).

However, I don't see any evidence of the glyphs being improperly clipped by
this. All the differences I see are similar instances to the 'problem' in
test.ps, it appears that we are rendering curves slightly differently in the
cached and uncached cases.

The differences are small, I think its likely that this is just due to the way
that the cached bitmap interacts with the device grid, as opposed to the way a
curve drawn at the device resolution does, given the exact placement of the
curve. Marcos' comment #6 leads me even more to believe this is the case.

This isn't a reason not to remove the clipping in set_cache_device(), but its
not a reason to remove it either. Closing this one again.
Comment 13 Henry Stiles 2009-10-24 09:28:37 UTC
You'd think I'd know better by now not to guess...

We do want it open until we have detailed analysis of the rendering differences.
 I'll put it back on my list now I'm more curious.