fix: setting null for a font style on a theme (#5831)

This commit is contained in:
alschmiedt
2022-01-04 15:06:41 -08:00
committed by GitHub
parent b5abb3e644
commit 835fb02343

View File

@@ -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,