protected function createFontObjects()
{
if ($this->font instanceof \Pop\Font\Type1) {
$fontType = 'Type1';
$fontName = $this->font->info->postscriptName;
$fontFile = 'FontFile';
$glyphWidths = array('encoding' => 'StandardEncoding', 'widths' => $this->font->glyphWidths);
$unCompStream = $this->font->fontData;
$length1 = $this->font->length1;
$length2 = " /Length2 " . $this->font->length2 . " /Length3 0";
} else {
$fontType = 'TrueType';
$fontName = $this->font->tables['name']->postscriptName;
$fontFile = 'FontFile2';
$glyphWidths = $this->getGlyphWidths($this->font->tables['cmap']);
$unCompStream = $this->font->read();
$length1 = strlen($unCompStream);
$length2 = null;
}
$this->objects[$this->objectIndex] = new Object("{$this->objectIndex} 0 obj\n<<\n /Type /Font\n /Subtype /{$fontType}\n /FontDescriptor {$this->fontDescIndex} 0 R\n /Name /TT{$this->fontIndex}\n /BaseFont /" . $fontName . "\n /FirstChar 32\n /LastChar 255\n /Widths [" . implode(' ', $glyphWidths['widths']) . "]\n /Encoding /" . $glyphWidths['encoding'] . "\n>>\nendobj\n\n");
$bBox = '[' . $this->font->bBox->xMin . ' ' . $this->font->bBox->yMin . ' ' . $this->font->bBox->xMax . ' ' . $this->font->bBox->yMax . ']';
$compStream = function_exists('gzcompress') ? gzcompress($unCompStream, 9) : null;
if ($this->compress) {
$fontFileObj = "{$this->fontFileIndex} 0 obj\n<</Length " . strlen($compStream) . " /Filter /FlateDecode /Length1 " . $length1 . $length2 . ">>\nstream\n" . $compStream . "\nendstream\nendobj\n\n";
} else {
$fontFileObj = "{$this->fontFileIndex} 0 obj\n<</Length " . strlen($unCompStream) . " /Length1 " . $length1 . $length2 . ">>\nstream\n" . $unCompStream . "\nendstream\nendobj\n\n";
}
$this->objects[$this->fontDescIndex] = new Object("{$this->fontDescIndex} 0 obj\n<<\n /Type /FontDescriptor\n /FontName /" . $fontName . "\n /{$fontFile} {$this->fontFileIndex} 0 R\n /MissingWidth {$this->font->missingWidth}\n /StemV {$this->font->stemV}\n /Flags " . $this->font->calcFlags() . "\n /FontBBox {$bBox}\n /Descent {$this->font->descent}\n /Ascent {$this->font->ascent}\n /CapHeight {$this->font->capHeight}\n /ItalicAngle {$this->font->italicAngle}\n>>\nendobj\n\n");
$this->objects[$this->fontFileIndex] = new Object($fontFileObj);
}