Skip to content

Commit 17492b0

Browse files
authored
Merge pull request #92 from lm-cmxkonzepte/master
Add Handling for font names in double quotes
2 parents 939d68e + ca8fbf9 commit 17492b0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/Html/Font.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ class Font
1111

1212
public function toStyle(): string {
1313
$list = array();
14-
if($this->name) array_push($list, $this->name ?? ' ');
15-
if($this->family) array_push($list, $this->family ?? ' ');
14+
// If the name is in double quotes replace them with single quotes
15+
if($this->name) $this->name = preg_replace("/^\"(.*)\"$/", '\'$1\'', $this->name);
16+
if($this->name) array_push($list, $this->name);
17+
if($this->family) array_push($list, $this->family);
1618
if(sizeof($list) == 0) return "";
17-
return "font-family:" . join(' ', $list) . ";";
19+
return "font-family:" . join(', ', $list) . ";";
1820
}
1921
}
22+

0 commit comments

Comments
 (0)