From 835fb02343df0a4b9dab7704a4b3d8be8e9a497c Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Tue, 4 Jan 2022 15:06:41 -0800 Subject: [PATCH] fix: setting null for a font style on a theme (#5831) --- core/renderers/common/constants.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index 81401c6c6eb..295ccf3687a 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -622,18 +622,17 @@ ConstantProvider.prototype.setDynamicProperties_ = function(theme) { * @protected */ ConstantProvider.prototype.setFontConstants_ = function(theme) { - this.FIELD_TEXT_FONTFAMILY = - theme.fontStyle && theme.fontStyle['family'] !== undefined ? - theme.fontStyle['family'] : - this.FIELD_TEXT_FONTFAMILY; - this.FIELD_TEXT_FONTWEIGHT = - theme.fontStyle && theme.fontStyle['weight'] !== undefined ? - theme.fontStyle['weight'] : - this.FIELD_TEXT_FONTWEIGHT; - this.FIELD_TEXT_FONTSIZE = - theme.fontStyle && theme.fontStyle['size'] !== undefined ? - theme.fontStyle['size'] : - this.FIELD_TEXT_FONTSIZE; + if (theme.fontStyle && theme.fontStyle['family']) { + this.FIELD_TEXT_FONTFAMILY = theme.fontStyle['family']; + } + + if (theme.fontStyle && theme.fontStyle['weight']) { + this.FIELD_TEXT_FONTWEIGHT = theme.fontStyle['weight']; + } + + if (theme.fontStyle && theme.fontStyle['size']) { + this.FIELD_TEXT_FONTSIZE = theme.fontStyle['size']; + } const fontMetrics = dom.measureFontMetrics( 'Hg', this.FIELD_TEXT_FONTSIZE + 'pt', this.FIELD_TEXT_FONTWEIGHT,