Skip to content

Commit 9416441

Browse files
committed
clear none text font styles instead of setting to none
1 parent a344464 commit 9416441

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

Diff for: src/components/drawing/index.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ drawing.font = function(s, font) {
4646
if(style) s.style('font-style', style);
4747
if(variant) s.style('font-variant', variant);
4848

49-
if(textcase) s.style('text-transform', textcase2transform(textcase));
50-
if(shadow) s.style('text-shadow', shadow === 'auto' ? svgTextUtils.makeTextShadow(Color.contrast(color)) : shadow);
51-
if(lineposition) s.style('text-decoration-line', lineposition2decorationLine(lineposition));
49+
if(textcase) s.style('text-transform', dropNone(textcase2transform(textcase)));
50+
if(shadow) s.style('text-shadow', shadow === 'auto' ? svgTextUtils.makeTextShadow(Color.contrast(color)) : dropNone(shadow));
51+
if(lineposition) s.style('text-decoration-line', dropNone(lineposition2decorationLine(lineposition)));
5252
};
5353

54+
function dropNone(a) {
55+
return a === 'none' ? undefined : a;
56+
}
57+
5458
var textcase2transformOptions = {
5559
normal: 'none',
5660
lower: 'lowercase',

Diff for: src/snapshot/tosvg.js

-14
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,6 @@ module.exports = function toSVG(gd, format, scale) {
118118
if(fv && fv === 'normal') {
119119
txt.style('font-variant', undefined);
120120
}
121-
122-
// Drop none text-shadow, text-transform and text-decoration-line to reduce the size
123-
var ts = this.style.textShadow;
124-
if(ts && ts === 'none') {
125-
txt.style('text-shadow', undefined);
126-
}
127-
var tt = this.style.textTransform;
128-
if(tt && tt === 'none') {
129-
txt.style('text-transform', undefined);
130-
}
131-
var td = this.style.textDecorationLine;
132-
if(td && td === 'none') {
133-
txt.style('text-decoration-line', undefined);
134-
}
135121
});
136122

137123
svg.selectAll('.gradient_filled,.pattern_filled').each(function() {

0 commit comments

Comments
 (0)