##// END OF EJS Templates
PDF: switch encoding and font whether CJK and Thainland non UTF-8 or not in TCPDF Redmine class (#8312)....
Toshi MARUYAMA -
r5598:5742f78bd1b7
parent child
Show More
@@ -34,13 +34,40 module Redmine
34 attr_accessor :footer_date
34 attr_accessor :footer_date
35
35
36 def initialize(lang)
36 def initialize(lang)
37 super()
38 if RUBY_VERSION < '1.9'
37 if RUBY_VERSION < '1.9'
39 @ic = Iconv.new(l(:general_pdf_encoding), 'UTF-8')
38 @ic = Iconv.new(l(:general_pdf_encoding), 'UTF-8')
40 end
39 end
40 pdf_encoding = l(:general_pdf_encoding).upcase
41 super('P', 'mm', 'A4', (pdf_encoding == 'UTF-8'), pdf_encoding )
41 set_language_if_valid lang
42 set_language_if_valid lang
42 @font_for_content = 'FreeSans'
43 case pdf_encoding
43 @font_for_footer = 'FreeSans'
44 when 'UTF-8'
45 @font_for_content = 'FreeSans'
46 @font_for_footer = 'FreeSans'
47 when 'CP949'
48 extend(PDF_Korean)
49 AddUHCFont()
50 @font_for_content = 'UHC'
51 @font_for_footer = 'UHC'
52 when 'CP932'
53 extend(PDF_Japanese)
54 AddSJISFont()
55 @font_for_content = 'SJIS'
56 @font_for_footer = 'SJIS'
57 when 'GB18030'
58 extend(PDF_Chinese)
59 AddGBFont()
60 @font_for_content = 'GB'
61 @font_for_footer = 'GB'
62 when 'BIG5'
63 extend(PDF_Chinese)
64 AddBig5Font()
65 @font_for_content = 'Big5'
66 @font_for_footer = 'Big5'
67 else
68 @font_for_content = 'Arial'
69 @font_for_footer = 'Helvetica'
70 end
44 SetCreator(Redmine::Info.app_name)
71 SetCreator(Redmine::Info.app_name)
45 SetFont(@font_for_content)
72 SetFont(@font_for_content)
46 end
73 end
General Comments 0
You need to be logged in to leave comments. Login now