Skip to content

Commit 8b2a705

Browse files
Fix transcoding of line elements
Do not use `PrintWriter.format` that is using current locale and thus can create incorrect floating number representation. Fixes #406
1 parent 3a755ad commit 8b2a705

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tools/svg-transcoder/src/main/java/org/pushingpixels/radiance/tools/svgtranscoder/api/SvgBaseTranscoder.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ public void format(String format, Object... args) {
129129
this.currentWriter.format(format, args);
130130
}
131131

132-
public void format(Locale l, String format, Object... args) {
133-
this.currentWriter.format(l, format, args);
134-
}
135-
136132
public void checkin() {
137133
if (this.lines >= ROTATION_THRESHOLD) {
138134
this.currentWriter.close();
@@ -380,8 +376,8 @@ private void transcodeShape(Shape shape, String suffix) throws UnsupportedOperat
380376
Line2D l2df = (Line2D) shape;
381377
printWriterManager.print("shape" + suffix + " = "
382378
+ languageRenderer.getObjectCreation("Line2D.Float"));
383-
printWriterManager.format("(%ff,%ff,%ff,%ff)", (float) l2df.getX1(), (float) l2df.getY1(),
384-
(float) l2df.getX2(), (float) l2df.getY2());
379+
printWriterManager.print("(" + (float) l2df.getX1() + "f," + (float) l2df.getY1() + "f,"
380+
+ (float) l2df.getX2() + "f," + (float) l2df.getY2() + "f)");
385381
printWriterManager.println(languageRenderer.getStatementEnd());
386382
return;
387383
}

0 commit comments

Comments
 (0)