本文整理汇总了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);
}