Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering.

RT 122393 - CJK font problem

  • 1 Replies
  • 806 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 387
    • View Profile
RT 122393 - CJK font problem
« July 08, 2017, 12:17:45 PM »
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

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 387
    • View Profile
Re: RT 122393 - CJK font problem
« Reply #1: December 25, 2017, 07:25:20 PM »
 PhilterPaper commented on Jul 23

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 commented on Oct 11

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 commented on Oct 12

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".

 PhilterPaper commented on Nov 12

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.