本文整理汇总了PHP中TCPDF_FONTS::_putfontwidths方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_FONTS::_putfontwidths方法的具体用法?PHP TCPDF_FONTS::_putfontwidths怎么用?PHP TCPDF_FONTS::_putfontwidths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF_FONTS
的用法示例。
在下文中一共展示了TCPDF_FONTS::_putfontwidths方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _putcidfont0
/**
* Output CID-0 fonts.
* A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format
* @param $font (array) font data
* @protected
* @author Andrew Whitehead, Nicola Asuni, Yukihiro Nakadaira
* @since 3.2.000 (2008-06-23)
*/
protected function _putcidfont0($font)
{
$cidoffset = 0;
if (!isset($font['cw'][1])) {
$cidoffset = 31;
}
if (isset($font['cidinfo']['uni2cid'])) {
// convert unicode to cid.
$uni2cid = $font['cidinfo']['uni2cid'];
$cw = array();
foreach ($font['cw'] as $uni => $width) {
if (isset($uni2cid[$uni])) {
$cw[$uni2cid[$uni] + $cidoffset] = $width;
} elseif ($uni < 256) {
$cw[$uni] = $width;
}
// else unknown character
}
$font = array_merge($font, array('cw' => $cw));
}
$name = $font['name'];
$enc = $font['enc'];
if ($enc) {
$longname = $name . '-' . $enc;
} else {
$longname = $name;
}
$out = $this->_getobj($this->font_obj_ids[$font['fontkey']]) . "\n";
$out .= '<</Type /Font';
$out .= ' /Subtype /Type0';
$out .= ' /BaseFont /' . $longname;
$out .= ' /Name /F' . $font['i'];
if ($enc) {
$out .= ' /Encoding /' . $enc;
}
$out .= ' /DescendantFonts [' . ($this->n + 1) . ' 0 R]';
$out .= ' >>';
$out .= "\n" . 'endobj';
$this->_out($out);
$oid = $this->_newobj();
$out = '<</Type /Font';
$out .= ' /Subtype /CIDFontType0';
$out .= ' /BaseFont /' . $name;
$cidinfo = '/Registry ' . $this->_datastring($font['cidinfo']['Registry'], $oid);
$cidinfo .= ' /Ordering ' . $this->_datastring($font['cidinfo']['Ordering'], $oid);
$cidinfo .= ' /Supplement ' . $font['cidinfo']['Supplement'];
$out .= ' /CIDSystemInfo <<' . $cidinfo . '>>';
$out .= ' /FontDescriptor ' . ($this->n + 1) . ' 0 R';
$out .= ' /DW ' . $font['dw'];
$out .= "\n" . TCPDF_FONTS::_putfontwidths($font, $cidoffset);
$out .= ' >>';
$out .= "\n" . 'endobj';
$this->_out($out);
$this->_newobj();
$s = '<</Type /FontDescriptor /FontName /' . $name;
foreach ($font['desc'] as $k => $v) {
if ($k != 'Style') {
if (is_float($v)) {
$v = sprintf('%F', $v);
}
$s .= ' /' . $k . ' ' . $v . '';
}
}
$s .= '>>';
$s .= "\n" . 'endobj';
$this->_out($s);
}