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; return $this->_pdf->stringwidth($this->_pdf->utf8_to_utf16($text, ""), $fh, $size) + $delta; //*** }