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