processing/processing4

loadShape() problems with SVGs that have . starting a number in a path

Open

#518 aperta il 30 lug 2022

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Java (176 fork)auto 404
has attachmenthelp wanted

Metriche repository

Star
 (439 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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:

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");
}

issue

Guida contributor