PDF: import Korean rfpdf patch for textilized PDF (#69).
Contributed by Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6132 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
dc4123cb9b
commit
047ba7c879
|
@ -111,15 +111,20 @@ UHC_widths={' ' => 333, '!' => 416, '"' => 416, '#' => 833, '$' => 625, '%' => 9
|
||||||
return l*@font_size/1000
|
return l*@font_size/1000
|
||||||
end
|
end
|
||||||
|
|
||||||
def MultiCell(w,h,txt,border=0,align='L',fill=0)
|
def MultiCell(w,h,txt,border=0,align='L',fill=0,ln=1)
|
||||||
if(@current_font['type']=='Type0')
|
if(@current_font['type']=='Type0')
|
||||||
MBMultiCell(w,h,txt,border,align,fill)
|
MBMultiCell(w,h,txt,border,align,fill,ln)
|
||||||
else
|
else
|
||||||
super(w,h,txt,border,align,fill)
|
super(w,h,txt,border,align,fill,ln)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def MBMultiCell(w,h,txt,border=0,align='L',fill=0)
|
def MBMultiCell(w,h,txt,border=0,align='L',fill=0,ln=1)
|
||||||
|
|
||||||
|
# save current position
|
||||||
|
prevx = @x;
|
||||||
|
prevy = @y;
|
||||||
|
|
||||||
#Multi-byte version of MultiCell()
|
#Multi-byte version of MultiCell()
|
||||||
cw=@current_font['cw']
|
cw=@current_font['cw']
|
||||||
if(w==0)
|
if(w==0)
|
||||||
|
@ -202,18 +207,30 @@ UHC_widths={' ' => 333, '!' => 416, '"' => 416, '#' => 833, '$' => 625, '%' => 9
|
||||||
b+='B'
|
b+='B'
|
||||||
end
|
end
|
||||||
Cell(w,h,s[j,i-j],b,2,align,fill)
|
Cell(w,h,s[j,i-j],b,2,align,fill)
|
||||||
@x=@l_margin
|
|
||||||
end
|
|
||||||
|
|
||||||
def Write(h,txt,link='')
|
# move cursor to specified position
|
||||||
if(@current_font['type']=='Type0')
|
if (ln == 1)
|
||||||
MBWrite(h,txt,link)
|
# go to the beginning of the next line
|
||||||
else
|
@x=@l_margin
|
||||||
super(h,txt,link)
|
elsif (ln == 0)
|
||||||
|
# go to the top-right of the cell
|
||||||
|
@y = prevy;
|
||||||
|
@x = prevx + w;
|
||||||
|
elsif (ln == 2)
|
||||||
|
# go to the bottom-left of the cell
|
||||||
|
@x = prevx;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def MBWrite(h,txt,link)
|
def Write(h,txt,link='',fill=0)
|
||||||
|
if(@current_font['type']=='Type0')
|
||||||
|
MBWrite(h,txt,link,fill)
|
||||||
|
else
|
||||||
|
super(h,txt,link,fill)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def MBWrite(h,txt,link,fill=0)
|
||||||
#Multi-byte version of Write()
|
#Multi-byte version of Write()
|
||||||
cw=@current_font['cw']
|
cw=@current_font['cw']
|
||||||
w=@w-@r_margin-@x
|
w=@w-@r_margin-@x
|
||||||
|
@ -232,7 +249,7 @@ UHC_widths={' ' => 333, '!' => 416, '"' => 416, '#' => 833, '$' => 625, '%' => 9
|
||||||
ascii=(c<128)
|
ascii=(c<128)
|
||||||
if(c.chr=="\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,'',fill,link)
|
||||||
i+=1
|
i+=1
|
||||||
sep=-1
|
sep=-1
|
||||||
j=i
|
j=i
|
||||||
|
@ -265,9 +282,9 @@ UHC_widths={' ' => 333, '!' => 416, '"' => 416, '#' => 833, '$' => 625, '%' => 9
|
||||||
if(i==j)
|
if(i==j)
|
||||||
i+=ascii ? 1 : 2
|
i+=ascii ? 1 : 2
|
||||||
end
|
end
|
||||||
Cell(w,h,s[j,i-j],0,2,'',0,link)
|
Cell(w,h,s[j,i-j],0,2,'',fill,link)
|
||||||
else
|
else
|
||||||
Cell(w,h,s[j,sep-j],0,2,'',0,link)
|
Cell(w,h,s[j,sep-j],0,2,'',fill,link)
|
||||||
i=(s[sep].chr==' ') ? sep+1 : sep
|
i=(s[sep].chr==' ') ? sep+1 : sep
|
||||||
end
|
end
|
||||||
sep=-1
|
sep=-1
|
||||||
|
@ -285,7 +302,7 @@ UHC_widths={' ' => 333, '!' => 416, '"' => 416, '#' => 833, '$' => 625, '%' => 9
|
||||||
end
|
end
|
||||||
#Last chunk
|
#Last chunk
|
||||||
if(i!=j)
|
if(i!=j)
|
||||||
Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link)
|
Cell(l*@font_size/1000.0,h,s[j,i-j],0,0,'',fill,link)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue