@@ -118,15 +118,20 module PDF_Japanese | |||||
118 | return l*@font_size/1000 |
|
118 | return l*@font_size/1000 | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
121 | def MultiCell(w,h,txt,border=0,align='L',fill=0) |
|
121 | def MultiCell(w,h,txt,border=0,align='L',fill=0,ln=1) | |
122 | if(@current_font['type']=='Type0') |
|
122 | if(@current_font['type']=='Type0') | |
123 | SJISMultiCell(w,h,txt,border,align,fill) |
|
123 | SJISMultiCell(w,h,txt,border,align,fill,ln) | |
124 | else |
|
124 | else | |
125 | super(w,h,txt,border,align,fill) |
|
125 | super(w,h,txt,border,align,fill,ln) | |
126 | end |
|
126 | end | |
127 | end |
|
127 | end | |
128 |
|
128 | |||
129 | def SJISMultiCell(w,h,txt,border=0,align='L',fill=0) |
|
129 | def SJISMultiCell(w,h,txt,border=0,align='L',fill=0,ln=1) | |
|
130 | ||||
|
131 | # save current position | |||
|
132 | prevx = @x; | |||
|
133 | prevy = @y; | |||
|
134 | ||||
130 | #Output text with automatic or explicit line breaks |
|
135 | #Output text with automatic or explicit line breaks | |
131 | cw=@current_font['cw'] |
|
136 | cw=@current_font['cw'] | |
132 | if(w==0) |
|
137 | if(w==0) | |
@@ -221,18 +226,30 module PDF_Japanese | |||||
221 | b+='B' |
|
226 | b+='B' | |
222 | end |
|
227 | end | |
223 | Cell(w,h,s[j,i-j],b,2,align,fill) |
|
228 | Cell(w,h,s[j,i-j],b,2,align,fill) | |
224 | @x=@l_margin |
|
229 | ||
|
230 | # move cursor to specified position | |||
|
231 | if (ln == 1) | |||
|
232 | # go to the beginning of the next line | |||
|
233 | @x=@l_margin | |||
|
234 | elsif (ln == 0) | |||
|
235 | # go to the top-right of the cell | |||
|
236 | @y = prevy; | |||
|
237 | @x = prevx + w; | |||
|
238 | elsif (ln == 2) | |||
|
239 | # go to the bottom-left of the cell | |||
|
240 | @x = prevx; | |||
|
241 | end | |||
225 | end |
|
242 | end | |
226 |
|
243 | |||
227 | def Write(h,txt,link='') |
|
244 | def Write(h,txt,link='',fill=0) | |
228 | if(@current_font['type']=='Type0') |
|
245 | if(@current_font['type']=='Type0') | |
229 | SJISWrite(h,txt,link) |
|
246 | SJISWrite(h,txt,link,fill) | |
230 | else |
|
247 | else | |
231 | super(h,txt,link) |
|
248 | super(h,txt,link,fill) | |
232 | end |
|
249 | end | |
233 | end |
|
250 | end | |
234 |
|
251 | |||
235 | def SJISWrite(h,txt,link) |
|
252 | def SJISWrite(h,txt,link,fill=0) | |
236 | #SJIS version of Write() |
|
253 | #SJIS version of Write() | |
237 | cw=@current_font['cw'] |
|
254 | cw=@current_font['cw'] | |
238 | w=@w-@r_margin-@x |
|
255 | w=@w-@r_margin-@x | |
@@ -250,7 +267,7 module PDF_Japanese | |||||
250 | o=c |
|
267 | o=c | |
251 | if(o==10) |
|
268 | if(o==10) | |
252 | #Explicit line break |
|
269 | #Explicit line break | |
253 |
Cell(w,h,s[j,i-j],0,2,'', |
|
270 | Cell(w,h,s[j,i-j],0,2,'',fill,link) | |
254 | i+=1 |
|
271 | i+=1 | |
255 | sep=-1 |
|
272 | sep=-1 | |
256 | j=i |
|
273 | j=i | |
@@ -298,9 +315,9 module PDF_Japanese | |||||
298 | if(i==j) |
|
315 | if(i==j) | |
299 | i+=n |
|
316 | i+=n | |
300 | end |
|
317 | end | |
301 |
Cell(w,h,s[j,i-j],0,2,'', |
|
318 | Cell(w,h,s[j,i-j],0,2,'',fill,link) | |
302 | else |
|
319 | else | |
303 |
Cell(w,h,s[j,sep-j],0,2,'', |
|
320 | Cell(w,h,s[j,sep-j],0,2,'',fill,link) | |
304 | i=(s[sep].chr==' ') ? sep+1 : sep |
|
321 | i=(s[sep].chr==' ') ? sep+1 : sep | |
305 | end |
|
322 | end | |
306 | sep=-1 |
|
323 | sep=-1 | |
@@ -321,7 +338,7 module PDF_Japanese | |||||
321 | end |
|
338 | end | |
322 | #Last chunk |
|
339 | #Last chunk | |
323 | if(i!=j) |
|
340 | if(i!=j) | |
324 |
Cell(l/1000 |
|
341 | Cell(l*@font_size/1000.0,h,s[j,i-j],0,0,'',fill,link) | |
325 | end |
|
342 | end | |
326 | end |
|
343 | end | |
327 |
|
344 |
General Comments 0
You need to be logged in to leave comments.
Login now