summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-09 10:41:02 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-09 10:41:02 +0000
commit5742f78bd1b771af8d50878dc2d93129747fa245 (patch)
treeba04c1fc2f52102e201b203e4e1e800e0671dc75 /lib
parentba2fb5340e57fde7a07fdde8a1fd971e9e6116c2 (diff)
downloadredmine-5742f78bd1b771af8d50878dc2d93129747fa245.tar.gz
redmine-5742f78bd1b771af8d50878dc2d93129747fa245.zip
PDF: switch encoding and font whether CJK and Thainland non UTF-8 or not in TCPDF Redmine class (#8312).
Contributed Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5718 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/export/pdf.rb33
1 files changed, 30 insertions, 3 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index 295911354..3dbbb63ec 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -34,13 +34,40 @@ module Redmine
attr_accessor :footer_date
def initialize(lang)
- super()
if RUBY_VERSION < '1.9'
@ic = Iconv.new(l(:general_pdf_encoding), 'UTF-8')
end
+ pdf_encoding = l(:general_pdf_encoding).upcase
+ super('P', 'mm', 'A4', (pdf_encoding == 'UTF-8'), pdf_encoding )
set_language_if_valid lang
- @font_for_content = 'FreeSans'
- @font_for_footer = 'FreeSans'
+ case pdf_encoding
+ when 'UTF-8'
+ @font_for_content = 'FreeSans'
+ @font_for_footer = 'FreeSans'
+ when 'CP949'
+ extend(PDF_Korean)
+ AddUHCFont()
+ @font_for_content = 'UHC'
+ @font_for_footer = 'UHC'
+ when 'CP932'
+ extend(PDF_Japanese)
+ AddSJISFont()
+ @font_for_content = 'SJIS'
+ @font_for_footer = 'SJIS'
+ when 'GB18030'
+ extend(PDF_Chinese)
+ AddGBFont()
+ @font_for_content = 'GB'
+ @font_for_footer = 'GB'
+ when 'BIG5'
+ extend(PDF_Chinese)
+ AddBig5Font()
+ @font_for_content = 'Big5'
+ @font_for_footer = 'Big5'
+ else
+ @font_for_content = 'Arial'
+ @font_for_footer = 'Helvetica'
+ end
SetCreator(Redmine::Info.app_name)
SetFont(@font_for_content)
end