From: <ex...@us...> - 2016-09-24 10:23:38
|
Revision: 7629 http://sourceforge.net/p/web-erp/reponame/7629 Author: exsonqu Date: 2016-09-24 10:23:35 +0000 (Sat, 24 Sep 2016) Log Message: ----------- 24/09/16 Exson: Fixed the AddTextWrap missing characters errors when there is space and make it more reliable. Modified Paths: -------------- trunk/includes/class.pdf.php Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2016-09-21 16:14:21 UTC (rev 7628) +++ trunk/includes/class.pdf.php 2016-09-24 10:23:35 UTC (rev 7629) @@ -120,7 +120,7 @@ $s=str_replace("\r",'',$Text); $s=str_replace("\n",' ',$s); $s = trim($s).' '; - $nb=mb_strlen($s); + $nb=mb_strlen($s,'UTF-8'); $b=0; if ($border) { if ($border==1) { @@ -129,13 +129,13 @@ $b2='LR'; } else { $b2=''; - if(is_int(mb_strpos($border,'L'))) { + if(is_int(mb_strpos($border,'L',0,'UTF-8'))) { $b2.='L'; } - if(is_int(mb_strpos($border,'R'))) { + if(is_int(mb_strpos($border,'R',0,'UTF-8'))) { $b2.='R'; } - $b=is_int(mb_strpos($border,'T')) ? $b2.'T' : $b2; + $b=is_int(mb_strpos($border,'T',0,'UTF-8')) ? $b2.'T' : $b2; } } $sep=-1; @@ -146,7 +146,7 @@ while($i<$nb) { /*$c=$s{$i};*/ $c=mb_substr($s, $i, 1, 'UTF-8'); - if($c==' ' AND $i>0) { + if($c===' ' AND $i>0) { $sep=$i; $ls=$l; $ns++; @@ -169,17 +169,17 @@ $this->ws=0; $this->_out('0 Tw'); } - $sep = $i; } else { if($Align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } } + $sep = $i; $this->Cell($Width,$Height,mb_substr($s,0,$sep,'UTF-8'),$b,2,$Align,$fill); $this->x=$this->lMargin; - return mb_substr($s, $sep,null,'UTF-8'); + return mb_substr($s, $sep,$nb-$sep,'UTF-8'); }// End function addTextWrap. function addInfo($label, $value) { |