111 |
111 |
return l*@font_size/1000
|
112 |
112 |
end
|
113 |
113 |
|
114 |
|
def MultiCell(w,h,txt,border=0,align='L',fill=0)
|
|
114 |
def MultiCell(w,h,txt,border=0,align='L',fill=0,ln=1)
|
115 |
115 |
if(@current_font['type']=='Type0')
|
116 |
|
MBMultiCell(w,h,txt,border,align,fill)
|
|
116 |
MBMultiCell(w,h,txt,border,align,fill,ln)
|
117 |
117 |
else
|
118 |
|
super(w,h,txt,border,align,fill)
|
|
118 |
super(w,h,txt,border,align,fill,ln)
|
119 |
119 |
end
|
120 |
120 |
end
|
121 |
121 |
|
122 |
|
def MBMultiCell(w,h,txt,border=0,align='L',fill=0)
|
|
122 |
def MBMultiCell(w,h,txt,border=0,align='L',fill=0,ln=1)
|
|
123 |
|
|
124 |
# save current position
|
|
125 |
prevx = @x;
|
|
126 |
prevy = @y;
|
|
127 |
|
123 |
128 |
#Multi-byte version of MultiCell()
|
124 |
129 |
cw=@current_font['cw']
|
125 |
130 |
if(w==0)
|
... | ... | |
202 |
207 |
b+='B'
|
203 |
208 |
end
|
204 |
209 |
Cell(w,h,s[j,i-j],b,2,align,fill)
|
205 |
|
@x=@l_margin
|
|
210 |
|
|
211 |
# move cursor to specified position
|
|
212 |
if (ln == 1)
|
|
213 |
# go to the beginning of the next line
|
|
214 |
@x=@l_margin
|
|
215 |
elsif (ln == 0)
|
|
216 |
# go to the top-right of the cell
|
|
217 |
@y = prevy;
|
|
218 |
@x = prevx + w;
|
|
219 |
elsif (ln == 2)
|
|
220 |
# go to the bottom-left of the cell
|
|
221 |
@x = prevx;
|
|
222 |
end
|
206 |
223 |
end
|
207 |
224 |
|
208 |
|
def Write(h,txt,link='')
|
|
225 |
def Write(h,txt,link='',fill=0)
|
209 |
226 |
if(@current_font['type']=='Type0')
|
210 |
|
MBWrite(h,txt,link)
|
|
227 |
MBWrite(h,txt,link,fill)
|
211 |
228 |
else
|
212 |
|
super(h,txt,link)
|
|
229 |
super(h,txt,link,fill)
|
213 |
230 |
end
|
214 |
231 |
end
|
215 |
232 |
|
216 |
|
def MBWrite(h,txt,link)
|
|
233 |
def MBWrite(h,txt,link,fill=0)
|
217 |
234 |
#Multi-byte version of Write()
|
218 |
235 |
cw=@current_font['cw']
|
219 |
236 |
w=@w-@r_margin-@x
|
... | ... | |
232 |
249 |
ascii=(c<128)
|
233 |
250 |
if(c.chr=="\n")
|
234 |
251 |
#Explicit line break
|
235 |
|
Cell(w,h,s[j,i-j],0,2,'',0,link)
|
|
252 |
Cell(w,h,s[j,i-j],0,2,'',fill,link)
|
236 |
253 |
i+=1
|
237 |
254 |
sep=-1
|
238 |
255 |
j=i
|
... | ... | |
265 |
282 |
if(i==j)
|
266 |
283 |
i+=ascii ? 1 : 2
|
267 |
284 |
end
|
268 |
|
Cell(w,h,s[j,i-j],0,2,'',0,link)
|
|
285 |
Cell(w,h,s[j,i-j],0,2,'',fill,link)
|
269 |
286 |
else
|
270 |
|
Cell(w,h,s[j,sep-j],0,2,'',0,link)
|
|
287 |
Cell(w,h,s[j,sep-j],0,2,'',fill,link)
|
271 |
288 |
i=(s[sep].chr==' ') ? sep+1 : sep
|
272 |
289 |
end
|
273 |
290 |
sep=-1
|
... | ... | |
285 |
302 |
end
|
286 |
303 |
#Last chunk
|
287 |
304 |
if(i!=j)
|
288 |
|
Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link)
|
|
305 |
Cell(l*@font_size/1000.0,h,s[j,i-j],0,0,'',fill,link)
|
289 |
306 |
end
|
290 |
307 |
end
|
291 |
308 |
|