Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Parsed.php
Go to the documentation of this file.
1 <?php
25 #require_once 'Zend/Pdf/Element/Array.php';
26 #require_once 'Zend/Pdf/Element/Name.php';
27 #require_once 'Zend/Pdf/Element/Numeric.php';
28 
29 
31 #require_once 'Zend/Pdf/Resource/Font/Simple.php';
32 
44 {
51  public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser)
52  {
53  parent::__construct();
54 
55 
56  $fontParser->parse();
57 
58  /* Object properties */
59 
60  $this->_fontNames = $fontParser->names;
61 
62  $this->_isBold = $fontParser->isBold;
63  $this->_isItalic = $fontParser->isItalic;
64  $this->_isMonospaced = $fontParser->isMonospaced;
65 
66  $this->_underlinePosition = $fontParser->underlinePosition;
67  $this->_underlineThickness = $fontParser->underlineThickness;
68  $this->_strikePosition = $fontParser->strikePosition;
69  $this->_strikeThickness = $fontParser->strikeThickness;
70 
71  $this->_unitsPerEm = $fontParser->unitsPerEm;
72 
73  $this->_ascent = $fontParser->ascent;
74  $this->_descent = $fontParser->descent;
75  $this->_lineGap = $fontParser->lineGap;
76 
77  $this->_glyphWidths = $fontParser->glyphWidths;
78  $this->_missingGlyphWidth = $this->_glyphWidths[0];
79 
80 
81  $this->_cmap = $fontParser->cmap;
82 
83 
84  /* Resource dictionary */
85 
86  $baseFont = $this->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8');
87  $this->_resource->BaseFont = new Zend_Pdf_Element_Name($baseFont);
88 
89  $this->_resource->FirstChar = new Zend_Pdf_Element_Numeric(0);
90  $this->_resource->LastChar = new Zend_Pdf_Element_Numeric(count($this->_glyphWidths) - 1);
91 
92  /* Now convert the scalar glyph widths to Zend_Pdf_Element_Numeric objects.
93  */
94  $pdfWidths = array();
95  foreach ($this->_glyphWidths as $width) {
96  $pdfWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($width));
97  }
98  /* Create the Zend_Pdf_Element_Array object and add it to the font's
99  * object factory and resource dictionary.
100  */
101  $widthsArrayElement = new Zend_Pdf_Element_Array($pdfWidths);
102  $widthsObject = $this->_objectFactory->newObject($widthsArrayElement);
103  $this->_resource->Widths = $widthsObject;
104  }
105 }
getFontName($nameType, $language, $characterSet=null)
Definition: Font.php:224
const NAME_POSTSCRIPT
Definition: Font.php:224
__construct(Zend_Pdf_FileParser_Font_OpenType $fontParser)
Definition: Parsed.php:51