Missing font stack for system font in emails
authorAlexander Ebert <ebert@woltlab.com>
Tue, 18 May 2021 16:19:42 +0000 (18:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 18 May 2021 16:19:42 +0000 (18:19 +0200)
com.woltlab.wcf/templates/email_html.tpl
wcfsetup/install/files/lib/data/style/Style.class.php
wcfsetup/install/files/lib/system/style/StyleCompiler.class.php

index 673b2d4e49c0bdcfb572394895402ec0557282e8..246e5cf5194d3408031f9448b31c734943d7d493 100644 (file)
@@ -12,7 +12,7 @@
                }
                
                body, body * {
-                       font-family: {@$style->getVariable('wcfFontFamilyFallback', true)};
+                       font-family: {@$style->getEmailFontFamily()};
                        font-size: {$style->getVariable('wcfFontSizeDefault')};
                }
                
index 6e6638dca37a50dfa30e9caec30b623cc0c4e6af..147602adcb8a8ccdfd866e5470ddbbe6f979a82a 100644 (file)
@@ -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.
      */
index cc236cc284bb174cabf0d70204d015d97cf5c4ca..c5c58707f0ba8b59dec761721ef392ef51a1243a 100644 (file)
@@ -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';