Project

General

Profile

Feature #69 » japanese.rb_r6129.patch

Jun NAITOH, 2011-06-29 16:43

View differences:

vendor/plugins/rfpdf/lib/fpdf/japanese.rb (working copy)
118 118
  	return l*@font_size/1000
119 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 122
  	if(@current_font['type']=='Type0')
123
  		SJISMultiCell(w,h,txt,border,align,fill)
123
  		SJISMultiCell(w,h,txt,border,align,fill,ln)
124 124
  	else
125
  		super(w,h,txt,border,align,fill)
125
  		super(w,h,txt,border,align,fill,ln)
126 126
  	end  
127 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 135
  	#Output text with automatic or explicit line breaks
131 136
  	cw=@current_font['cw']
132 137
  	if(w==0)
......
221 226
  		b+='B'
222 227
  	end  
223 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 242
  end
226 243

  
227
  def Write(h,txt,link='')
244
  def Write(h,txt,link='',fill=0)
228 245
  	if(@current_font['type']=='Type0')
229
 		SJISWrite(h,txt,link)
246
 		SJISWrite(h,txt,link,fill)
230 247
 	else
231
 		super(h,txt,link)
248
 		super(h,txt,link,fill)
232 249
  	end  
233 250
  end
234 251

  
235
  def SJISWrite(h,txt,link)
252
  def SJISWrite(h,txt,link,fill=0)
236 253
  	#SJIS version of Write()
237 254
  	cw=@current_font['cw']
238 255
  	w=@w-@r_margin-@x
......
250 267
  		o=c
251 268
  		if(o==10)
252 269
  			#Explicit line break
253
  			Cell(w,h,s[j,i-j],0,2,'',0,link)
270
  			Cell(w,h,s[j,i-j],0,2,'',fill,link)
254 271
  			i+=1
255 272
  			sep=-1
256 273
  			j=i
......
298 315
  				if(i==j)
299 316
  					i+=n
300 317
        	end  
301
  				Cell(w,h,s[j,i-j],0,2,'',0,link)
318
  				Cell(w,h,s[j,i-j],0,2,'',fill,link)
302 319
  			else
303
  				Cell(w,h,s[j,sep-j],0,2,'',0,link)
320
  				Cell(w,h,s[j,sep-j],0,2,'',fill,link)
304 321
  				i=(s[sep].chr==' ') ? sep+1 : sep
305 322
  			end
306 323
  			sep=-1
......
321 338
  	end
322 339
  	#Last chunk
323 340
  	if(i!=j)
324
  		Cell(l/1000*@font_size,h,s[j,i-j],0,0,'',0,link)
341
  		Cell(l*@font_size/1000.0,h,s[j,i-j],0,0,'',fill,link)
325 342
  	end  
326 343
  end
327 344
  
(6-6/9)