Skip to content

Commit c24a4e4

Browse files
AnnaLena2704Anna-Lena LumppHackbrettXXX
authored
Force stroke='none' if 'stroke-width' === 0 (#271)
don't stroke text if stroke-width is zero Co-authored-by: Anna-Lena Lumpp <[email protected]> Co-authored-by: Lukas Hollaender <[email protected]>
1 parent 07b8ca1 commit c24a4e4

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

src/utils/text.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ type TextRenderingMode = typeof tol.renderingMode
99

1010
export function getTextRenderingMode(attributeState: AttributeState): TextRenderingMode {
1111
let renderingMode: TextRenderingMode = 'invisible'
12-
if (attributeState.fill && attributeState.stroke) {
12+
const doStroke = attributeState.stroke && attributeState.strokeWidth !== 0
13+
const doFill = attributeState.fill
14+
if (doFill && doStroke) {
1315
renderingMode = 'fillThenStroke'
14-
} else if (attributeState.fill) {
16+
} else if (doFill) {
1517
renderingMode = 'fill'
16-
} else if (attributeState.stroke) {
18+
} else if (doStroke) {
1719
renderingMode = 'stroke'
1820
}
1921
return renderingMode

test/common/tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ window.tests = [
6464
'vertical-align',
6565
'xml-space',
6666
'zero-width-strokes',
67+
'zero-width-strokes-text',
6768
'current-color',
6869
'text-length'
6970
]
3.14 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)