diff --git a/lib/Newsletter/Renderer/StylesHelper.php b/lib/Newsletter/Renderer/StylesHelper.php index 37b14a6838..4aadf36772 100644 --- a/lib/Newsletter/Renderer/StylesHelper.php +++ b/lib/Newsletter/Renderer/StylesHelper.php @@ -41,6 +41,7 @@ class StylesHelper { static function getStyles($data, $type, $ignore_specific_styles = false) { $styles = array_map(function($attribute, $style) use ($ignore_specific_styles) { if(!$ignore_specific_styles || !in_array($attribute, $ignore_specific_styles)) { + $style = StylesHelper::applyFontFamily($attribute, $style); return StylesHelper::translateCSSAttribute($attribute) . ': ' . $style . ' !important;'; } }, array_keys($data[$type]), $data[$type]); diff --git a/tests/unit/Newsletter/RendererTest.php b/tests/unit/Newsletter/RendererTest.php index aeb2980daf..a600fa2e3c 100644 --- a/tests/unit/Newsletter/RendererTest.php +++ b/tests/unit/Newsletter/RendererTest.php @@ -346,6 +346,18 @@ class RendererTest extends \MailPoetTest { )->equals(1); } + function testItUsesFullFontFamilyNameInElementStyles() { + $newsletter = $this->newsletter['body']; + $template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][5]; + $template['styles']['block']['fontFamily'] = 'Lucida'; + $DOM = $this->DOM_parser->parseStr(Button::render($template, $columnCount = 1)); + expect( + preg_match( + '/font-family: \'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif/', + $DOM('a.mailpoet_button', 0)->attr('style')) + )->equals(1); + } + function testItRendersSocialIcons() { $newsletter = $this->newsletter['body']; $template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][6];