Project

General

Profile

Actions

Defect #4787

closed

Gannt to PNG - CJK (Chinese, Japanese and Korean) characters appear as ?

Added by Jeffrey Jones almost 15 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Toshi MARUYAMA
Category:
Gantt
Target version:
Start date:
2010-02-10
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

When exporting a gantt chart to png format all Japanese (hiragana,katakana and kanji) characters are replaced with ? characters.

This is using RMagick 2.12.2 and the libmagick9-dev provided with Ubuntu 9.10.

Being able to export to PNG would relieve some of the problems we are facing with the inability to export to PDF (As discussed in issue #61 )

(Also would it be useful to add an "Exporters" category? I am not sure what to file this under)


Files

gantt_korean.png (23.3 KB) gantt_korean.png Gannt Korean export broken. Namho Kim, 2012-01-25 05:59
png_rmagick_font_r8745.patch (2.01 KB) png_rmagick_font_r8745.patch Jun NAITOH, 2012-02-01 16:30
rmagick_font.png (23.8 KB) rmagick_font.png Jun NAITOH, 2012-02-01 16:30
user-pref.png (33.9 KB) user-pref.png Toshi MARUYAMA, 2012-02-02 03:17
user-pref-r8745.patch (3.03 KB) user-pref-r8745.patch Toshi MARUYAMA, 2012-02-02 03:17
redmine-gantt_kr.png (50.1 KB) redmine-gantt_kr.png Namho Kim, 2012-02-09 04:00
png_rmagick_font_path_r8987.patch (1.07 KB) png_rmagick_font_path_r8987.patch Jun NAITOH, 2012-02-25 04:32
png_rmagick_font_path_r10851.patch (1.3 KB) png_rmagick_font_path_r10851.patch Toshi MARUYAMA, 2012-11-19 13:36

Related issues

Related to Redmine - Defect #6505: PDF export broken with Japanese (Gannt and Issue Tracking)Closed2010-09-27

Actions
Related to Redmine - Defect #61: Broken character encoding in pdf exportClosedToshi MARUYAMA

Actions
Related to Redmine - Patch #3231: patch for broken character problem on png-exported gantt on 0.8 branchClosed2009-04-23

Actions
Related to Redmine - Feature #69: Textilized description in PDFClosedToshi MARUYAMA

Actions
Related to Redmine - Feature #5638: Use Bundler (Gemfile) for gem managementClosedJean-Philippe Lang2010-06-02

Actions
Related to Redmine - Defect #13781: CJK(Chinese/Japanese/Korean) characters are not shown in PDF on non CJK localesClosed

Actions
Has duplicate Redmine - Defect #6506: Gantt chart export to PDF/PNG works incorrectly in zh-tw localeClosed2010-09-27

Actions
Actions #1

Updated by Jeffrey Jones almost 15 years ago

  • % Done changed from 0 to 10

Looks like this is a font issue.

I edited /lib/redmine/helpers/gantt.rb and hacked in the following

gc = Magick::Draw.new
gc.font = "/usr/share/fonts/truetype/msttcorefonts/gothic.ttf" # New Line - Explicitly declare font
# Subjects

This is an ugly hard-coded hack that points to a font that I know for sure is UTF-8 Japanese character compatible and it works.

So the question now is how to make this something that can be merged into redmine itself and works on all platforms.

Maybe we could make an administration option that allows us to select the fonts we desire for our exports? (When using PDF/PNG?)

Actions #2

Updated by Ki Won Kim almost 15 years ago

Symptoms are the same, and I was modified gantt.rb by your hacked code.
thanks a lot.

Jeffrey Jones wrote:

When exporting a gantt chart to png format all Japanese (hiragana,katakana and kanji) characters are replaced with ? characters.

This is using RMagick 2.12.2 and the libmagick9-dev provided with Ubuntu 9.10.

Being able to export to PNG would relieve some of the problems we are facing with the inability to export to PDF (As discussed in issue #61 )

(Also would it be useful to add an "Exporters" category? I am not sure what to file this under)

Actions #3

Updated by Mischa The Evil about 14 years ago

  • Category set to Gantt
Actions #4

Updated by Toshi MARUYAMA over 13 years ago

  • Subject changed from Gannt to PNG - Japanese characters appear as ? to Gannt to PNG - CJK (Chinese, Japanese and Korean) characters appear as ?
Actions #5

Updated by Namho Kim almost 13 years ago

That's right. For example Gannt include Korean like belows.

Actions #6

Updated by Namho Kim almost 13 years ago

That's right. For example Gannt include Korean like belows.

Gannt Korean export broken.

Actions #7

Updated by Jun NAITOH almost 13 years ago

This issue is font setting problem.

I wrote selectable RMagcik font patch.
This patch add RMagick font selector of Display tab in Setting.

If you want to show Japanese, so please select Japanese Font.

I tested on RMagick 2.13.1 on CentOS 6, RMagick 2.12.0 on Windows XP.

Actions #8

Updated by Toshi MARUYAMA almost 13 years ago

  • Assignee set to Toshi MARUYAMA
Actions #9

Updated by Etienne Massip almost 13 years ago

Please don't make this a new setting, just force the police font to what would fit well if possible?

Actions #10

Updated by Toshi MARUYAMA almost 13 years ago

  • Assignee deleted (Toshi MARUYAMA)
Actions #11

Updated by Toshi MARUYAMA almost 13 years ago

This is a patch using user preference.

Actions #12

Updated by Etienne Massip almost 13 years ago

I can't see why a font would be a user preference?? This should be automatic, who wants to select a specific font to export a chart? I just want to click and get my Gantt chart exported as a image as it it rendered in browser, period.

Please don't add too much complexity.

Actions #13

Updated by Toshi MARUYAMA almost 13 years ago

Etienne Massip wrote:

This should be automatic

There is no standard font in Japanese.

  • Windows: MS Mincho, MS Gothic
  • MacOS: HIRAGINO
  • Linux: Nothing

Unicode has Unified problem.
http://en.wikipedia.org/wiki/CJK_Unified_Ideographs

So, CJK font cannot be defined automatically.

Actions #14

Updated by Toshi MARUYAMA almost 13 years ago

On Redmine 1.3, CJK PDF fonts are hard-coded.
source:tags/1.3.0/lib/redmine/export/pdf.rb#L52

Redmine 1.3 uses non embedded fonts for CJK PDF.
So, PDF reader uses alternate fonts if there is no fonts on client.

But, rmagick processes on server.
So, we cannot hard-coded and defined fonts at locale files (config/locales/ja.yml).

Actions #15

Updated by Etienne Massip almost 13 years ago

Can't you add a setting to embed fonts into exported file?

Actions #16

Updated by Toshi MARUYAMA almost 13 years ago

Etienne Massip wrote:

Can't you add a setting to embed fonts into exported file?

It is difficult that user/administrator finds fonts name on server.
On Note-12 user-pref.png, font name is "IPAGothic-Regular".

Actions #17

Updated by Namho Kim almost 13 years ago

Korean is OK, using the above patch.

Actions #18

Updated by Jun NAITOH almost 13 years ago

Toshi MARUYAMA wrote:

This is a patch using user preference.

I'm checked. I think this patch is better than my patch.

Actions #19

Updated by Jun NAITOH almost 13 years ago

Etienne Massip wrote:

Please don't add too much complexity.

OK. I tried another approach.
This patch add a configurable path of RMagick in configuration.yml.

Actions #20

Updated by Go MAEDA about 12 years ago

Current PNG output is of no use in CJK. Font name must be set to address the problem but we cannot know what font is installed in a system because standard CJK font is different by operating system.

NAITOH's patch (png_rmagick_font_path_r8987.patch) seems smart approach to deal with the problem because there's no ui change.

It wishes strongly that the patch is merged to trunk to make Redmine more useful.

Actions #21

Updated by Toshi MARUYAMA about 12 years ago

This is a patch of note-19 png_rmagick_font_path_r8987.patch rebased to trunk r10851.
You can apply it to 2.1-stable r10848 (2.1.3).

Actions #22

Updated by Toshi MARUYAMA about 12 years ago

  • Status changed from New to Closed
  • Assignee set to Toshi MARUYAMA
  • Target version set to 2.2.0
  • % Done changed from 10 to 100
  • Resolution set to Fixed

I have added comment to note-21 patch and committed in trunk r10890 and r10892.

Actions #23

Updated by Daniel Felix over 10 years ago

Etienne Massip wrote:

Please don't make this a new setting, just force the police font to what would fit well if possible?

Well I would agree to that point. Our users won't be able to easily determine the right font on languages they don't even know.

Actions #24

Updated by Toshi MARUYAMA over 10 years ago

  • Related to Defect #13781: CJK(Chinese/Japanese/Korean) characters are not shown in PDF on non CJK locales added
Actions

Also available in: Atom PDF