@@ -34,7 +34,6 module Redmine | |||||
34 | @@k_path_cache = Rails.root.join('tmp', 'pdf') |
|
34 | @@k_path_cache = Rails.root.join('tmp', 'pdf') | |
35 | FileUtils.mkdir_p @@k_path_cache unless File::exist?(@@k_path_cache) |
|
35 | FileUtils.mkdir_p @@k_path_cache unless File::exist?(@@k_path_cache) | |
36 | set_language_if_valid lang |
|
36 | set_language_if_valid lang | |
37 | pdf_encoding = l(:general_pdf_encoding).upcase |
|
|||
38 | super(orientation, 'mm', 'A4') |
|
37 | super(orientation, 'mm', 'A4') | |
39 | set_print_header(false) |
|
38 | set_print_header(false) | |
40 | set_rtl(l(:direction) == 'rtl') |
|
39 | set_rtl(l(:direction) == 'rtl') | |
@@ -60,14 +59,8 module Redmine | |||||
60 | @font_for_content = 'freeserif' |
|
59 | @font_for_content = 'freeserif' | |
61 | @font_for_footer = 'freeserif' |
|
60 | @font_for_footer = 'freeserif' | |
62 | else |
|
61 | else | |
63 | case pdf_encoding |
|
62 | @font_for_content = 'freesans' | |
64 | when 'UTF-8' |
|
63 | @font_for_footer = 'freesans' | |
65 | @font_for_content = 'freesans' |
|
|||
66 | @font_for_footer = 'freesans' |
|
|||
67 | else |
|
|||
68 | @font_for_content = 'helvetica' |
|
|||
69 | @font_for_footer = 'helvetica' |
|
|||
70 | end |
|
|||
71 | end |
|
64 | end | |
72 | set_creator(Redmine::Info.app_name) |
|
65 | set_creator(Redmine::Info.app_name) | |
73 | set_font(@font_for_content) |
|
66 | set_font(@font_for_content) | |
@@ -83,7 +76,7 module Redmine | |||||
83 | end |
|
76 | end | |
84 |
|
77 | |||
85 | def fix_text_encoding(txt) |
|
78 | def fix_text_encoding(txt) | |
86 |
RDMPdfEncoding::rdm_from_utf8(txt, |
|
79 | RDMPdfEncoding::rdm_from_utf8(txt, "UTF-8") | |
87 | end |
|
80 | end | |
88 |
|
81 | |||
89 | def formatted_text(text) |
|
82 | def formatted_text(text) | |
@@ -120,7 +113,6 module Redmine | |||||
120 | end |
|
113 | end | |
121 |
|
114 | |||
122 | def get_image_filename(attrname) |
|
115 | def get_image_filename(attrname) | |
123 | # attrname: general_pdf_encoding string file/uri name |
|
|||
124 | atta = RDMPdfEncoding.attach(@attachments, attrname, "UTF-8") |
|
116 | atta = RDMPdfEncoding.attach(@attachments, attrname, "UTF-8") | |
125 | if atta |
|
117 | if atta | |
126 | return atta.diskfile |
|
118 | return atta.diskfile | |
@@ -150,6 +142,15 module Redmine | |||||
150 | end |
|
142 | end | |
151 | end |
|
143 | end | |
152 |
|
144 | |||
|
145 | def is_cjk? | |||
|
146 | case current_language.to_s.downcase | |||
|
147 | when 'ja', 'zh-tw', 'zh', 'ko' | |||
|
148 | true | |||
|
149 | else | |||
|
150 | false | |||
|
151 | end | |||
|
152 | end | |||
|
153 | ||||
153 | # fetch row values |
|
154 | # fetch row values | |
154 | def fetch_row_values(issue, query, level) |
|
155 | def fetch_row_values(issue, query, level) | |
155 | query.inline_columns.collect do |column| |
|
156 | query.inline_columns.collect do |column| | |
@@ -519,8 +520,7 module Redmine | |||||
519 | issue.description.to_s, issue.attachments, "LRB") |
|
520 | issue.description.to_s, issue.attachments, "LRB") | |
520 |
|
521 | |||
521 | unless issue.leaf? |
|
522 | unless issue.leaf? | |
522 | # for CJK |
|
523 | truncate_length = (!is_cjk? ? 90 : 65) | |
523 | truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 90 : 65 ) |
|
|||
524 | pdf.SetFontStyle('B',9) |
|
524 | pdf.SetFontStyle('B',9) | |
525 | pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR") |
|
525 | pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR") | |
526 | pdf.ln |
|
526 | pdf.ln | |
@@ -538,8 +538,7 module Redmine | |||||
538 |
|
538 | |||
539 | relations = issue.relations.select { |r| r.other_issue(issue).visible? } |
|
539 | relations = issue.relations.select { |r| r.other_issue(issue).visible? } | |
540 | unless relations.empty? |
|
540 | unless relations.empty? | |
541 | # for CJK |
|
541 | truncate_length = (!is_cjk? ? 80 : 60) | |
542 | truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 ) |
|
|||
543 | pdf.SetFontStyle('B',9) |
|
542 | pdf.SetFontStyle('B',9) | |
544 | pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR") |
|
543 | pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR") | |
545 | pdf.ln |
|
544 | pdf.ln |
General Comments 0
You need to be logged in to leave comments.
Login now