From b6e1cf0f3a8764d54357e45a78120dc872edc049 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 18 May 2021 18:19:42 +0200 Subject: [PATCH] Missing font stack for system font in emails --- com.woltlab.wcf/templates/email_html.tpl | 2 +- .../install/files/lib/data/style/Style.class.php | 13 +++++++++++++ .../files/lib/system/style/StyleCompiler.class.php | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/com.woltlab.wcf/templates/email_html.tpl b/com.woltlab.wcf/templates/email_html.tpl index 673b2d4e49..246e5cf519 100644 --- a/com.woltlab.wcf/templates/email_html.tpl +++ b/com.woltlab.wcf/templates/email_html.tpl @@ -12,7 +12,7 @@ } body, body * { - font-family: {@$style->getVariable('wcfFontFamilyFallback', true)}; + font-family: {@$style->getEmailFontFamily()}; font-size: {$style->getVariable('wcfFontSizeDefault')}; } diff --git a/wcfsetup/install/files/lib/data/style/Style.class.php b/wcfsetup/install/files/lib/data/style/Style.class.php index 6e6638dca3..147602adcb 100644 --- a/wcfsetup/install/files/lib/data/style/Style.class.php +++ b/wcfsetup/install/files/lib/data/style/Style.class.php @@ -4,6 +4,7 @@ namespace wcf\data\style; use wcf\data\DatabaseObject; use wcf\system\application\ApplicationHandler; +use wcf\system\style\StyleCompiler; use wcf\system\WCF; use wcf\util\FileUtil; use wcf\util\ImageUtil; @@ -162,6 +163,18 @@ class Style extends DatabaseObject return null; } + /** + * @since 5.4 + */ + public function getEmailFontFamily(): string { + $fontFamily = $this->getVariable('wcfFontFamilyFallback'); + if ($fontFamily === StyleCompiler::SYSTEM_FONT_NAME) { + $fontFamily = StyleCompiler::SYSTEM_FONT_FAMILY; + } + + return $fontFamily; + } + /** * Loads style-specific variables. */ diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index cc236cc284..c5c58707f0 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -54,11 +54,11 @@ final class StyleCompiler extends SingletonFactory public const SYSTEM_FONT_NAME = 'system'; - private const SYSTEM_FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", + public const SYSTEM_FONT_FAMILY = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif'; - private const SYSTEM_FONT_FAMILY_MONOSPACE = 'ui-monospace, Menlo, Monaco, "Cascadia Mono", + public const SYSTEM_FONT_FAMILY_MONOSPACE = 'ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace'; -- 2.20.1