Skip to content

Commit

Permalink
SVG bugfix: always print path command after bad formatted command, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Dec 5, 2019
1 parent 46a7b44 commit 0a6c331
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions svg/pathdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (p *PathData) copyInstruction(b []byte, cmd byte) int {
} else if (cmd == 'A' || cmd == 'a') && n%7 == 0 {
di = 7
} else {
p.state.cmd = 0
return len(b)
}

Expand Down
3 changes: 3 additions & 0 deletions svg/pathdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func TestPathData(t *testing.T) {
{"A.0.0.4 0 0.0.3", "A0 0 .4 000 .3"},
{"A1.1.0.0 00.2.3L10 0", "A1.1.0.0 00.2.3L10 0"},
{"A5 5 0 010 0", "A5 5 0 010 0"}, // different flag syntax
{
"q6.55 0 10.56-2.93a9.36 9.36 0 004-8 10 10 0 00-3.37-7.83q-3.37-3-9.9-4.79A25.38 25.38 0 0137.76 44",
"q6.55.0 10.56-2.93a9.36 9.36 0 004-8 10 10 0 00-3.37-7.83q-3.37-3-9.9-4.79A25.38 25.38.0 0137.76 44"}, // #275

// change/remove commands
{"M10 10L10 10L20 10z", "M10 10H20z"},
Expand Down

0 comments on commit 0a6c331

Please # to comment.