diff --git a/lpdf.php b/lpdf.php index bcea2b3..eaac41c 100644 --- a/lpdf.php +++ b/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;