*** mbfpdf.php.orig 2003-10-08 00:07:23.000000000 +0900 --- mbfpdf.php 2004-02-06 03:26:22.000000000 +0900 *************** *** 96,101 **** --- 96,102 ---- //Multi-byte version of GetStringWidth() $l=0; $cw=&$this->CurrentFont['cw']; + $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1'); $nb=strlen($s); $i=0; while($i<$nb) *************** *** 108,114 **** } else { ! $l+=1000; $i+=2; } } --- 109,116 ---- } else { ! $hwkana = ($japanese && ord($c)==142); ! $l+=$hwkana ? 500 : 1000; $i+=2; } } *************** *** 228,233 **** --- 230,236 ---- { //Multi-byte version of MultiCell() $cw=&$this->CurrentFont['cw']; + $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1'); if($w==0) $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; *************** *** 260,271 **** --- 263,277 ---- $l=0; $ns=0; $nl=1; + $ascii=true; while($i<$nb) { //Get next character $c=$s[$i]; //Check if ASCII or MB + $prev_ascii=$ascii; $ascii=(ord($c)<128); + $hwkana = ($japanese && ord($c)==142); if($c=="\n") { //Explicit line break *************** *** 285,291 **** $b=$b2; continue; } ! if(!$ascii) { $sep=$i; $ls=$l; --- 291,297 ---- $b=$b2; continue; } ! if(!($ascii && $prev_ascii) && $i != $j) { $sep=$i; $ls=$l; *************** *** 296,306 **** $ls=$l; $ns++; } ! $l+=$ascii ? $cw[$c] : 1000; if($l>$wmax) { //Automatic line break ! if($sep==-1 or $i==$j) { if($i==$j) $i+=$ascii ? 1 : 2; --- 302,312 ---- $ls=$l; $ns++; } ! $l+=$ascii ? $cw[$c] : $hwkana ? 500 : 1000; if($l>$wmax) { //Automatic line break ! if($sep==-1) { if($i==$j) $i+=$ascii ? 1 : 2; *************** *** 363,368 **** --- 369,375 ---- { //Multi-byte version of Write() $cw=&$this->CurrentFont['cw']; + $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1'); $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); *************** *** 378,383 **** --- 385,391 ---- $c=$s[$i]; //Check if ASCII or MB $ascii=(ord($c)<128); + $hwkana = ($japanese && ord($c)==142); if($c=="\n") { //Explicit line break *************** *** 397,403 **** } if(!$ascii or $c==' ') $sep=$i; ! $l+=$ascii ? $cw[$c] : 1000; if($l>$wmax) { //Automatic line break --- 405,411 ---- } if(!$ascii or $c==' ') $sep=$i; ! $l+=$ascii ? $cw[$c] : $hwkana ? 500 : 1000; if($l>$wmax) { //Automatic line break *************** *** 558,564 **** $W='/W [1 ['; foreach($font['cw'] as $w) $W.=$w.' '; ! $this->_out($W.']]'); $this->_out('>>'); $this->_out('endobj'); //Font descriptor --- 566,575 ---- $W='/W [1 ['; foreach($font['cw'] as $w) $W.=$w.' '; ! $this->_out($W.']'); ! if($font['registry']['ordering'] == 'Japan1') ! $this->_out(' 231 325 500 631 [500] 326 389 500'); ! $this->_out(']'); $this->_out('>>'); $this->_out('endobj'); //Font descriptor