From 52e7a6500a64d30ffc78fb72bb263b6718caff22 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 24 Mar 2008 18:45:51 +0000 Subject: [PATCH] - Add a convenience stringwidth funciton --- lpdf.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lpdf.php b/lpdf.php index a2ef6b0..11e79fa 100644 --- a/lpdf.php +++ b/lpdf.php @@ -512,6 +512,13 @@ class lpdf pdf_show_xy($this->pdf,$text,$this->loc($xpos),$this->loc($this->yloc)); } + function stringWidth($text, $font=null, $size=null) + { + if($size == null) $size = pdf_get_value($this->pdf,"fontsize",0); + if($font == null) $font = $this->normalfont; + return pdf_stringwidth($this->pdf, $text, $font, $size); + } + function nextLine() { $fontsize=pdf_get_value($this->pdf,"fontsize",0);