xt,$link); else parent::Write($h,$txt,$link); }
function MBWrite($h,$txt,$link) { //Multi-byte version of Write() $cw=&$this->CurrentFont['cw']; $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); $nb=strlen($s); $sep=-1; $i=0; $j=0; $l=0; $nl=1; while($i<$nb) { //Get next character $c=$s[$i]; //Check if ASCII or MB $ascii=(ord($c)<128); if($c=="\n" { //Explicit line break $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); $i++; $sep=-1; $j=$i; $l=0; if($nl==1) { $this->x=$this->lMargin; $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; } $nl++; continue; } if(!$ascii or $c==' ') $sep=$i; $l+=$ascii ? $cw[$c] : 1000; if($l>$wmax) { //Automatic line break if($sep==-1 or $i==$j) { if($this->x>$this->lMargin) { //Move to next line $this->x=$this->lMargin; $this->y+=$h; $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $i++; $nl++; continue; } if($i==$j) $i+=$ascii ? 1 : 2; $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); } else { $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); $i=($s[$sep]==' ') ? $sep+1 : $sep; } $sep=-1; $j=$i; $l=0; if($nl==1) { $this->x=$this->lMargin; $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; } $nl++; } else $i+=$ascii ? 1 : 2; } //Last chunk if($i!=$j) $this->Cell($l/1000*$this-> 上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页 |