return l*@font_size/1000\r
end\r
\r
- def MultiCell(w,h,txt,border=0,align='L',fill=0)\r
+ def MultiCell(w,h,txt,border=0,align='L',fill=0,ln=1)\r
if(@current_font['type']=='Type0')\r
- MBMultiCell(w,h,txt,border,align,fill)\r
+ MBMultiCell(w,h,txt,border,align,fill,ln)\r
else\r
- super(w,h,txt,border,align,fill)\r
+ super(w,h,txt,border,align,fill,ln)\r
end\r
end\r
\r
- def MBMultiCell(w,h,txt,border=0,align='L',fill=0)\r
+ def MBMultiCell(w,h,txt,border=0,align='L',fill=0,ln=1)\r
+\r
+ # save current position\r
+ prevx = @x;\r
+ prevy = @y;\r
+\r
#Multi-byte version of MultiCell()\r
cw=@current_font['cw']\r
if(w==0)\r
b+='B'\r
end\r
Cell(w,h,s[j,i-j],b,2,align,fill)\r
- @x=@l_margin\r
+\r
+ # move cursor to specified position\r
+ if (ln == 1)\r
+ # go to the beginning of the next line\r
+ @x=@l_margin\r
+ elsif (ln == 0)\r
+ # go to the top-right of the cell\r
+ @y = prevy;\r
+ @x = prevx + w;\r
+ elsif (ln == 2)\r
+ # go to the bottom-left of the cell\r
+ @x = prevx;\r
+ end\r
end\r
\r
- def Write(h,txt,link='')\r
+ def Write(h,txt,link='',fill=0)\r
if(@current_font['type']=='Type0')\r
- MBWrite(h,txt,link)\r
+ MBWrite(h,txt,link,fill)\r
else\r
- super(h,txt,link)\r
+ super(h,txt,link,fill)\r
end\r
end\r
\r
- def MBWrite(h,txt,link)\r
+ def MBWrite(h,txt,link,fill=0)\r
#Multi-byte version of Write()\r
cw=@current_font['cw']\r
w=@w-@r_margin-@x\r
ascii=(c<128)\r
if(c.chr=="\n")\r
#Explicit line break\r
- Cell(w,h,s[j,i-j],0,2,'',0,link)\r
+ Cell(w,h,s[j,i-j],0,2,'',fill,link)\r
i+=1\r
sep=-1\r
j=i\r
if(i==j)\r
i+=ascii ? 1 : 2\r
end\r
- Cell(w,h,s[j,i-j],0,2,'',0,link)\r
+ Cell(w,h,s[j,i-j],0,2,'',fill,link)\r
else\r
- Cell(w,h,s[j,sep-j],0,2,'',0,link)\r
+ Cell(w,h,s[j,sep-j],0,2,'',fill,link)\r
i=(s[sep].chr==' ') ? sep+1 : sep\r
end\r
sep=-1\r
end\r
#Last chunk\r
if(i!=j)\r
- Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link)\r
+ Cell(l*@font_size/1000.0,h,s[j,i-j],0,0,'',fill,link)\r
end\r
end\r
\r