summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-30 11:32:35 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-30 11:32:35 +0000
commit325af8d48cca75ada9a765ca2affac97d90791ea (patch)
tree9927f05e096aa3b148e3652d1ac24676806cf4ed /lib
parent988841d69a0d527a20a102608c6951be0e5a43b9 (diff)
downloadredmine-325af8d48cca75ada9a765ca2affac97d90791ea.tar.gz
redmine-325af8d48cca75ada9a765ca2affac97d90791ea.zip
PDF: switch TCPDF UTF-8 or FPDF ANSI (#61).
If server is Windows or language is CJK or Thai, Redmine uses FPDF. Else Redmine uses TCPDF. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5259 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/export/pdf.rb29
-rw-r--r--lib/redmine/helpers/gantt.rb11
2 files changed, 33 insertions, 7 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index d1c890959..d6f247ecb 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -37,7 +37,7 @@ module Redmine
super()
set_language_if_valid lang
@font_for_content = 'FreeSans'
- @font_for_footer = 'FreeSans'
+ @font_for_footer = 'FreeSans'
SetCreator(Redmine::Info.app_name)
SetFont(@font_for_content)
end
@@ -93,7 +93,7 @@ module Redmine
extend(PDF_Korean)
AddUHCFont()
@font_for_content = 'UHC'
- @font_for_footer = 'UHC'
+ @font_for_footer = 'UHC'
when 'ja'
extend(PDF_Japanese)
AddSJISFont()
@@ -111,7 +111,7 @@ module Redmine
@font_for_footer = 'Big5'
else
@font_for_content = 'Arial'
- @font_for_footer = 'Helvetica'
+ @font_for_footer = 'Helvetica'
end
SetCreator(Redmine::Info.app_name)
SetFont(@font_for_content)
@@ -179,8 +179,16 @@ module Redmine
# Returns a PDF string of a list of issues
def issues_to_pdf(issues, project, query)
- pdf = IFPDF.new(current_language)
-
+ if Redmine::Platform.mswin? ||
+ ( current_language.to_s.downcase == 'ko' ||
+ current_language.to_s.downcase == 'ja' ||
+ current_language.to_s.downcase == 'zh' ||
+ current_language.to_s.downcase == 'zh-tw' ||
+ current_language.to_s.downcase == 'th' )
+ pdf = IFPDF.new(current_language)
+ else
+ pdf = ITCPDF.new(current_language)
+ end
title = query.new_record? ? l(:label_issue_plural) : query.name
title = "#{project} - #{title}" if project
pdf.SetTitle(title)
@@ -251,7 +259,16 @@ module Redmine
# Returns a PDF string of a single issue
def issue_to_pdf(issue)
- pdf = IFPDF.new(current_language)
+ if Redmine::Platform.mswin? ||
+ ( current_language.to_s.downcase == 'ko' ||
+ current_language.to_s.downcase == 'ja' ||
+ current_language.to_s.downcase == 'zh' ||
+ current_language.to_s.downcase == 'zh-tw' ||
+ current_language.to_s.downcase == 'th' )
+ pdf = IFPDF.new(current_language)
+ else
+ pdf = ITCPDF.new(current_language)
+ end
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}")
pdf.alias_nb_pages
pdf.footer_date = format_date(Date.today)
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 1413e6f91..8a03af0f7 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -507,7 +507,16 @@ module Redmine
end if Object.const_defined?(:Magick)
def to_pdf
- pdf = ::Redmine::Export::PDF::IFPDF.new(current_language)
+ if Redmine::Platform.mswin? ||
+ ( current_language.to_s.downcase == 'ko' ||
+ current_language.to_s.downcase == 'ja' ||
+ current_language.to_s.downcase == 'zh' ||
+ current_language.to_s.downcase == 'zh-tw' ||
+ current_language.to_s.downcase == 'th' )
+ pdf = ::Redmine::Export::PDF::IFPDF.new(current_language)
+ else
+ pdf = ::Redmine::Export::PDF::ITCPDF.new(current_language)
+ end
pdf.SetTitle("#{l(:label_gantt)} #{project}")
pdf.alias_nb_pages
pdf.footer_date = format_date(Date.today)