Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Style.php
Go to the documentation of this file.
1 <?php
34 {
41  private $_fillColor = null;
42 
50  private $_color;
51 
57  private $_lineWidth;
58 
66  private $_lineDashingPattern;
67 
73  private $_lineDashingPhase;
74 
80  private $_font;
81 
87  private $_fontSize;
88 
89 
90 
96  public function __construct($anotherStyle = null)
97  {
98  if ($anotherStyle !== null) {
99  $this->_fillColor = $anotherStyle->_fillColor;
100  $this->_color = $anotherStyle->_color;
101  $this->_lineWidth = $anotherStyle->_lineWidth;
102  $this->_lineDashingPattern = $anotherStyle->_lineDashingPattern;
103  $this->_lineDashingPhase = $anotherStyle->_lineDashingPhase;
104  $this->_font = $anotherStyle->_font;
105  $this->_fontSize = $anotherStyle->_fontSize;
106  }
107  }
108 
109 
115  public function setFillColor(Zend_Pdf_Color $color)
116  {
117  $this->_fillColor = $color;
118  }
119 
125  public function setLineColor(Zend_Pdf_Color $color)
126  {
127  $this->_color = $color;
128  }
129 
135  public function setLineWidth($width)
136  {
137  #require_once 'Zend/Pdf/Element/Numeric.php';
138  $this->_lineWidth = new Zend_Pdf_Element_Numeric($width);
139  }
140 
141 
148  public function setLineDashingPattern($pattern, $phase = 0)
149  {
150  #require_once 'Zend/Pdf/Page.php';
152  $pattern = array();
153  $phase = 0;
154  }
155 
156  #require_once 'Zend/Pdf/Element/Numeric.php';
157  $this->_lineDashingPattern = $pattern;
158  $this->_lineDashingPhase = new Zend_Pdf_Element_Numeric($phase);
159  }
160 
161 
168  public function setFont(Zend_Pdf_Resource_Font $font, $fontSize)
169  {
170  $this->_font = $font;
171  $this->_fontSize = $fontSize;
172  }
173 
179  public function setFontSize($fontSize)
180  {
181  $this->_fontSize = $fontSize;
182  }
183 
189  public function getFillColor()
190  {
191  return $this->_fillColor;
192  }
193 
199  public function getLineColor()
200  {
201  return $this->_color;
202  }
203 
209  public function getLineWidth()
210  {
211  return $this->_lineWidth->value;
212  }
213 
219  public function getLineDashingPattern()
220  {
221  return $this->_lineDashingPattern;
222  }
223 
224 
230  public function getFont()
231  {
232  return $this->_font;
233  }
234 
240  public function getFontSize()
241  {
242  return $this->_fontSize;
243  }
244 
250  public function getLineDashingPhase()
251  {
252  return $this->_lineDashingPhase->value;
253  }
254 
255 
261  public function instructions()
262  {
263  $instructions = '';
264 
265  if ($this->_fillColor !== null) {
266  $instructions .= $this->_fillColor->instructions(false);
267  }
268 
269  if ($this->_color !== null) {
270  $instructions .= $this->_color->instructions(true);
271  }
272 
273  if ($this->_lineWidth !== null) {
274  $instructions .= $this->_lineWidth->toString() . " w\n";
275  }
276 
277  if ($this->_lineDashingPattern !== null) {
278  #require_once 'Zend/Pdf/Element/Array.php';
279  $dashPattern = new Zend_Pdf_Element_Array();
280 
281  #require_once 'Zend/Pdf/Element/Numeric.php';
282  foreach ($this->_lineDashingPattern as $dashItem) {
283  $dashElement = new Zend_Pdf_Element_Numeric($dashItem);
284  $dashPattern->items[] = $dashElement;
285  }
286 
287  $instructions .= $dashPattern->toString() . ' '
288  . $this->_lineDashingPhase->toString() . " d\n";
289  }
290 
291  return $instructions;
292  }
293 
294 }
const LINE_DASHING_SOLID
Definition: Page.php:108
setFont(Zend_Pdf_Resource_Font $font, $fontSize)
Definition: Style.php:168
getLineDashingPhase()
Definition: Style.php:250
$pattern
Definition: website.php:22
$instructions
getLineDashingPattern()
Definition: Style.php:219
setLineWidth($width)
Definition: Style.php:135
setLineDashingPattern($pattern, $phase=0)
Definition: Style.php:148
setFillColor(Zend_Pdf_Color $color)
Definition: Style.php:115
setLineColor(Zend_Pdf_Color $color)
Definition: Style.php:125
setFontSize($fontSize)
Definition: Style.php:179
__construct($anotherStyle=null)
Definition: Style.php:96