Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RT 122393] CJK font problem #72

Closed
PhilterPaper opened this issue Jul 11, 2017 · 8 comments
Closed

[RT 122393] CJK font problem #72

PhilterPaper opened this issue Jul 11, 2017 · 8 comments

Comments

@PhilterPaper
Copy link
Owner

Sat Jul 08 09:43:57 2017 ohtani [...] cat.hokudai.ac.jp - Ticket created
Subject: cjk font problem
Date: Sat, 8 Jul 2017 22:43:23 +0900
To: bug-PDF-API2 [...] rt.cpan.org
From: Bunsho Ohtani <bunshoohtani [...] gmail.com>

Dear Sirs:

When Japanese message is placed in a PDF file, strange phenomena happen.

$font = $pdf -> cjkfont( 'KozGo' );
actual displayed font: KozMin

$font = $pdf -> cjkfont( 'KozGo-Bold' );
actual displayed font: KozGo-Bold

$font = $pdf -> cjkfont( 'KozGo-Italic' );
actual displayed font: KozMin-Italic

$font = $pdf -> cjkfont( 'KozGo-Medium' );
<ERROR: font is not installed>

Then, for gothic fonts, only KozGo-Bold can be used, but I would like to
display with KozGo.

Best regards,

Bunsho OHTANI

@PhilterPaper PhilterPaper changed the title [RT 122293] CJK font problem [RT 122393] CJK font problem Jul 20, 2017
@PhilterPaper
Copy link
Owner Author

I'm not familiar with CJK fonts, but I checked a few characters in the PDFs from examples/023_cjkfonts, and KozGo seems to be a different font than KozMin. "Go" seems to be like a sans-serif font with constant width strokes, while "Min" seems more like a serif font with variable width strokes.

Please run examples/023_cjkfonts, and report back here whether you've found the wrong font being used. It will list every character in the font, and produce over 100 pages, so a quick spot check ought to do it. Separate files are produced for (Regular), -Bold, -Italic, and -BoldItalic variants. There is no KozGo-Medium produced by this example. Did you or someone else modify or alter any of the CJK files, and might have corrupted some of the cmap or data files? Are you sure that your PDF reader font files are good, and produce correct results when displaying pages?

@PhilterPaper
Copy link
Owner Author

Some further investigation shows that there are a limited number of names available. These will be described under Builder.pm's cjkfont() method POD. For the KozGo (Gothic) fonts of interest to you, KozGo should map to kozgopromediumacro, with variants (bold, italic, or bold-italic) available. The PDF::Builder::Resource::CIDFont::CJKFont file $alias and $subs tables define KozGo-Bold, KozGo-Italic, and KozGo-Bold-Italic as available variants to kozgopromediumacro. There is no "medium" available, but you could probably add it as an alias. As for the others, the code looks good and a quick compare between the 023_cjkfonts listing for KozGo and KozMin (regular and italic) shows distinctly different glyphs. At least in this case, it does not appear to be displaying KozMin instead of KozGo. Can you provide a small sample PDF-creation program that demonstrates such an error?

@PhilterPaper
Copy link
Owner Author

I wrote a quick little test program (attached), and it seems to work OK. It displays regular, bold, and italic text for KozGo and KozMin; and appears to show the correct font. So, unless someone can show an example of it not working, I will have to close this issue as "not reproducible".

122393.pl.txt
cjk.pdf

@PhilterPaper
Copy link
Owner Author

I have not been able to reproduce the reported problem, and the original reporter has not replied to email requests, so I will close this issue. If someone can show a test case, I'll reopen it.

@PhilterPaper
Copy link
Owner Author

Mon Mar 04 13:48:23 2019 PMPERRY@cpan.org - Correspondence added

FYI, this is rejected in PDF::Builder -- the example given appears to work fine, and the OP has not added any further information

Tue Mar 05 03:19:15 2019 ohtani@cat.hokudai.ac.jp - Correspondence added

Thank you for your help. I will try it.

Best regards,

Bunsho

Tue Mar 05 09:33:42 2019 ohtani@cat.hokudai.ac.jp - Correspondence added

I have tried using PDF::Builder, but the phenomena that command '$pdf -> cjkfont( "KozGo" )' results in the same as '$pdf -> cjkfont( "KozMin'")' as is when PDF::API" is used.

Best regards,

Bunsho

Tue Mar 05 10:55:08 2019 PMPERRY@cpan.org - Correspondence added

Please read #72 and try it out. In that ticket, I explain what I looked at and why I did not find any problem (could not reproduce your reported problem). As I am not a user of CJK alphabets or fonts, it is possible that I missed something in my analysis. If I did, and you still feel that there is a problem, please explain in detail either here or on GitHub (if you have an account there). As I am not a user of such fonts, I'm afraid that you will need to explain it as you would to a child! :)

You might also want to start with fresh copies of the font files on your system, as perhaps one got copied over another at some point. At least, confirm that the files are different!

@BunshoOhtani
Copy link

I understand almost all for this problem. When I open the file cjk.pdf on Chrome, KozGo and KozGo Italic fonts are shown as KozMin and KozMin Italic, respectively, while correctly shown on Acrobat. Therefore this is just a problem of Chrome. Thank you for your kindness and effort for solving this and apologize for making you to consume time.

@PhilterPaper
Copy link
Owner Author

So it comes down to the PDF reader being used substituting fonts for its own reasons? Well, at least the mystery is solved, and there's nothing that needs to be done to PDF::Builder. If this is also applicable to PDF::API2 (as it probably is), you'll probably want to update (and close) that RT item.

@BunshoOhtani
Copy link

I agree with you. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants