本文整理汇总了PHP中TCPDF_FONTS::getFontFullPath方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_FONTS::getFontFullPath方法的具体用法?PHP TCPDF_FONTS::getFontFullPath怎么用?PHP TCPDF_FONTS::getFontFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF_FONTS
的用法示例。
在下文中一共展示了TCPDF_FONTS::getFontFullPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _puttruetypeunicode
/**
* Adds unicode fonts.<br>
* Based on PDF Reference 1.3 (section 5)
* @param $font (array) font data
* @protected
* @author Nicola Asuni
* @since 1.52.0.TC005 (2005-01-05)
*/
protected function _puttruetypeunicode($font)
{
$fontname = '';
if ($font['subset']) {
// change name for font subsetting
$subtag = sprintf('%06u', $font['i']);
$subtag = strtr($subtag, '0123456789', 'ABCDEFGHIJ');
$fontname .= $subtag . '+';
}
$fontname .= $font['name'];
// Type0 Font
// A composite font composed of other fonts, organized hierarchically
$out = $this->_getobj($this->font_obj_ids[$font['fontkey']]) . "\n";
$out .= '<< /Type /Font';
$out .= ' /Subtype /Type0';
$out .= ' /BaseFont /' . $fontname;
$out .= ' /Name /F' . $font['i'];
$out .= ' /Encoding /' . $font['enc'];
$out .= ' /ToUnicode ' . ($this->n + 1) . ' 0 R';
$out .= ' /DescendantFonts [' . ($this->n + 2) . ' 0 R]';
$out .= ' >>';
$out .= "\n" . 'endobj';
$this->_out($out);
// ToUnicode map for Identity-H
$stream = TCPDF_FONT_DATA::$uni_identity_h;
// ToUnicode Object
$this->_newobj();
$stream = $this->compress ? gzcompress($stream) : $stream;
$filter = $this->compress ? '/Filter /FlateDecode ' : '';
$stream = $this->_getrawstream($stream);
$this->_out('<<' . $filter . '/Length ' . strlen($stream) . '>> stream' . "\n" . $stream . "\n" . 'endstream' . "\n" . 'endobj');
// CIDFontType2
// A CIDFont whose glyph descriptions are based on TrueType font technology
$oid = $this->_newobj();
$out = '<< /Type /Font';
$out .= ' /Subtype /CIDFontType2';
$out .= ' /BaseFont /' . $fontname;
// A dictionary containing entries that define the character collection of the CIDFont.
$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'];
// default width
$out .= "\n" . TCPDF_FONTS::_putfontwidths($font, 0);
if (isset($font['ctg']) and !TCPDF_STATIC::empty_string($font['ctg'])) {
$out .= "\n" . '/CIDToGIDMap ' . ($this->n + 2) . ' 0 R';
}
$out .= ' >>';
$out .= "\n" . 'endobj';
$this->_out($out);
// Font descriptor
// A font descriptor describing the CIDFont default metrics other than its glyph widths
$this->_newobj();
$out = '<< /Type /FontDescriptor';
$out .= ' /FontName /' . $fontname;
foreach ($font['desc'] as $key => $value) {
if (is_float($value)) {
$value = sprintf('%F', $value);
}
$out .= ' /' . $key . ' ' . $value;
}
$fontdir = false;
if (!TCPDF_STATIC::empty_string($font['file'])) {
// A stream containing a TrueType font
$out .= ' /FontFile2 ' . $this->FontFiles[$font['file']]['n'] . ' 0 R';
$fontdir = $this->FontFiles[$font['file']]['fontdir'];
}
$out .= ' >>';
$out .= "\n" . 'endobj';
$this->_out($out);
if (isset($font['ctg']) and !TCPDF_STATIC::empty_string($font['ctg'])) {
$this->_newobj();
// Embed CIDToGIDMap
// A specification of the mapping from CIDs to glyph indices
// search and get CTG font file to embedd
$ctgfile = strtolower($font['ctg']);
// search and get ctg font file to embedd
$fontfile = TCPDF_FONTS::getFontFullPath($ctgfile, $fontdir);
if (TCPDF_STATIC::empty_string($fontfile)) {
$this->Error('Font file not found: ' . $ctgfile);
}
$stream = $this->_getrawstream(file_get_contents($fontfile));
$out = '<< /Length ' . strlen($stream) . '';
if (substr($fontfile, -2) == '.z') {
// check file extension
// Decompresses data encoded using the public-domain
// zlib/deflate compression method, reproducing the
// original text or binary data
$out .= ' /Filter /FlateDecode';
}
//.........这里部分代码省略.........