アットウィキロゴ
Hajime BABA

=======================================================================

Index: app/helpers/ifpdf_helper.rb
===================================================================
--- app/helpers/ifpdf_helper.rb (revision 1401)
+++ app/helpers/ifpdf_helper.rb (working copy)
@@ -56,6 +56,17 @@
     end

     def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
+      txt = convUTF8toSJISandEscape0x5c(txt)
+      super w,h,txt,border,ln,align,fill,link
+    end
+
+    def MultiCell2(w,h,txt,border=0,align='L',fill=0)
+      txt = convUTF8toSJISandEscape0x5c(txt)
+      MultiCell(w,h,txt,border,align,fill)
+    end
+
+    def convUTF8toSJISandEscape0x5c(txt)
+      txt << "  "
       @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
       # these quotation marks are not correctly rendered in the pdf
       txt = txt.gsub(/[“”]/, '"') if txt
@@ -67,9 +78,8 @@
       rescue
         txt
       end || ''
-      super w,h,txt,border,ln,align,fill,link
     end
-
+
     def Footer
       SetFont(@font_for_footer, 'I', 8)
       SetY(-15)
@@ -79,7 +89,31 @@
       SetX(-30)
       Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
     end
-
+
+    def SetTitle(txt)
+      case current_language.to_s
+      when 'ja', 'zh', 'zh-tw'
+       txt = begin
+         utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt)
+         hextxt = "<FEFF"  # FEFF is BOM
+         hextxt << utf16txt.unpack("C*").map {|x| sprintf("%02X",x) }.join
+         hextxt << ">"
+       rescue
+         txt
+       end || ''
+      end
+      super(txt)
+    end
+
+    def textstring(s)
+      # Format a text string
+      if s =~ /^</  # This means the string is hex-dumped.
+        return s
+      else
+        return '('+escape(s)+')'
+      end
+    end
+
   end

end
Index: app/views/issues/index.rfpdf
===================================================================
--- app/views/issues/index.rfpdf        (revision 1401)
+++ app/views/issues/index.rfpdf        (working copy)
@@ -42,9 +42,9 @@
                pdf.Cell(30, row_height, issue.priority.name, 0, 0,
'L', 1)
                pdf.Cell(40, row_height, issue.assigned_to ?issue.assigned_to.name : '', 0, 0, 'L', 1)
                pdf.Cell(25, row_height, format_date(issue.updated_on), 0, 0, 'L', 1)
-               pdf.MultiCell(0, row_height, (@project == issue.project ? issue.subject : "#{issue.project.name} - #{issue.subject}"))
+               pdf.MultiCell2(0, row_height, (@project == issue.project ? issue.subject : "#{issue.project.name} - #{issue.subject}"))
                pdf.Line(10, pdf.GetY, 287, pdf.GetY)
                pdf.SetY(pdf.GetY() + 1)
        end
%>
-<%= pdf.Output %>
\ No newline at end of file
+<%= pdf.Output %>
Index: app/views/issues/_pdf.rfpdf
===================================================================
--- app/views/issues/_pdf.rfpdf (revision 1401)
+++ app/views/issues/_pdf.rfpdf (working copy)
@@ -48,7 +48,7 @@
            pdf.SetFontStyle('B',9)
            pdf.Cell(35,5, custom_value.custom_field.name + ":","L")
            pdf.SetFontStyle('',9)
-           pdf.MultiCell(155,5, (show_value custom_value),"R")
+           pdf.MultiCell2(155,5, (show_value custom_value),"R")
        end

     pdf.SetFontStyle('B',9)
@@ -60,7 +60,7 @@
     pdf.SetFontStyle('B',9)
     pdf.Cell(35,5, l(:field_description) + ":")
     pdf.SetFontStyle('',9)
-    pdf.MultiCell(155,5, issue.description,"BR")
+    pdf.MultiCell2(155,5, issue.description,"BR")

     pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY)
        pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY)
@@ -77,7 +77,7 @@
                    pdf.Ln
                        unless changeset.comments.blank?
                                pdf.SetFontStyle('',8)
-                               pdf.MultiCell(190,5,changeset.comments)
+                               pdf.MultiCell2(190,5,changeset.comments)
                        end
                        pdf.Ln
                end
@@ -97,7 +97,7 @@
                end
                if journal.notes?
                        pdf.SetFontStyle('',8)
-                       pdf.MultiCell(190,5, journal.notes)
+                       pdf.MultiCell2(190,5, journal.notes)
                end
                pdf.Ln
        end
Index: lang/ja.yml
===================================================================
--- lang/ja.yml (revision 1401)
+++ lang/ja.yml (working copy)
@@ -50,7 +50,7 @@
general_lang_name: 'Japanese (日本語)'
general_csv_separator: ','
general_csv_encoding: SJIS
-general_pdf_encoding: UTF-8
+general_pdf_encoding: SJIS
general_day_names: 月曜日,火曜日,水曜日,木曜日,金曜日,土曜日,日曜日
general_first_day_of_week: '7'

==================================================================================
最終更新:2008年12月30日 10:10