Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
116 / 116
100.00% covered (success)
100.00%
59 / 59
CRAP
100.00% covered (success)
100.00%
1 / 1
Font
100.00% covered (success)
100.00%
116 / 116
100.00% covered (success)
100.00%
59 / 59
61
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getStyleValues
100.00% covered (success)
100.00%
34 / 34
100.00% covered (success)
100.00%
1 / 1
1
 getStyleType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setName
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getHint
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setHint
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getSize
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSize
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getColor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setColor
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 isBold
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBold
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 isItalic
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setItalic
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getUnderline
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setUnderline
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 isSuperScript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSuperScript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isSubScript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSubScript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isStrikethrough
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setStrikethrough
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isDoubleStrikethrough
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setDoubleStrikethrough
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isSmallCaps
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSmallCaps
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isAllCaps
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setAllCaps
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFgColor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setFgColor
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBgColor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBgColor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getScale
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setScale
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getSpacing
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSpacing
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getKerning
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setKerning
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 isNoProof
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setNoProof
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getLineHeight
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLineHeight
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getParagraph
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setParagraph
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 isRTL
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRTL
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getShading
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setShading
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getLang
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLang
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
 isHidden
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setHidden
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPosition
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPosition
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 setWhiteSpace
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getWhiteSpace
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setFallbackFont
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getFallbackFont
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * This file is part of PHPWord - A pure PHP library for reading and writing
4 * word processing documents.
5 *
6 * PHPWord is free software distributed under the terms of the GNU Lesser
7 * General Public License version 3 as published by the Free Software Foundation.
8 *
9 * For the full copyright and license information, please read the LICENSE
10 * file that was distributed with this source code. For the full list of
11 * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
12 *
13 * @see         https://github.com/PHPOffice/PHPWord
14 *
15 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16 */
17
18namespace PhpOffice\PhpWord\Style;
19
20use PhpOffice\PhpWord\Settings;
21use PhpOffice\PhpWord\Shared\Validate;
22
23/**
24 * Font style.
25 */
26class Font extends AbstractStyle
27{
28    /**
29     * Underline types.
30     *
31     * @const string
32     */
33    const UNDERLINE_NONE = 'none';
34    const UNDERLINE_DASH = 'dash';
35    const UNDERLINE_DASHHEAVY = 'dashHeavy';
36    const UNDERLINE_DASHLONG = 'dashLong';
37    const UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy';
38    const UNDERLINE_DOUBLE = 'dbl';
39    const UNDERLINE_DOTDASH = 'dotDash';
40    const UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy';
41    const UNDERLINE_DOTDOTDASH = 'dotDotDash';
42    const UNDERLINE_DOTDOTDASHHEAVY = 'dotDotDashHeavy';
43    const UNDERLINE_DOTTED = 'dotted';
44    const UNDERLINE_DOTTEDHEAVY = 'dottedHeavy';
45    const UNDERLINE_HEAVY = 'heavy';
46    const UNDERLINE_SINGLE = 'single';
47    const UNDERLINE_WAVY = 'wavy';
48    const UNDERLINE_WAVYDOUBLE = 'wavyDbl';
49    const UNDERLINE_WAVYHEAVY = 'wavyHeavy';
50    const UNDERLINE_WORDS = 'words';
51
52    /**
53     * Foreground colors.
54     *
55     * @const string
56     */
57    const FGCOLOR_YELLOW = 'yellow';
58    const FGCOLOR_LIGHTGREEN = 'green';
59    const FGCOLOR_CYAN = 'cyan';
60    const FGCOLOR_MAGENTA = 'magenta';
61    const FGCOLOR_BLUE = 'blue';
62    const FGCOLOR_RED = 'red';
63    const FGCOLOR_DARKBLUE = 'darkBlue';
64    const FGCOLOR_DARKCYAN = 'darkCyan';
65    const FGCOLOR_DARKGREEN = 'darkGreen';
66    const FGCOLOR_DARKMAGENTA = 'darkMagenta';
67    const FGCOLOR_DARKRED = 'darkRed';
68    const FGCOLOR_DARKYELLOW = 'darkYellow';
69    const FGCOLOR_DARKGRAY = 'darkGray';
70    const FGCOLOR_LIGHTGRAY = 'lightGray';
71    const FGCOLOR_BLACK = 'black';
72
73    /**
74     * Aliases.
75     *
76     * @var array
77     */
78    protected $aliases = ['line-height' => 'lineHeight', 'letter-spacing' => 'spacing'];
79
80    /**
81     * Font style type.
82     *
83     * @var string
84     */
85    private $type;
86
87    /**
88     * Font name.
89     *
90     * @var string
91     */
92    private $name;
93
94    /**
95     * Font Content Type.
96     *
97     * @var string
98     */
99    private $hint;
100
101    /**
102     * Font size.
103     *
104     * @var float|int
105     */
106    private $size;
107
108    /**
109     * Font color.
110     *
111     * @var string
112     */
113    private $color;
114
115    /**
116     * Bold.
117     *
118     * @var bool
119     */
120    private $bold;
121
122    /**
123     * Italic.
124     *
125     * @var bool
126     */
127    private $italic;
128
129    /**
130     * Undeline.
131     *
132     * @var string
133     */
134    private $underline = self::UNDERLINE_NONE;
135
136    /**
137     * Superscript.
138     *
139     * @var bool
140     */
141    private $superScript = false;
142
143    /**
144     * Subscript.
145     *
146     * @var bool
147     */
148    private $subScript = false;
149
150    /**
151     * Strikethrough.
152     *
153     * @var bool
154     */
155    private $strikethrough;
156
157    /**
158     * Double strikethrough.
159     *
160     * @var bool
161     */
162    private $doubleStrikethrough;
163
164    /**
165     * Small caps.
166     *
167     * @var bool
168     *
169     * @see  http://www.schemacentral.com/sc/ooxml/e-w_smallCaps-1.html
170     */
171    private $smallCaps;
172
173    /**
174     * All caps.
175     *
176     * @var bool
177     *
178     * @see  http://www.schemacentral.com/sc/ooxml/e-w_caps-1.html
179     */
180    private $allCaps;
181
182    /**
183     * Foreground/highlight.
184     *
185     * @var string
186     */
187    private $fgColor;
188
189    /**
190     * Expanded/compressed text: 0-600 (percent).
191     *
192     * @var int
193     *
194     * @since 0.12.0
195     * @see  http://www.schemacentral.com/sc/ooxml/e-w_w-1.html
196     */
197    private $scale;
198
199    /**
200     * Character spacing adjustment: twip.
201     *
202     * @var float|int
203     *
204     * @since 0.12.0
205     * @see  http://www.schemacentral.com/sc/ooxml/e-w_spacing-2.html
206     */
207    private $spacing;
208
209    /**
210     * Font kerning: halfpoint.
211     *
212     * @var float|int
213     *
214     * @since 0.12.0
215     * @see  http://www.schemacentral.com/sc/ooxml/e-w_kern-1.html
216     */
217    private $kerning;
218
219    /**
220     * Paragraph style.
221     *
222     * @var \PhpOffice\PhpWord\Style\Paragraph
223     */
224    private $paragraph;
225
226    /**
227     * Shading.
228     *
229     * @var \PhpOffice\PhpWord\Style\Shading
230     */
231    private $shading;
232
233    /**
234     * Right to left languages.
235     *
236     * @var ?bool
237     */
238    private $rtl;
239
240    /**
241     * noProof (disables AutoCorrect).
242     *
243     * @var bool
244     * http://www.datypic.com/sc/ooxml/e-w_noProof-1.html
245     */
246    private $noProof;
247
248    /**
249     * Languages.
250     *
251     * @var null|\PhpOffice\PhpWord\Style\Language
252     */
253    private $lang;
254
255    /**
256     * Hidden text.
257     *
258     * @var bool
259     *
260     * @see  http://www.datypic.com/sc/ooxml/e-w_vanish-1.html
261     */
262    private $hidden;
263
264    /**
265     * Vertically Raised or Lowered Text.
266     *
267     * @var int Signed Half-Point Measurement
268     *
269     * @see http://www.datypic.com/sc/ooxml/e-w_position-1.html
270     */
271    private $position;
272
273    /**
274     * Preservation of white space in html.
275     *
276     * @var string Value used for css white-space
277     */
278    private $whiteSpace = '';
279
280    /**
281     * Generic font as fallback for html.
282     *
283     * @var string generic font name
284     */
285    private $fallbackFont = '';
286
287    /**
288     * Create new font style.
289     *
290     * @param string $type Type of font
291     * @param array|\PhpOffice\PhpWord\Style\AbstractStyle|string $paragraph Paragraph styles definition
292     */
293    public function __construct($type = 'text', $paragraph = null)
294    {
295        $this->type = $type;
296        $this->setParagraph($paragraph);
297    }
298
299    /**
300     * Get style values.
301     *
302     * @return array
303     *
304     * @since 0.12.0
305     */
306    public function getStyleValues()
307    {
308        return [
309            'name' => $this->getStyleName(),
310            'basic' => [
311                'name' => $this->getName(),
312                'size' => $this->getSize(),
313                'color' => $this->getColor(),
314                'hint' => $this->getHint(),
315            ],
316            'style' => [
317                'bold' => $this->isBold(),
318                'italic' => $this->isItalic(),
319                'underline' => $this->getUnderline(),
320                'strike' => $this->isStrikethrough(),
321                'dStrike' => $this->isDoubleStrikethrough(),
322                'super' => $this->isSuperScript(),
323                'sub' => $this->isSubScript(),
324                'smallCaps' => $this->isSmallCaps(),
325                'allCaps' => $this->isAllCaps(),
326                'fgColor' => $this->getFgColor(),
327                'hidden' => $this->isHidden(),
328            ],
329            'spacing' => [
330                'scale' => $this->getScale(),
331                'spacing' => $this->getSpacing(),
332                'kerning' => $this->getKerning(),
333                'position' => $this->getPosition(),
334            ],
335            'paragraph' => $this->getParagraph(),
336            'rtl' => $this->isRTL(),
337            'shading' => $this->getShading(),
338            'lang' => $this->getLang(),
339            'whiteSpace' => $this->getWhiteSpace(),
340            'fallbackFont' => $this->getFallbackFont(),
341        ];
342    }
343
344    /**
345     * Get style type.
346     *
347     * @return string
348     */
349    public function getStyleType()
350    {
351        return $this->type;
352    }
353
354    /**
355     * Get font name.
356     *
357     * @return string
358     */
359    public function getName()
360    {
361        return $this->name;
362    }
363
364    /**
365     * Set font name.
366     *
367     * @param string $value
368     *
369     * @return self
370     */
371    public function setName($value = null)
372    {
373        $this->name = $value;
374
375        return $this;
376    }
377
378    /**
379     * Get Font Content Type.
380     *
381     * @return string
382     */
383    public function getHint()
384    {
385        return $this->hint;
386    }
387
388    /**
389     * Set Font Content Type.
390     *
391     * @param string $value
392     *
393     * @return self
394     */
395    public function setHint($value = null)
396    {
397        $this->hint = $value;
398
399        return $this;
400    }
401
402    /**
403     * Get font size.
404     *
405     * @return float|int
406     */
407    public function getSize()
408    {
409        return $this->size;
410    }
411
412    /**
413     * Set font size.
414     *
415     * @param float|int $value
416     *
417     * @return self
418     */
419    public function setSize($value = null)
420    {
421        $this->size = $this->setNumericVal($value, $this->size);
422
423        return $this;
424    }
425
426    /**
427     * Get font color.
428     *
429     * @return string
430     */
431    public function getColor()
432    {
433        return $this->color;
434    }
435
436    /**
437     * Set font color.
438     *
439     * @param string $value
440     *
441     * @return self
442     */
443    public function setColor($value = null)
444    {
445        $this->color = $value;
446
447        return $this;
448    }
449
450    /**
451     * Get bold.
452     *
453     * @return bool
454     */
455    public function isBold()
456    {
457        return $this->bold;
458    }
459
460    /**
461     * Set bold.
462     *
463     * @param bool $value
464     *
465     * @return self
466     */
467    public function setBold($value = true)
468    {
469        $this->bold = $this->setBoolVal($value, $this->bold);
470
471        return $this;
472    }
473
474    /**
475     * Get italic.
476     *
477     * @return bool
478     */
479    public function isItalic()
480    {
481        return $this->italic;
482    }
483
484    /**
485     * Set italic.
486     *
487     * @param bool $value
488     *
489     * @return self
490     */
491    public function setItalic($value = true)
492    {
493        $this->italic = $this->setBoolVal($value, $this->italic);
494
495        return $this;
496    }
497
498    /**
499     * Get underline.
500     *
501     * @return string
502     */
503    public function getUnderline()
504    {
505        return $this->underline;
506    }
507
508    /**
509     * Set underline.
510     *
511     * @param string $value
512     *
513     * @return self
514     */
515    public function setUnderline($value = self::UNDERLINE_NONE)
516    {
517        $this->underline = $this->setNonEmptyVal($value, self::UNDERLINE_NONE);
518
519        return $this;
520    }
521
522    /**
523     * Get superscript.
524     *
525     * @return bool
526     */
527    public function isSuperScript()
528    {
529        return $this->superScript;
530    }
531
532    /**
533     * Set superscript.
534     *
535     * @param bool $value
536     *
537     * @return self
538     */
539    public function setSuperScript($value = true)
540    {
541        return $this->setPairedVal($this->superScript, $this->subScript, $value);
542    }
543
544    /**
545     * Get subscript.
546     *
547     * @return bool
548     */
549    public function isSubScript()
550    {
551        return $this->subScript;
552    }
553
554    /**
555     * Set subscript.
556     *
557     * @param bool $value
558     *
559     * @return self
560     */
561    public function setSubScript($value = true)
562    {
563        return $this->setPairedVal($this->subScript, $this->superScript, $value);
564    }
565
566    /**
567     * Get strikethrough.
568     */
569    public function isStrikethrough(): ?bool
570    {
571        return $this->strikethrough;
572    }
573
574    /**
575     * Set strikethrough.
576     *
577     * @param bool $value
578     */
579    public function setStrikethrough($value = true): self
580    {
581        return $this->setPairedVal($this->strikethrough, $this->doubleStrikethrough, $value);
582    }
583
584    /**
585     * Get double strikethrough.
586     */
587    public function isDoubleStrikethrough(): ?bool
588    {
589        return $this->doubleStrikethrough;
590    }
591
592    /**
593     * Set double strikethrough.
594     *
595     * @param bool $value
596     */
597    public function setDoubleStrikethrough($value = true): self
598    {
599        return $this->setPairedVal($this->doubleStrikethrough, $this->strikethrough, $value);
600    }
601
602    /**
603     * Get small caps.
604     *
605     * @return bool
606     */
607    public function isSmallCaps()
608    {
609        return $this->smallCaps;
610    }
611
612    /**
613     * Set small caps.
614     *
615     * @param bool $value
616     *
617     * @return self
618     */
619    public function setSmallCaps($value = true)
620    {
621        return $this->setPairedVal($this->smallCaps, $this->allCaps, $value);
622    }
623
624    /**
625     * Get all caps.
626     *
627     * @return bool
628     */
629    public function isAllCaps()
630    {
631        return $this->allCaps;
632    }
633
634    /**
635     * Set all caps.
636     *
637     * @param bool $value
638     *
639     * @return self
640     */
641    public function setAllCaps($value = true)
642    {
643        return $this->setPairedVal($this->allCaps, $this->smallCaps, $value);
644    }
645
646    /**
647     * Get foreground/highlight color.
648     *
649     * @return string
650     */
651    public function getFgColor()
652    {
653        return $this->fgColor;
654    }
655
656    /**
657     * Set foreground/highlight color.
658     *
659     * @param string $value
660     *
661     * @return self
662     */
663    public function setFgColor($value = null)
664    {
665        $this->fgColor = $value;
666
667        return $this;
668    }
669
670    /**
671     * Get background.
672     *
673     * @return string
674     */
675    public function getBgColor()
676    {
677        return $this->getChildStyleValue($this->shading, 'fill');
678    }
679
680    /**
681     * Set background.
682     *
683     * @param string $value
684     *
685     * @return \PhpOffice\PhpWord\Style\Table
686     */
687    public function setBgColor($value = null)
688    {
689        $this->setShading(['fill' => $value]);
690    }
691
692    /**
693     * Get scale.
694     *
695     * @return int
696     */
697    public function getScale()
698    {
699        return $this->scale;
700    }
701
702    /**
703     * Set scale.
704     *
705     * @param int $value
706     *
707     * @return self
708     */
709    public function setScale($value = null)
710    {
711        $this->scale = $this->setIntVal($value, null);
712
713        return $this;
714    }
715
716    /**
717     * Get font spacing.
718     *
719     * @return float|int
720     */
721    public function getSpacing()
722    {
723        return $this->spacing;
724    }
725
726    /**
727     * Set font spacing.
728     *
729     * @param float|int $value
730     *
731     * @return self
732     */
733    public function setSpacing($value = null)
734    {
735        $this->spacing = $this->setNumericVal($value, null);
736
737        return $this;
738    }
739
740    /**
741     * Get font kerning.
742     *
743     * @return float|int
744     */
745    public function getKerning()
746    {
747        return $this->kerning;
748    }
749
750    /**
751     * Set font kerning.
752     *
753     * @param float|int $value
754     *
755     * @return self
756     */
757    public function setKerning($value = null)
758    {
759        $this->kerning = $this->setNumericVal($value, null);
760
761        return $this;
762    }
763
764    /**
765     * Get noProof (disables autocorrect).
766     *
767     * @return bool
768     */
769    public function isNoProof()
770    {
771        return $this->noProof;
772    }
773
774    /**
775     * Set noProof (disables autocorrect).
776     *
777     * @param bool $value
778     *
779     * @return $this
780     */
781    public function setNoProof($value = false)
782    {
783        $this->noProof = $value;
784
785        return $this;
786    }
787
788    /**
789     * Get line height.
790     *
791     * @return float|int
792     */
793    public function getLineHeight()
794    {
795        return $this->getParagraph()->getLineHeight();
796    }
797
798    /**
799     * Set lineheight.
800     *
801     * @param float|int|string $value
802     *
803     * @return self
804     */
805    public function setLineHeight($value)
806    {
807        $this->setParagraph(['lineHeight' => $value]);
808
809        return $this;
810    }
811
812    /**
813     * Get paragraph style.
814     *
815     * @return \PhpOffice\PhpWord\Style\Paragraph
816     */
817    public function getParagraph()
818    {
819        return $this->paragraph;
820    }
821
822    /**
823     * Set Paragraph.
824     *
825     * @param mixed $value
826     *
827     * @return self
828     */
829    public function setParagraph($value = null)
830    {
831        $this->setObjectVal($value, 'Paragraph', $this->paragraph);
832
833        return $this;
834    }
835
836    /**
837     * Get rtl.
838     *
839     * @return ?bool
840     */
841    public function isRTL()
842    {
843        return $this->rtl ?? Settings::isDefaultRtl();
844    }
845
846    /**
847     * Set rtl.
848     *
849     * @param ?bool $value
850     *
851     * @return self
852     */
853    public function setRTL($value = true)
854    {
855        $this->rtl = $this->setBoolVal($value, $this->rtl);
856
857        return $this;
858    }
859
860    /**
861     * Get shading.
862     *
863     * @return \PhpOffice\PhpWord\Style\Shading
864     */
865    public function getShading()
866    {
867        return $this->shading;
868    }
869
870    /**
871     * Set shading.
872     *
873     * @param mixed $value
874     *
875     * @return self
876     */
877    public function setShading($value = null)
878    {
879        $this->setObjectVal($value, 'Shading', $this->shading);
880
881        return $this;
882    }
883
884    /**
885     * Get language.
886     *
887     * @return null|\PhpOffice\PhpWord\Style\Language
888     */
889    public function getLang()
890    {
891        return $this->lang;
892    }
893
894    /**
895     * Set language.
896     *
897     * @param mixed $value
898     *
899     * @return self
900     */
901    public function setLang($value = null)
902    {
903        if (is_string($value) && $value != '') {
904            $value = new Language($value);
905        }
906        $this->setObjectVal($value, 'Language', $this->lang);
907
908        return $this;
909    }
910
911    /**
912     * Get hidden text.
913     *
914     * @return bool
915     */
916    public function isHidden()
917    {
918        return $this->hidden;
919    }
920
921    /**
922     * Set hidden text.
923     *
924     * @param bool $value
925     *
926     * @return self
927     */
928    public function setHidden($value = true)
929    {
930        $this->hidden = $this->setBoolVal($value, $this->hidden);
931
932        return $this;
933    }
934
935    /**
936     * Get position.
937     *
938     * @return int
939     */
940    public function getPosition()
941    {
942        return $this->position;
943    }
944
945    /**
946     * Set position.
947     *
948     * @param int $value
949     *
950     * @return self
951     */
952    public function setPosition($value = null)
953    {
954        $this->position = $this->setIntVal($value, null);
955
956        return $this;
957    }
958
959    /**
960     * Set html css white-space value. It is expected that only pre-wrap and normal (default) are useful.
961     *
962     * @param null|string $value Should be one of pre-wrap, normal, nowrap, pre, pre-line, initial, inherit
963     */
964    public function setWhiteSpace(?string $value): self
965    {
966        $this->whiteSpace = Validate::validateCSSWhiteSpace($value);
967
968        return $this;
969    }
970
971    /**
972     * Get html css white-space value.
973     */
974    public function getWhiteSpace(): string
975    {
976        return $this->whiteSpace;
977    }
978
979    /**
980     * Set generic font for fallback for html.
981     *
982     * @param string $value generic font name
983     */
984    public function setFallbackFont(?string $value): self
985    {
986        $this->fallbackFont = Validate::validateCSSGenericFont($value);
987
988        return $this;
989    }
990
991    /**
992     * Get html fallback generic font.
993     */
994    public function getFallbackFont(): string
995    {
996        return $this->fallbackFont;
997    }
998}