@@ -142,15 +142,20 module PDF_Chinese | |||
|
142 | 142 | return l*@font_size/1000 |
|
143 | 143 | end |
|
144 | 144 | |
|
145 | def MultiCell(w,h,txt,border=0,align='L',fill=0) | |
|
145 | def MultiCell(w,h,txt,border=0,align='L',fill=0,ln=1) | |
|
146 | 146 | if(@current_font['type']=='Type0') |
|
147 | MBMultiCell(w,h,txt,border,align,fill) | |
|
147 | MBMultiCell(w,h,txt,border,align,fill,ln) | |
|
148 | 148 | else |
|
149 | super(w,h,txt,border,align,fill) | |
|
149 | super(w,h,txt,border,align,fill,ln) | |
|
150 | 150 | end |
|
151 | 151 | end |
|
152 | 152 | |
|
153 | def MBMultiCell(w,h,txt,border=0,align='L',fill=0) | |
|
153 | def MBMultiCell(w,h,txt,border=0,align='L',fill=0,ln=1) | |
|
154 | ||
|
155 | # save current position | |
|
156 | prevx = @x; | |
|
157 | prevy = @y; | |
|
158 | ||
|
154 | 159 | #Multi-byte version of MultiCell() |
|
155 | 160 | cw=@current_font['cw'] |
|
156 | 161 | if(w==0) |
@@ -233,18 +238,30 module PDF_Chinese | |||
|
233 | 238 | b+='B' |
|
234 | 239 | end |
|
235 | 240 | Cell(w,h,s[j,i-j],b,2,align,fill) |
|
236 | @x=@l_margin | |
|
241 | ||
|
242 | # move cursor to specified position | |
|
243 | if (ln == 1) | |
|
244 | # go to the beginning of the next line | |
|
245 | @x=@l_margin | |
|
246 | elsif (ln == 0) | |
|
247 | # go to the top-right of the cell | |
|
248 | @y = prevy; | |
|
249 | @x = prevx + w; | |
|
250 | elsif (ln == 2) | |
|
251 | # go to the bottom-left of the cell | |
|
252 | @x = prevx; | |
|
253 | end | |
|
237 | 254 | end |
|
238 | 255 | |
|
239 | def Write(h,txt,link='') | |
|
256 | def Write(h,txt,link='',fill=0) | |
|
240 | 257 | if(@current_font['type']=='Type0') |
|
241 | MBWrite(h,txt,link) | |
|
258 | MBWrite(h,txt,link,fill) | |
|
242 | 259 | else |
|
243 | super(h,txt,link) | |
|
260 | super(h,txt,link,fill) | |
|
244 | 261 | end |
|
245 | 262 | end |
|
246 | 263 | |
|
247 | def MBWrite(h,txt,link) | |
|
264 | def MBWrite(h,txt,link,fill=0) | |
|
248 | 265 | #Multi-byte version of Write() |
|
249 | 266 | cw=@current_font['cw'] |
|
250 | 267 | w=@w-@r_margin-@x |
@@ -263,7 +280,7 module PDF_Chinese | |||
|
263 | 280 | ascii=(c<128) |
|
264 | 281 | if(c.chr=="\n") |
|
265 | 282 | #Explicit line break |
|
266 |
Cell(w,h,s[j,i-j],0,2,'', |
|
|
283 | Cell(w,h,s[j,i-j],0,2,'',fill,link) | |
|
267 | 284 | i+=1 |
|
268 | 285 | sep=-1 |
|
269 | 286 | j=i |
@@ -296,9 +313,9 module PDF_Chinese | |||
|
296 | 313 | if(i==j) |
|
297 | 314 | i+=ascii ? 1 : 2 |
|
298 | 315 | end |
|
299 |
Cell(w,h,s[j,i-j],0,2,'', |
|
|
316 | Cell(w,h,s[j,i-j],0,2,'',fill,link) | |
|
300 | 317 | else |
|
301 |
Cell(w,h,s[j,sep-j],0,2,'', |
|
|
318 | Cell(w,h,s[j,sep-j],0,2,'',fill,link) | |
|
302 | 319 | i=(s[sep].chr==' ') ? sep+1 : sep |
|
303 | 320 | end |
|
304 | 321 | sep=-1 |
@@ -316,7 +333,7 module PDF_Chinese | |||
|
316 | 333 | end |
|
317 | 334 | #Last chunk |
|
318 | 335 | if(i!=j) |
|
319 |
Cell(l/1000 |
|
|
336 | Cell(l*@font_size/1000.0,h,s[j,i-j],0,0,'',fill,link) | |
|
320 | 337 | end |
|
321 | 338 | end |
|
322 | 339 |
General Comments 0
You need to be logged in to leave comments.
Login now