forked from science-ation/science-ation
Dont get stuck in an infinite loop if the text doesnt fit, just break out and forgetaboutit
This commit is contained in:
parent
16dfbc934c
commit
d4e6b63c2e
13
lpdf.php
13
lpdf.php
@ -203,7 +203,8 @@ class lpdf
|
||||
|
||||
if($nr==$prevnr)
|
||||
{
|
||||
echo "breaking because nr==prevnr ($nr==$prevnr) trying to output [$textstr] (debug: fontsize=$fontsize, lineheight=$lineheight, stringwidth=$stringwidth, left=".$this->loc(0.75).", top=".$this->loc($this->yloc).", width=".$this->loc(7).", height=$lineheight)\n";
|
||||
//Comment this out, so if it ever does happen, the PDF will still generate, it just might be missing a small blurb somewhere, better than no PDF at all
|
||||
// echo "breaking because nr==prevnr ($nr==$prevnr) trying to output [$textstr] (debug: fontsize=$fontsize, lineheight=$lineheight, stringwidth=$stringwidth, left=".$this->loc(0.75).", top=".$this->loc($this->yloc).", width=".$this->loc(7).", height=$lineheight)\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -371,12 +372,16 @@ class lpdf
|
||||
$this->loc($x), $this->loc($y),
|
||||
$this->loc($desired_width), $this->loc($desired_line_height),
|
||||
$align,'blind');
|
||||
$prevnr=$nr;
|
||||
while($nr > 0) {
|
||||
$nr=pdf_show_boxed($this->pdf, substr($text, -$nr),
|
||||
$this->loc($x), $this->loc($y),
|
||||
$this->loc($desired_width), $this->loc($desired_line_height),
|
||||
$align,'blind');
|
||||
$lines ++;
|
||||
if($nr==$prevnr) break;
|
||||
$prevnr=$nr;
|
||||
|
||||
}
|
||||
|
||||
/* Now adjust the ypos, and do it for real */
|
||||
@ -393,16 +398,16 @@ class lpdf
|
||||
$this->loc($x), $this->loc($y),
|
||||
$this->loc($desired_width), $this->loc($desired_line_height),
|
||||
$align,null);
|
||||
$prevnr=$nr;
|
||||
while($nr > 0) {
|
||||
$y -= $desired_line_height;
|
||||
$nr=pdf_show_boxed($this->pdf, substr($text, -$nr),
|
||||
$this->loc($x), $this->loc($y),
|
||||
$this->loc($desired_width), $this->loc($desired_line_height),
|
||||
$align,null);
|
||||
if($nr==$prevnr) break;
|
||||
$prevnr=$nr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function newLabel($show_box=false, $show_fairname=false, $show_logo=false)
|
||||
|
Loading…
Reference in New Issue
Block a user