Defect #13781

CJK(Chinese/Japanese/Korean) characters are not shown in PDF on non CJK locales

Added by Toru Haraguchi over 5 years ago. Updated almost 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:PDF export
Target version:2.6.0
Resolution:Fixed Affected version:2.2.2

Description

When exporting tickets list view to PDF in English personal preference, most of Japanese characters are not shown.
Attached is an example.

Because when in Japanese personal preference those letters are shown, so far no preblem. But this might be annoying for bilingual (or multilingual) people who prefer English controls of Redmine, but need reading his/her responsible issues written in Japanese.

error_example2.pdf (278 KB) Toru Haraguchi, 2013-04-16 12:34

general_pdf_fontname_r13446.patch Magnifier (22 KB) Jun NAITOH, 2014-10-15 16:39

pdf_font_name_r13446.patch Magnifier (1.51 KB) Jun NAITOH, 2014-10-15 16:54


Related issues

Related to Redmine - Defect #10681: Export to Persian PDF problem Closed
Related to Redmine - Defect #13575: Graphic characters not exported Closed
Related to Redmine - Feature #17570: use rbpdf gem instead of bundled rfpdf Closed
Related to Redmine - Defect #4787: Gannt to PNG - CJK (Chinese, Japanese and Korean) charac... Closed 2010-02-10
Duplicated by Redmine - Defect #14701: PDF Export Encoding Closed
Duplicated by Redmine - Defect #1249: 在生成PDF文件时,中文出现乱码 Closed 2008-05-17
Duplicated by Redmine - Feature #19282: Export unicode error. Closed

Associated revisions

Revision 13458
Added by Toshi MARUYAMA almost 4 years ago

pdf: define "general_pdf_fontname" at i18n yaml for multilingual environment (#13781)

Contributed by Jun NAITOH.

Revision 13460
Added by Toshi MARUYAMA almost 4 years ago

Merged r13458 from trunk to 2.6-stable (#13781)

pdf: define "general_pdf_fontname" at i18n yaml for multilingual environment.

Contributed by Jun NAITOH.

History

#1 Updated by Toshi MARUYAMA over 5 years ago

  • Priority changed from Normal to Low

#2 Updated by Toshi MARUYAMA over 5 years ago

Because embedded FreeSans font does not have glyph.
See #61#note-92.

#3 Updated by Toshi MARUYAMA over 5 years ago

  • Subject changed from Japanese characters are not shown in PDF exported ticket list when in English preference to CJK(Chinese/Japanese/Korean) characters are not shown in PDF exported ticket list when in English preference

#4 Updated by Toshi MARUYAMA over 5 years ago

  • Subject changed from CJK(Chinese/Japanese/Korean) characters are not shown in PDF exported ticket list when in English preference to CJK(Chinese/Japanese/Korean) characters are not shown in PDF on non CJK locales

#5 Updated by Filou Centrinov over 5 years ago

Related with #10681, #13575

In this and in the related issues the problem is that the included font file does not contain the appropriate glyph.
http://sourceforge.net/projects/tcpdf/files/ provides newer fonts files. The problem is the pdf size increases enormously (#13575).

#6 Updated by Toshi MARUYAMA about 5 years ago

#7 Updated by Toshi MARUYAMA almost 5 years ago

  • Duplicated by Defect #1249: 在生成PDF文件时,中文出现乱码 added

#8 Updated by Maxime Vez about 4 years ago

+1 same annoying problem here.

Recently Adobe and Google released an open-source CJK font : http://blog.typekit.com/2014/07/15/introducing-source-han-sans/

Maybe it can help in solving this issue.

#9 Updated by Toshi MARUYAMA about 4 years ago

  • Related to Feature #17570: use rbpdf gem instead of bundled rfpdf added

#10 Updated by Jun NAITOH about 4 years ago

I think that this problem is unsolvable even if it uses a Han Sans font.

It is because the language of a Chinese character is indistinguishable because of Han unification.

I think that fix of this problem requires a PDF font setting function.

Font Setting Plan (Example)

  1. Add PDF export options dialog. (like issues CSV export options dialog.)
  2. Add PDF font panel for personal account setting.
  3. Add PDF font panel for Administration settings.
  4. Add default PDF font setting in configuration.yml.

#11 Updated by Toshi MARUYAMA about 4 years ago

  • Priority changed from Low to Normal
  • Target version set to 2.6.0

I think it is better in configuration.yml because of #4787 consistency.

#12 Updated by Daniel Felix about 4 years ago

Well a user defined setting would be better, or?

A default in the configuration won't help on a multilingual environment. Like people have issues in korean and issues posted in german for example. I think this would collide and force the german output to break.

#13 Updated by Jun NAITOH about 4 years ago

Daniel Felix wrote:

A default in the configuration won't help on a multilingual environment.
Like people have issues in korean and issues posted in german for example.
I think this would collide and force the german output to break.

Oh... It is important indication.

I consider whether there is any better solution...

#14 Updated by Toshi MARUYAMA about 4 years ago

  • Related to Defect #4787: Gannt to PNG - CJK (Chinese, Japanese and Korean) characters appear as ? added

#15 Updated by Jun NAITOH almost 4 years ago

Maxime Vez wrote:

Recently Adobe and Google released an open-source CJK font : http://blog.typekit.com/2014/07/15/introducing-source-han-sans/

Maybe it can help in solving this issue.

I tried to use Adobe and Google CJK Font(han-sans), but I couldn't convert from OTF font to TTF font.
rbpdf library can use only a TTF font.

Daniel Felix wrote:

A default in the configuration won't help on a multilingual environment.
Like people have issues in korean and issues posted in german for example.
I think this would collide and force the german output to break.

I wrote patch.

Plan A. (use config/locales/*.yml) : I recommend.

  • general_pdf_fontname_r13446.patch
    locale general_pdf_fontname: Language
    ja.yml kozminproregular Japanese
    ko.yml hysmyeongjostdmedium Korean (UHC)
    th.yml freeserif Thai
    vi.yml DejaVuSans Vietnamese
    zh-TW.yml msungstdlight Traditional Chinese (BIG5)
    zh.yml stsongstdlight Simplified Chinese (GB18030)
    other yml freesans
    etc.. Helvetica

This plan was considered in order to support multilingual environment.

If you use English locale (en.yml) and you want to Japanese characters, so please set to "general_pdf_fontname: kozminproregular" on en.yml.

Plan B. (use configuration.yml) : I don't recommend.

  • pdf_font_name_r13446.patch

Configuration of PDF font for non CJKV (and Thai) locale.

I think that this plan has the big influence in multilingual environment.

#16 Updated by Toshi MARUYAMA almost 4 years ago

I think Plan A. is better because #8312 supported to switch using font by changing "general_pdf_encoding" at locale yml.

#17 Updated by Jun NAITOH almost 4 years ago

Toshi MARUYAMA wrote:

I think Plan A. is better because #8312 supported to switch using font by changing "general_pdf_encoding" at locale yml.

me, too. :)

Plan A : fontname table updated. (add Font type)

locale general_pdf_fontname: (Font type) Language
ja.yml kozminproregular (Non embedded Font (CID Font)) Japanese
ko.yml hysmyeongjostdmedium (Non embedded Font (CID Font)) Korean (UHC)
th.yml freeserif (embedded Font) Thai
vi.yml DejaVuSans (embedded Font) Vietnamese
zh-TW.yml msungstdlight (Non embedded Font (CID Font)) Traditional Chinese (BIG5)
zh.yml stsongstdlight (Non embedded Font (CID Font)) Simplified Chinese (GB18030)
other yml freesans (embedded Font)
etc.. courier, helvetica, times, symbol, zapfdingbats (Non embedded Font(Core Font))

#18 Updated by Toshi MARUYAMA almost 4 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

general_pdf_fontname_r13446.patch is committed in trunk r13458 and 2.6-stable r13460, thanks.

#19 Updated by gank gu almost 4 years ago

Jun NAITOH wrote:

Maxime Vez wrote:

Recently Adobe and Google released an open-source CJK font : http://blog.typekit.com/2014/07/15/introducing-source-han-sans/

Maybe it can help in solving this issue.

I tried to use Adobe and Google CJK Font(han-sans), but I couldn't convert from OTF font to TTF font.
rbpdf library can use only a TTF font.

Daniel Felix wrote:

A default in the configuration won't help on a multilingual environment.
Like people have issues in korean and issues posted in german for example.
I think this would collide and force the german output to break.

I wrote patch.

Plan A. (use config/locales/*.yml) : I recommend.

  • general_pdf_fontname_r13446.patch
    locale general_pdf_fontname: Language
    ja.yml kozminproregular Japanese
    ko.yml hysmyeongjostdmedium Korean (UHC)
    th.yml freeserif Thai
    vi.yml DejaVuSans Vietnamese
    zh-TW.yml msungstdlight Traditional Chinese (BIG5)
    zh.yml stsongstdlight Simplified Chinese (GB18030)
    other yml freesans
    etc.. Helvetica

This plan was considered in order to support multilingual environment.

If you use English locale (en.yml) and you want to Japanese characters, so please set to "general_pdf_fontname: kozminproregular" on en.yml.

Plan B. (use configuration.yml) : I don't recommend.

  • pdf_font_name_r13446.patch

Configuration of PDF font for non CJKV (and Thai) locale.

I think that this plan has the big influence in multilingual environment.

If I'm using english and I want both Traditional Chinese (BIG5) and Simplified Chinese (GB18030), what can I do ? can I specify two font name in "general_pdf_fontname" ?

#20 Updated by Toshi MARUYAMA almost 4 years ago

gank gu wrote:

If I'm using english and I want both Traditional Chinese (BIG5) and Simplified Chinese (GB18030), what can I do ? can I specify two font name in "general_pdf_fontname" ?

You cannot because of Han unification .

#21 Updated by Toshi MARUYAMA over 3 years ago

#22 Updated by Toshi MARUYAMA about 3 years ago

#23 Updated by Toshi MARUYAMA about 3 years ago

Also available in: Atom PDF