Index: vendor/plugins/rfpdf/lib/fpdf/chinese.rb =================================================================== --- vendor/plugins/rfpdf/lib/fpdf/chinese.rb (revision 5670) +++ vendor/plugins/rfpdf/lib/fpdf/chinese.rb (working copy) @@ -116,7 +116,7 @@ end def GetStringWidth(s) - if(@CurrentFont['type']=='Type0') + if(@current_font['type']=='Type0') return GetMBStringWidth(s) else return super(s) @@ -126,7 +126,7 @@ def GetMBStringWidth(s) #Multi-byte version of GetStringWidth() l=0 - cw=@CurrentFont['cw'] + cw=@current_font['cw'] nb=s.length i=0 while(i0 and s[nb-1]=="\n") @@ -233,11 +233,11 @@ b+='B' end Cell(w,h,s[j,i-j],b,2,align,fill) - @x=@lMargin + @x=@l_margin end def Write(h,txt,link='') - if(@CurrentFont['type']=='Type0') + if(@current_font['type']=='Type0') MBWrite(h,txt,link) else super(h,txt,link) @@ -246,9 +246,9 @@ def MBWrite(h,txt,link) #Multi-byte version of Write() - cw=@CurrentFont['cw'] - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + cw=@current_font['cw'] + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size s=txt.gsub("\r",'') nb=s.length sep=-1 @@ -269,9 +269,9 @@ j=i l=0 if(nl==1) - @x=@lMargin - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + @x=@l_margin + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size end nl+=1 next @@ -283,12 +283,12 @@ if(l>wmax) #Automatic line break if(sep==-1 or i==j) - if(@x>@lMargin) + if(@x>@l_margin) #Move to next line - @x=@lMargin + @x=@l_margin @y+=h - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size i+=1 nl+=1 next @@ -305,9 +305,9 @@ j=i l=0 if(nl==1) - @x=@lMargin - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + @x=@l_margin + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size end nl+=1 else @@ -316,7 +316,7 @@ end #Last chunk if(i!=j) - Cell(l/1000*@FontSize,h,s[j,i-j],0,0,'',0,link) + Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link) end end @@ -332,10 +332,10 @@ end # mqr=get_magic_quotes_runtime() # set_magic_quotes_runtime(0) - @FontFiles.each_pair do |file, info| + @font_files.each_pair do |file, info| #Font file embedding newobj() - @FontFiles[file]['n']=@n + @font_files[file]['n']=@n if(defined('FPDF_FONTPATH')) file=FPDF_FONTPATH+file end @@ -411,7 +411,7 @@ end file=font['file'] if(file) - s+=' /FontFile'+(font['type']=='Type1' ? '' : '2')+' '+@FontFiles[file]['n']+' 0 R' + s+=' /FontFile'+(font['type']=='Type1' ? '' : '2')+' '+@font_files[file]['n']+' 0 R' end out(s+'>>') out('endobj') Index: vendor/plugins/rfpdf/lib/fpdf/korean.rb =================================================================== --- vendor/plugins/rfpdf/lib/fpdf/korean.rb (revision 5670) +++ vendor/plugins/rfpdf/lib/fpdf/korean.rb (working copy) @@ -85,7 +85,7 @@ end def GetStringWidth(s) - if(@CurrentFont['type']=='Type0') + if(@current_font['type']=='Type0') return GetMBStringWidth(s) else return super(s) @@ -95,7 +95,7 @@ def GetMBStringWidth(s) #Multi-byte version of GetStringWidth() l=0 - cw=@CurrentFont['cw'] + cw=@current_font['cw'] nb=s.length i=0 while(i0 and s[nb-1]=="\n") @@ -202,11 +202,11 @@ b+='B' end Cell(w,h,s[j,i-j],b,2,align,fill) - @x=@lMargin + @x=@l_margin end def Write(h,txt,link='') - if(@CurrentFont['type']=='Type0') + if(@current_font['type']=='Type0') MBWrite(h,txt,link) else super(h,txt,link) @@ -215,9 +215,9 @@ def MBWrite(h,txt,link) #Multi-byte version of Write() - cw=@CurrentFont['cw'] - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + cw=@current_font['cw'] + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size s=txt.gsub("\r",'') nb=s.length sep=-1 @@ -238,9 +238,9 @@ j=i l=0 if(nl==1) - @x=@lMargin - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + @x=@l_margin + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size end nl+=1 next @@ -252,12 +252,12 @@ if(l>wmax) #Automatic line break if(sep==-1 or i==j) - if(@x>@lMargin) + if(@x>@l_margin) #Move to next line - @x=@lMargin + @x=@l_margin @y+=h - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size i+=1 nl+=1 next @@ -274,9 +274,9 @@ j=i l=0 if(nl==1) - @x=@lMargin - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + @x=@l_margin + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size end nl+=1 else @@ -285,7 +285,7 @@ end #Last chunk if(i!=j) - Cell(l/1000*@FontSize,h,s[j,i-j],0,0,'',0,link) + Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link) end end @@ -301,10 +301,10 @@ end # mqr=get_magic_quotes_runtime() # set_magic_quotes_runtime(0) - @FontFiles.each_pair do |file, info| + @font_files.each_pair do |file, info| #Font file embedding newobj() - @FontFiles[file]['n']=@n + @font_files[file]['n']=@n if(defined('FPDF_FONTPATH')) file=FPDF_FONTPATH+file end @@ -378,7 +378,7 @@ end file=font['file'] if(file) - s+=' /FontFile'+(font['type']=='Type1' ? '' : '2')+' '+@FontFiles[file]['n']+' 0 R' + s+=' /FontFile'+(font['type']=='Type1' ? '' : '2')+' '+@font_files[file]['n']+' 0 R' end out(s+'>>') out('endobj') Index: vendor/plugins/rfpdf/lib/fpdf/japanese.rb =================================================================== --- vendor/plugins/rfpdf/lib/fpdf/japanese.rb (revision 5670) +++ vendor/plugins/rfpdf/lib/fpdf/japanese.rb (working copy) @@ -86,7 +86,7 @@ end def GetStringWidth(s) - if(@CurrentFont['type']=='Type0') + if(@current_font['type']=='Type0') return GetSJISStringWidth(s) else return super(s) @@ -96,7 +96,7 @@ def GetSJISStringWidth(s) #SJIS version of GetStringWidth() l=0 - cw=@CurrentFont['cw'] + cw=@current_font['cw'] nb=s.length i=0 while(i0 and s[nb-1]=="\n") @@ -221,11 +221,11 @@ b+='B' end Cell(w,h,s[j,i-j],b,2,align,fill) - @x=@lMargin + @x=@l_margin end def Write(h,txt,link='') - if(@CurrentFont['type']=='Type0') + if(@current_font['type']=='Type0') SJISWrite(h,txt,link) else super(h,txt,link) @@ -234,9 +234,9 @@ def SJISWrite(h,txt,link) #SJIS version of Write() - cw=@CurrentFont['cw'] - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + cw=@current_font['cw'] + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size s=txt.gsub("\r",'') nb=s.length sep=-1 @@ -257,9 +257,9 @@ l=0 if(nl==1) #Go to left margin - @x=@lMargin - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + @x=@l_margin + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size end nl+=1 next @@ -285,12 +285,12 @@ if(l>wmax) #Automatic line break if(sep==-1 or i==j) - if(@x>@lMargin) + if(@x>@l_margin) #Move to next line - @x=@lMargin + @x=@l_margin @y+=h - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size i+=n nl+=1 next @@ -307,9 +307,9 @@ j=i l=0 if(nl==1) - @x=@lMargin - w=@w-@rMargin-@x - wmax=(w-2*@cMargin)*1000/@FontSize + @x=@l_margin + w=@w-@r_margin-@x + wmax=(w-2*@c_margin)*1000/@font_size end nl+=1 else @@ -321,7 +321,7 @@ end #Last chunk if(i!=j) - Cell(l/1000*@FontSize,h,s[j,i-j],0,0,'',0,link) + Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link) end end @@ -337,10 +337,10 @@ end # mqr=get_magic_quotes_runtime() # set_magic_quotes_runtime(0) - @FontFiles.each_pair do |file, info| + @font_files.each_pair do |file, info| #Font file embedding newobj() - @FontFiles[file]['n']=@n + @font_files[file]['n']=@n if(defined('FPDF_FONTPATH')) file=FPDF_FONTPATH+file end @@ -414,7 +414,7 @@ end file=font['file'] if(file) - s+=' /FontFile'+(font['type']=='Type1' ? '' : '2')+' '+@FontFiles[file]['n']+' 0 R' + s+=' /FontFile'+(font['type']=='Type1' ? '' : '2')+' '+@font_files[file]['n']+' 0 R' end out(s+'>>') out('endobj') Index: vendor/plugins/rfpdf/lib/tcpdf.rb =================================================================== --- vendor/plugins/rfpdf/lib/tcpdf.rb (revision 5670) +++ vendor/plugins/rfpdf/lib/tcpdf.rb (working copy) @@ -669,10 +669,11 @@ # @since 1.4 # @see PageNo(), Footer() # - def alias_nb_pages(alias_nb ='{nb}') + def AliasNbPages(alias_nb ='{nb}') #Define an alias for total number of pages @alias_nb_pages = escapetext(alias_nb) end + alias_method :alias_nb_pages, :AliasNbPages # # This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid. @@ -1154,10 +1155,10 @@ end else s.each_byte do |c| - if cw[c] - w += cw[c]; - elsif cw[?c] - w += cw[?c] + if cw[c.chr] + w += cw[c.chr]; + elsif cw[?c.chr] + w += cw[?c.chr] end end end @@ -1433,9 +1434,7 @@ end # try to add font (if not already added) - if (@is_unicode) - AddFont(family, style); - end + AddFont(family, style); #Test if font is already selected if ((@font_family == family) and (@font_style == style) and (@font_size_pt == size)) @@ -2293,7 +2292,7 @@ def putpages() nb = @page; if (@alias_nb_pages) - nbstr = UTF8ToUTF16BE(nb, false); + nbstr = UTF8ToUTF16BE(nb.to_s, false); #Replace number of pages 1.upto(nb) do |n| @pages[n].gsub!(@alias_nb_pages, nbstr) Index: lib/redmine/export/pdf.rb =================================================================== --- lib/redmine/export/pdf.rb (revision 5670) +++ lib/redmine/export/pdf.rb (working copy) @@ -29,66 +29,23 @@ include ActionView::Helpers::TextHelper include ActionView::Helpers::NumberHelper - class ITCPDF < TCPDF + class IFPDF < TCPDF include Redmine::I18n attr_accessor :footer_date def initialize(lang) - super() - set_language_if_valid lang - @font_for_content = 'FreeSans' - @font_for_footer = 'FreeSans' - SetCreator(Redmine::Info.app_name) - SetFont(@font_for_content) - end - - def SetFontStyle(style, size) - SetFont(@font_for_content, style, size) - end - - def SetTitle(txt) - txt = begin - utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt) - hextxt = "" - rescue - txt - end || '' - super(txt) - end - - def textstring(s) - # Format a text string - if s =~ /^