processing / processing/processing4
loadShape() problems with SVGs that have . starting a number in a path
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 494
- Forks
- 183
- Avg merge
- 4h 39m
- Merged PRs (30d)
- 3
Description
Created by: benfry
Re-saving the SVG in 1.0 format with Illustrator instead of 1.1 will fix the issue, but the problem seems to be that a leading . in the SVG path code won't render properly, for instance:
M3,.6– parse toM,3,.6(may be fixed with https://github.com/processing/processing4/commit/9ef40ba48c284ae52e7eae759af325486ca85f1e)M.6.7– parse toM,.6, and.7- …etc
This caused a problem with the variable icons, which was fixed commit 805306fd1b4eeeac35bf1c29693d751edf349f57, so using the previous version of the SVGs should do the trick for testing.
Test code:
static final String[] names = {
"array", "boolean", "byte", "char", "double", "float",
"integer", "long", "object", "short", "string"
};
void setup() {
size(250, 550);
textAlign(LEFT, CENTER);
textSize(24);
fill(0);
int each = 50;
int pos = 0;
for (String name : names) {
PShape s = loadShape(name + ".svg");
shape(s, 0, pos, each, each);
text(name, 60, pos + each/2);
pos += each;
}
saveFrame("issue.png");
}

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at loadShape() and the SVG path parsing entry point, then reproduce the supplied sketch with the previous SVG versions mentioned in the issue. Check tokenization for paths such as M3,.6 and M.6.7; done means leading-decimal coordinates parse correctly and the variable icons render as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100