Defect #61 » japanese.rb_rfpdf115.patch
| rfpdf/lib/fpdf/japanese.rb 2011-01-25 17:50:48.000000000 -0500 → rfpdf/lib/fpdf/japanese.rb 2011-03-23 17:46:19.000000000 -0400 | ||
|---|---|---|
|
o=s[i]
|
||
|
if(o<128)
|
||
|
#ASCII
|
||
|
l+=cw[o.chr]
|
||
|
l+=cw[o.chr] if cw[o.chr]
|
||
|
i+=1
|
||
|
elsif(o>=161 and o<=223)
|
||
|
#Half-width katakana
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
while(i<nb)
|
||
|
#Get next character
|
||
|
c=s[i]
|
||
|
o=ord(c)
|
||
|
o=c #o=ord(c)
|
||
|
if(o==10)
|
||
|
#Explicit line break
|
||
|
Cell(w,h,s[j,i-j],b,2,align,fill)
|
||
| ... | ... | |
|
end
|
||
|
if(o<128)
|
||
|
#ASCII
|
||
|
l+=cw[c.chr]
|
||
|
l+=cw[c.chr] || 0
|
||
|
n=1
|
||
|
if(o==32)
|
||
|
sep=i
|
||
| ... | ... | |
|
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)
|
||
| ... | ... | |
|
def Write(h,txt,link='')
|
||
|
if(@CurrentFont['type']=='Type0')
|
||
|
SJISWrite(h,txt,link)
|
||
|
else
|
||
|
super(h,txt,link)
|
||
|
SJISWrite(h,txt,link)
|
||
|
else
|
||
|
super(h,txt,link)
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
if(o<128)
|
||
|
#ASCII
|
||
|
l+=cw[c.chr]
|
||
|
l+=cw[c.chr] || 0
|
||
|
n=1
|
||
|
if(o==32)
|
||
|
sep=i
|
||
| ... | ... | |
|
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
|
||