ifpdf_helper.rb.diff

Hajime Baba, 2008-05-07 15:09

Download (1.05 KB)

View differences:

app/helpers/ifpdf_helper.rb (working copy)
55 55
      SetFont(@font_for_content, style, size)
56 56
    end
57 57
      
58
    def SetTitle(txt)
59
      case current_language.to_s
60
      when 'ja', 'zh', 'zh-tw'
61
        txt = begin
62
          utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt)
63
          hextxt = "<FEFF"  # FEFF is BOM
64
          hextxt << utf16txt.unpack("C*").map {|x| sprintf("%02X",x) }.join
65
          hextxt << ">"
66
        rescue
67
          txt
68
        end || ''
69
      end
70
      super(txt)
71
    end
72

  
73
    def textstring(s)
74
      # Format a text string
75
      if s =~ /^</  # This means the string is hex-dumped.
76
        return s
77
      else
78
        return '('+escape(s)+')'
79
      end
80
    end
81

  
58 82
    def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
59 83
      @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
60 84
      # these quotation marks are not correctly rendered in the pdf