summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-29 05:35:26 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-29 05:35:26 +0000
commitf62605c636c2089a1c7a4ea6998dac135bd75346 (patch)
tree5a515f9c1ee14dd67672fb4c71309c7e6803203b /vendor
parented3efeb9600c91e71727a3f147f2905ec35e5b55 (diff)
downloadredmine-f62605c636c2089a1c7a4ea6998dac135bd75346.tar.gz
redmine-f62605c636c2089a1c7a4ea6998dac135bd75346.zip
PDF: fix 0x5c(backslash) escape processing in FPDF (#61).
Japanese CP932(Shift_JIS) and Traditional Chinese Big5 have 0x5c(backslash) problem. Contributed Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5565 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor')
-rw-r--r--vendor/plugins/rfpdf/lib/rfpdf/fpdf.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/vendor/plugins/rfpdf/lib/rfpdf/fpdf.rb b/vendor/plugins/rfpdf/lib/rfpdf/fpdf.rb
index 30714fa3a..8b129a48d 100644
--- a/vendor/plugins/rfpdf/lib/rfpdf/fpdf.rb
+++ b/vendor/plugins/rfpdf/lib/rfpdf/fpdf.rb
@@ -642,10 +642,7 @@ class FPDF
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)
@@ -719,14 +716,11 @@ class FPDF
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 != ''
@@ -1538,7 +1532,7 @@ class FPDF
def escape(s)
# Add \ before \, ( and )
- s.gsub('\\','\\\\').gsub('(','\\(').gsub(')','\\)')
+ s.gsub('\\','\\\\\\').gsub('(','\\(').gsub(')','\\)')
end
def putstream(s)