プロジェクト

全般

プロフィール

Vote #66551

完了

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

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Gantt_34
対象バージョン:
開始日:
2010/02/10
期日:
進捗率:

100%

予定工数:
category_id:
34
version_id:
56
issue_org_id:
4787
author_id:
10864
assigned_to_id:
11192
comments:
24
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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)


journals

Looks like this is a font issue.

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

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

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?)
--------------------------------------------------------------------------------
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)

--------------------------------------------------------------------------------

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

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

!gantt_korean.png!
--------------------------------------------------------------------------------
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.

!rmagick_font.png!

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

--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This is a patch using user preference.

!user-pref.png!

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

--------------------------------------------------------------------------------
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).
--------------------------------------------------------------------------------
Can't you add a setting to embed fonts into exported file?
--------------------------------------------------------------------------------
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 attachment:user-pref.png, font name is "IPAGothic-Regular".
--------------------------------------------------------------------------------
Korean is OK, using the above patch.

!redmine-gantt_kr.png!
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> This is a patch using user preference.

I'm checked. I think this patch is better than my patch.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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 (attachment: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.
--------------------------------------------------------------------------------
This is a patch of note-19 attachment:png_rmagick_font_path_r8987.patch rebased to trunk r10851.
You can apply it to 2.1-stable r10848 (2.1.3).
--------------------------------------------------------------------------------
I have added comment to note-21 patch and committed in trunk r10890 and r10892.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,6505,PDF export broken with Japanese (Gannt and Issue Tracking)
relates,Closed,61,Broken character encoding in pdf export
relates,Closed,3231,patch for broken character problem on png-exported gantt on 0.8 branch
relates,Closed,69,Textilized description in PDF
relates,Closed,5638,Use Bundler (Gemfile) for gem management
relates,Closed,13781,CJK(Chinese/Japanese/Korean) characters are not shown in PDF on non CJK locales
duplicates,Closed,6506,Gantt chart export to PDF/PNG works incorrectly in zh-tw locale

Admin Redmine さんが約4年前に更新

  • カテゴリGantt_34 にセット
  • 対象バージョン2.2.0_56 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0