Commit 60e08416 authored by Toshi MARUYAMA's avatar Toshi MARUYAMA Committed by Eric Davis

PDF: transplant r1497 (#61).

Fixes Chinese pdf export when the issue description is too long (#1170).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5252 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 64bf5100
...@@ -189,7 +189,7 @@ module PDF_Chinese ...@@ -189,7 +189,7 @@ module PDF_Chinese
c=s[i] c=s[i]
#Check if ASCII or MB #Check if ASCII or MB
ascii=(c<128) ascii=(c<128)
if(c=="\n") if(c.chr=="\n")
#Explicit line break #Explicit line break
Cell(w,h,s[j,i-j],b,2,align,fill) Cell(w,h,s[j,i-j],b,2,align,fill)
i+=1 i+=1
...@@ -209,12 +209,12 @@ module PDF_Chinese ...@@ -209,12 +209,12 @@ module PDF_Chinese
sep=i sep=i
ls=l ls=l
end end
l+=ascii ? (cw[c.chr] || 0) : 1000 l+=ascii ? (cw[c.chr] || 0) : 1100
if(l>wmax) if(l>wmax)
#Automatic line break #Automatic line break
if(sep==-1 or i==j) if(sep==-1 or i==j)
if(i==j) if(i==j)
i+=ascii ? 1 : 2 i+=ascii ? 1 : 3
end end
Cell(w,h,s[j,i-j],b,2,align,fill) Cell(w,h,s[j,i-j],b,2,align,fill)
else else
...@@ -229,7 +229,7 @@ module PDF_Chinese ...@@ -229,7 +229,7 @@ module PDF_Chinese
b=b2 b=b2
end end
else else
i+=ascii ? 1 : 2 i+=ascii ? 1 : 3
end end
end end
#Last chunk #Last chunk
...@@ -265,7 +265,7 @@ module PDF_Chinese ...@@ -265,7 +265,7 @@ module PDF_Chinese
c=s[i] c=s[i]
#Check if ASCII or MB #Check if ASCII or MB
ascii=(c<128) ascii=(c<128)
if(c=="\n") if(c.chr=="\n")
#Explicit line break #Explicit line break
Cell(w,h,s[j,i-j],0,2,'',0,link) Cell(w,h,s[j,i-j],0,2,'',0,link)
i+=1 i+=1
...@@ -283,7 +283,7 @@ module PDF_Chinese ...@@ -283,7 +283,7 @@ module PDF_Chinese
if(!ascii or c==' ') if(!ascii or c==' ')
sep=i sep=i
end end
l+=ascii ? cw[c.chr] : 1000 l+=ascii ? cw[c.chr] : 1100
if(l>wmax) if(l>wmax)
#Automatic line break #Automatic line break
if(sep==-1 or i==j) if(sep==-1 or i==j)
...@@ -298,7 +298,7 @@ module PDF_Chinese ...@@ -298,7 +298,7 @@ module PDF_Chinese
next next
end end
if(i==j) if(i==j)
i+=ascii ? 1 : 2 i+=ascii ? 1 : 3
end end
Cell(w,h,s[j,i-j],0,2,'',0,link) Cell(w,h,s[j,i-j],0,2,'',0,link)
else else
...@@ -315,7 +315,7 @@ module PDF_Chinese ...@@ -315,7 +315,7 @@ module PDF_Chinese
end end
nl+=1 nl+=1
else else
i+=ascii ? 1 : 2 i+=ascii ? 1 : 3
end end
end end
#Last chunk #Last chunk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment