1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AppUtils\StyleCollection\StyleBuilder\Flavors\Font; |
6
|
|
|
|
7
|
|
|
use AppUtils\StyleCollection\StyleBuilder; |
8
|
|
|
use AppUtils\StyleCollection\StyleBuilder\StyleContainer; |
9
|
|
|
|
10
|
|
|
class FontFamily extends StyleContainer |
11
|
|
|
{ |
12
|
|
|
public const FONT_ARIAL = 'Arial'; |
13
|
|
|
public const FONT_VERDANA = 'Verdana'; |
14
|
|
|
public const FONT_HELVETICA = 'Helvetica'; |
15
|
|
|
public const FONT_TAHOMA = 'Tahoma'; |
16
|
|
|
public const FONT_TREBUCHET = 'Trebuchet MS'; |
17
|
|
|
public const FONT_TIMES_NEW_ROMAN = 'Times New Roman'; |
18
|
|
|
public const FONT_GEORGIA = 'Georgia'; |
19
|
|
|
public const FONT_GARAMOND = 'Garamond'; |
20
|
|
|
public const FONT_COURIER_NEW = 'Courier New'; |
21
|
|
|
public const FONT_BRUSH_SCRIPT = 'Brush Script MT'; |
22
|
|
|
|
23
|
|
|
protected function getName() : string |
24
|
|
|
{ |
25
|
|
|
return 'font-family'; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string[] |
30
|
|
|
*/ |
31
|
|
|
private $fonts = array(); |
32
|
|
|
|
33
|
|
|
private function addFont(string $name) : FontFamily |
34
|
|
|
{ |
35
|
|
|
if(!in_array($name, $this->fonts)) |
36
|
|
|
{ |
37
|
|
|
$this->fonts[] = $name; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getFonts() : array |
44
|
|
|
{ |
45
|
|
|
return $this->fonts; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function fallback() : FontFallback |
49
|
|
|
{ |
50
|
|
|
return new FontFallback($this->styles, $this->collection, $this->fonts); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function custom(string $name) : FontFamily |
54
|
|
|
{ |
55
|
|
|
return $this->addFont($name); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function arial() : FontFamily |
59
|
|
|
{ |
60
|
|
|
return $this->addFont(self::FONT_ARIAL); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function verdana() : FontFamily |
64
|
|
|
{ |
65
|
|
|
return $this->addFont(self::FONT_VERDANA); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function helvetica() : FontFamily |
69
|
|
|
{ |
70
|
|
|
return $this->addFont(self::FONT_HELVETICA); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function tahoma() : FontFamily |
74
|
|
|
{ |
75
|
|
|
return $this->addFont(self::FONT_TAHOMA); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function trebuchetMS() : FontFamily |
79
|
|
|
{ |
80
|
|
|
return $this->addFont(self::FONT_TREBUCHET); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function timesNewRoman() : FontFamily |
84
|
|
|
{ |
85
|
|
|
return $this->addFont(self::FONT_TIMES_NEW_ROMAN); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function georgia() : FontFamily |
89
|
|
|
{ |
90
|
|
|
return $this->addFont(self::FONT_GEORGIA); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function garamond() : FontFamily |
94
|
|
|
{ |
95
|
|
|
return $this->addFont(self::FONT_GARAMOND); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function courierNew() : FontFamily |
99
|
|
|
{ |
100
|
|
|
return $this->addFont(self::FONT_COURIER_NEW); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function brushScript() : FontFamily |
104
|
|
|
{ |
105
|
|
|
return $this->addFont(self::FONT_BRUSH_SCRIPT); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|