Bug 692365 - Text advance goes in the wrong direction with a CIDFont
Summary: Text advance goes in the wrong direction with a CIDFont
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Text (show other bugs)
Version: master
Hardware: PC Windows Vista
: P1 normal
Assignee: Ken Sharp
URL:
Keywords:
: 692576 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-21 09:14 UTC by Ken Sharp
Modified: 2012-07-18 22:58 UTC (History)
3 users (show)

See Also:
Customer: 32
Word Size: ---


Attachments
PS file still exhibiting problem. (2.01 MB, application/postscript)
2012-06-12 20:41 UTC, Henry Stiles
Details
Cut down example (782.42 KB, application/postscript)
2012-06-13 06:45 UTC, Chris Liddell (chrisl)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Sharp 2011-07-21 09:14:32 UTC
Created attachment 7694 [details]
file exhibiting problem

The attached file renders the text correctly, but some of it is mispositioned, apparently because the text advance moves the current point in the wrong direction (vertically instead of horizontally).

This appears to be related to the CMap and its use of WMode 1, for some reason other interpreters seem to be ignoring this.
Comment 2 Ken Sharp 2011-07-21 09:16:21 UTC
P1 for customer bug. NB this was originally reported against pdfwrite, though the problem appears on rendering as well. Please check against pdfwrite when fixed.
Comment 3 Chris Liddell (chrisl) 2011-09-05 09:31:37 UTC
We erroneously fabricated vertical metrics for a CIDFontType 2 font.

Fixed in:

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=2fab16
Comment 4 Chris Liddell (chrisl) 2011-10-10 12:26:51 UTC
*** Bug 692576 has been marked as a duplicate of this bug. ***
Comment 5 Henry Stiles 2012-06-12 20:41:43 UTC
Created attachment 8683 [details]
PS file still exhibiting problem.

This bug was marked as fixed but the customer reports it is still broken and provided a Postscript file which is indeed wrong.  The original attachment to the bug is a PDF file.  Not sure what happened here so I'm just reopening for investigation.
Comment 6 Chris Liddell (chrisl) 2012-06-12 22:00:51 UTC
Rendering was fixed with the above patch, but it seems that pdfwrite still has an issue.

Sorry Ken......
Comment 7 Chris Liddell (chrisl) 2012-06-13 06:45:59 UTC
Created attachment 8684 [details]
Cut down example

Test cut down to one word.
Comment 8 Chris Liddell (chrisl) 2012-06-13 07:40:29 UTC
Taking this back, as I have an idea of how to resolve it.
Comment 9 Chris Liddell (chrisl) 2012-06-13 11:29:36 UTC
pdfwrite case fixed in this commit:

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=fae7be45

Sorry for the confusion on this one......
Comment 10 Chris Liddell (chrisl) 2012-06-15 10:33:29 UTC
Some further analysis:

For each glyph, we have to both consult the font WMode *and* check for vertical metrics in the font dictionary - iff both WMode is "1" *and* vertical metrics are available should we treat the glyph as writing vertically, otherwise, treat it as a horizontal writing glyph.

I *think* the problem we have is that, in pdfwrite's scan_cmap_text(), we don't check for vertical metrics as we process each glyph, so we're going solely on WMode.

We can use "subfont->procs.glyph_info()" to check for vertical metrics, set a transient WMode value based on that, which can solve the problem with this file, but causes a few regressions in our test suite. I'm guessing that pdfwrite is using the font WMode elsewhere in the glyph processing, but I'm already way beyond my knowledge of pdfwrite......
Comment 11 Ken Sharp 2012-06-27 08:39:50 UTC
Commit 2ff29d1f499451c63ddb8b3cc152cb2eda4b5e33 I believe properly resolves htis issue with pdfwrite.

I have checked the result visually against the Acrobat result, and I do so some differences in the way the 'fake bold' is handled. This is done (badly) by drawing the text three times in slightly different positions. It appears that Acrobat has a heuristic for detecting this and turning it into a stroke+fill text rendering mode instead.

Because of rounding errors we appear to have text which is slightly bolder than the Acrobat output, but it is not mis-positioned.