Ejemplo n.º 1
0
 function get_text_width($text, $font, $size, $spacing = 0)
 {
     $fh = $this->_load_font($font);
     // Determine the additional width due to extra spacing
     $num_spaces = mb_substr_count($text, " ");
     $delta = $spacing * $num_spaces;
     return $this->_pdf->stringwidth($text, $fh, $size) + $delta;
 }
Ejemplo n.º 2
0
 function get_text_width($text, $font, $size, $word_spacing = 0, $letter_spacing = 0)
 {
     $fh = $this->_load_font($font);
     // Determine the additional width due to extra spacing
     $num_spaces = mb_substr_count($text, " ");
     $delta = $word_spacing * $num_spaces;
     if ($letter_spacing) {
         $num_chars = mb_strlen($text);
         $delta += ($num_chars - $num_spaces) * $letter_spacing;
     }
     return $this->_pdf->stringwidth($text, $fh, $size) + $delta;
 }