Project

General

Profile

Defect #61 » pdf_0x5c_char_handling.patch

Jun NAITOH, 2011-04-29 00:07

View differences:

vendor/plugins/rfpdf/lib/rfpdf/fpdf.rb (working copy)
def Text(x, y, txt)
# Output a string
txt.gsub!(')', '\\)')
txt.gsub!('(', '\\(')
txt.gsub!('\\', '\\\\')
s=sprintf('BT %.2f %.2f Td (%s) Tj ET',x*@k,(@h-y)*@k,txt);
s=sprintf('BT %.2f %.2f Td (%s) Tj ET',x*@k,(@h-y)*@k, escape(txt));
s=s+' '+dounderline(x,y,txt) if @underline and txt!=''
s='q '+@TextColor+' '+s+' Q' if @ColorFlag
out(s)
......
else
dx=@cMargin
end
txt = txt.gsub(')', '\\)')
txt.gsub!('(', '\\(')
txt.gsub!('\\', '\\\\')
if @ColorFlag
s=s+'q '+@TextColor+' '
end
s=s+sprintf('BT %.2f %.2f Td (%s) Tj ET',
(@x+dx)*@k,(@h-(@y+0.5*h+0.3*@FontSize))*@k,txt)
(@x+dx)*@k,(@h-(@y+0.5*h+0.3*@FontSize))*@k,escape(txt))
s=s+' '+dounderline(@x+dx,@y+0.5*h+0.3*@FontSize,txt) if @underline
s=s+' Q' if @ColorFlag
if link and link != ''
......
def escape(s)
# Add \ before \, ( and )
s.gsub('\\','\\\\').gsub('(','\\(').gsub(')','\\)')
s.gsub('\\','\\\\\\').gsub('(','\\(').gsub(')','\\)')
end
def putstream(s)
lib/redmine/export/pdf.rb (working copy)
end
txt = txtar
end
# 0x5c char handling
txt.gsub(/\\/, "\\\\\\\\")
end
def RDMCell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
(46-46/46)