forked from science-ation/science-ation
Switch heading() to use addText() so it implements line-wrapping for super-long headings
This commit is contained in:
parent
a7dad33da3
commit
a7da608982
8
lpdf.php
8
lpdf.php
@ -165,12 +165,12 @@ class lpdf
|
||||
}
|
||||
|
||||
|
||||
function addText($text,$align="left", $xloc=0)
|
||||
function addText($text,$align="left", $xloc=0, $displayfont="normalfont")
|
||||
{
|
||||
$fontsize=pdf_get_value($this->pdf,"fontsize",0);
|
||||
$lineheight=ceil($fontsize*1.3);
|
||||
//the line height should be 1.2 * fontsize (approx)
|
||||
$stringwidth=pdf_stringwidth($this->pdf,$text,$this->normalfont,$fontsize);
|
||||
$stringwidth=pdf_stringwidth($this->pdf,$text,$this->$displayfont,$fontsize);
|
||||
|
||||
$textstr=$text;
|
||||
|
||||
@ -558,9 +558,7 @@ class lpdf
|
||||
$this->newPage();
|
||||
|
||||
pdf_setfont($this->pdf,$this->headerfont,12);
|
||||
//move down the full line height
|
||||
$this->yloc-=12/72;
|
||||
pdf_show_xy($this->pdf,$text,$this->loc($this->page_margin),$this->loc($this->yloc));
|
||||
$this->addText($text,"left",0,"headerfont");
|
||||
pdf_setfont($this->pdf,$this->normalfont,$this->currentFontSize);
|
||||
//now leave some space under the heading (4 is 1/3 of 12, so 1/3 of the line height we leave)
|
||||
$this->yloc-=4/72;
|
||||
|
Loading…
Reference in New Issue
Block a user