Bug 691574 - vert punctuation is rotated when convert ps to 1.3 pdf
Summary: vert punctuation is rotated when convert ps to 1.3 pdf
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Font API (show other bugs)
Version: 8.71
Hardware: PC Windows Vista
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-24 10:37 UTC by simengman
Modified: 2018-01-23 08:48 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
test ps file (3.53 KB, application/postscript)
2010-08-24 10:37 UTC, simengman
Details
1.2 pdf (30.95 KB, application/pdf)
2010-08-24 10:38 UTC, simengman
Details
1.3 pdf (14.59 KB, application/pdf)
2010-08-24 10:40 UTC, simengman
Details
font for STHeiti (4.53 MB, application/octet-stream)
2010-08-27 09:15 UTC, simengman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description simengman 2010-08-24 10:37:26 UTC
Created attachment 6672 [details]
test ps file

when convert ps to pdf,if to 1.3 pdf,chinese vert punctuation is rotated ,but if to 1.2 pdf, it's not.
Comment 1 simengman 2010-08-24 10:38:17 UTC
Created attachment 6673 [details]
1.2 pdf
Comment 2 simengman 2010-08-24 10:40:10 UTC
Created attachment 6674 [details]
1.3 pdf
Comment 3 Ken Sharp 2010-08-24 14:28:07 UTC
The PostScript file does not contain any fonts at all. It does request a number of different fonts; STSong-Light, STFangsong-Light, STHeiti-Regular, STKaiti-Regular and Times-Roman.

With the exception of Times-Roman these are not part of the standard base fonts, nor are they part of the font set shipped with Ghostscript. Therefore you must have added these yourself (otherwise Ghosrtscript complains that it can't find the fonts, as mine does). 

Since the 1.3 PDF file contains CIDFonts with TrueType outlines, I assume that you have used TrueType fonts as replacements for CIDFonts. While this does work, it is not really 100% foolproof. What you are doing here is attempting to use the *same* font for both horizontal and vertical writing, I'm not surprised to find that it is not 100% reliable.

It is curious that only the punctuation is rotated but I am unable to investigate this without being able to reproduce the problem. I can't do that unless I know which fonts you used to replace the missing ones, so I need a copy of your cidfmap, and probably access to the fonts you used as replacements as well.

it would also help to have a simpler file, though I can of course reduce the PostScript file.
Comment 4 Hin-Tak Leung 2010-08-24 21:45:07 UTC
(In reply to comment #3)
> The PostScript file does not contain any fonts at all....

> With the exception of Times-Roman these are not part of the standard base
> fonts, nor are they part of the font set shipped with Ghostscript. Therefore
> you must have added these yourself...

The test file seems to be one of (may be derivative of) ghostscript's own examples/cjk/gscjk_*.ps - and the cid font mapping seems to be what  lib/mkcidfm.ps generates - the windows ghostscript installer runs it as an option for "Use Windows Truetype fonts for Chinese, Japanese and Korean"

You probably should use the 8.71 version of lib/mkcidfm.ps , as it has be enhanced quite a bit during after 8.71.
Comment 5 simengman 2010-08-27 09:15:21 UTC
Created attachment 6678 [details]
font for STHeiti

copy simhei.ttf to C:\windows\fonts

in cidfmap, add two lines:

/SimHei << /FileType /TrueType /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/fonts/simhei.ttf) >> ;

/STHeiti-Regular /SimHei ;
Comment 6 simengman 2010-09-07 10:20:22 UTC
some informations:
1. gsview4.9 can display correctly the vert punctuations by gs8.71, but can't by 8.61.
2. another punctuation(code is 0xa1a4) of simhei.ttf, can't be displayed in gsview and pdf. if modify cmap-file "GBK-EUC-H", let a1a4 map 10036, then this char can be displayed, but it's not correct, it is moved to left and down.(it should be in the center of char position).
3、vert punctuations and char 0xa1a4 can be displayed correctly in notepad, word, etc, if you set the font to simhei.
Comment 7 Ken Sharp 2016-05-26 08:26:30 UTC
OK I still believe that, at heart, this is not really a bug. Using a TrueType font as a substitute for a CIDFont is fraught at best. While it may allow a file to be readable it is in no sense correct.

The current output from pdfwrite matches the rendered Ghostscript output, and the output from pdfwrite is visually the same whether the output is to PDF 1.2 or PDF 1.3. So this means that we are finding/rendering the same glyphs. Therefore any problem must now be in the font machinery I believe.

Assigning this one to Chris to look at, one day, when time permits.
Comment 8 Chris Liddell (chrisl) 2018-01-18 02:00:10 UTC
FWIW, to actually reproduce the problem, cidfmap also needs the following mappings:


/STHeiti-Regular /SimHei ;
/STHeiti-Light /SimHei ;
/STSong-Light /SimHei ;
/STFangsong-Light /SimHei ;
/STKaiti-Regular /SimHei ;
Comment 9 Ken Sharp 2018-01-23 08:48:31 UTC
Commit 2ce962cfc20267b3e678d8d1357dfc2643b7a477 takes advantage (for pdfwrite) of the GSUB lookup done for rendering in commit 7dd033589ce40649ab602fba4c0473aa40c48439 (Bug #698471)

I believe this resolves this problem. Note that in the absence of a GSUB table, or a substitute vertical glyph not being available in the GSUB table of the font, the punctuation will still be incorrect. That's what happens when you use substitute fonts.

However, for this file and substitution table, and the file and substitution in bug #698471, the punctuation is now oriented correctly in the PDF file.