本文整理匯總了PHP中Cpdf::getTextWidth方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cpdf::getTextWidth方法的具體用法?PHP Cpdf::getTextWidth怎麽用?PHP Cpdf::getTextWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cpdf
的用法示例。
在下文中一共展示了Cpdf::getTextWidth方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function get_text_width($text, $font, $size, $word_spacing = 0, $char_spacing = 0)
{
$this->_pdf->selectFont($font);
if (!DOMPDF_UNICODE_ENABLED) {
$text = mb_convert_encoding($text, 'Windows-1252', 'UTF-8');
}
return $this->_pdf->getTextWidth($size, $text, $word_spacing, $char_spacing);
}
示例2:
function get_text_width($text, $font, $size, $spacing = 0)
{
$this->_pdf->selectFont($font);
$ascii = utf8_decode($text);
// // Hack for
// $ascii = str_replace("\xA0", " ", $ascii);
return $this->_pdf->getTextWidth($size, $ascii, $spacing);
}
示例3:
function get_text_width($text, $font, $size, $word_spacing = 0, $char_spacing = 0)
{
$this->_pdf->selectFont($font);
$unicode = $this->_dompdf->get_option("enable_unicode");
if (!$unicode) {
$text = mb_convert_encoding($text, 'Windows-1252', 'UTF-8');
}
return $this->_pdf->getTextWidth($size, $text, $word_spacing, $char_spacing);
}
示例4: measureText
public function measureText($text)
{
if (self::DEBUG) {
echo __FUNCTION__ . "\n";
}
$style = $this->getStyle();
$this->getFont($style->fontFamily, $style->fontStyle);
return $this->canvas->getTextWidth($this->getStyle()->fontSize, $text);
}
示例5:
function get_text_width($text, $font, $size, $spacing = 0)
{
$this->_pdf->selectFont($font);
return $this->_pdf->getTextWidth($size, utf8_decode($text), $spacing);
}
示例6:
function get_text_width($text, $font, $size, $word_spacing = 0, $char_spacing = 0)
{
$this->_pdf->selectFont($font);
return $this->_pdf->getTextWidth($size, $text, $word_spacing, $char_spacing);
}