Project

General

Profile

Defect #61 » korean.rb_rfpdf115.patch

Jun NAITOH, 2011-03-27 09:34

View differences:

rfpdf/lib/fpdf/korean.rb 2011-01-25 17:50:48.000000000 -0500 → rfpdf/lib/fpdf/korean.rb 2011-03-23 17:48:59.000000000 -0400
while(i<nb)
c=s[i]
if(c<128)
l+=cw[c.chr]
l+=cw[c.chr] if cw[c.chr]
i+=1
else
l+=1000
......
b2='LR'
else
b2=''
if(border.index('L').nil?)
b2+='L'
end
if(border.index('R').nil?)
b2+='R'
end
b=border.index('T').nil? ? b2+'T' : b2
b2='L' unless border.to_s.index('L').nil?
b2=b2+'R' unless border.to_s.index('R').nil?
b=(border.to_s.index('T')) ? (b2+'T') : b2
end
end
sep=-1
......
c=s[i]
#Check if ASCII or MB
ascii=(c<128)
if(c=="\n")
if(c.chr=="\n")
#Explicit line break
Cell(w,h,s[j,i-j],b,2,align,fill)
i+=1
......
if(!ascii)
sep=i
ls=l
elsif(c==' ')
elsif(c.chr==' ')
sep=i
ls=l
end
l+=ascii ? cw[c.chr] : 1000
l+=(ascii ? cw[c.chr] : 1000) || 0
if(l>wmax)
#Automatic line break
if(sep==-1 or i==j)
......
Cell(w,h,s[j,i-j],b,2,align,fill)
else
Cell(w,h,s[j,sep-j],b,2,align,fill)
i=(s[sep]==' ') ? sep+1 : sep
i=(s[sep].chr==' ') ? sep+1 : sep
end
sep=-1
j=i
......
end
end
#Last chunk
if(border and not border.index('B').nil?)
if(border and not border.to_s.index('B').nil?)
b+='B'
end
Cell(w,h,s[j,i-j],b,2,align,fill)
......
c=s[i]
#Check if ASCII or MB
ascii=(c<128)
if(c=="\n")
if(c.chr=="\n")
#Explicit line break
Cell(w,h,s[j,i-j],0,2,'',0,link)
i+=1
......
nl+=1
next
end
if(!ascii or c==' ')
if(!ascii or c.chr==' ')
sep=i
end
l+=ascii ? cw[c.chr] : 1000
l+=(ascii ? cw[c.chr] : 1000) || 0
if(l>wmax)
#Automatic line break
if(sep==-1 or i==j)
......
Cell(w,h,s[j,i-j],0,2,'',0,link)
else
Cell(w,h,s[j,sep-j],0,2,'',0,link)
i=(s[sep]==' ') ? sep+1 : sep
i=(s[sep].chr==' ') ? sep+1 : sep
end
sep=-1
j=i
(20-20/46)