From d9d2b44e2d99fb0c3c97256df264870dd23f7b16 Mon Sep 17 00:00:00 2001 From: Junology Date: Fri, 3 Jan 2025 21:46:46 +0900 Subject: [PATCH] Fix: set stroke and fill properly in PFont.getShape --- core/src/processing/core/PFont.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index 1b54396c5e..29d4efc4be 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -740,7 +740,7 @@ public PShape getShape(char ch, float detail) { // six element array received from the Java2D path iterator float[] iterPoints = new float[6]; // array passed to createGlyphVector - char[] textArray = new char[] { ch }; + char[] textArray = { ch }; //Graphics2D graphics = (Graphics2D) this.getGraphics(); //FontRenderContext frc = graphics.getFontRenderContext(); @@ -755,16 +755,17 @@ public PShape getShape(char ch, float detail) { shp.getPathIterator(null, detail); // convert to line segments int contours = 0; + s.beginShape(); + s.noStroke(); + s.fill(0); while (!iter.isDone()) { int type = iter.currentSegment(iterPoints); switch (type) { case PathIterator.SEG_MOVETO: // 1 point (2 vars) in textPoints - if (contours == 0) { - s.beginShape(); - } else { + if (contours > 0) { s.beginContour(); } - contours++; + ++contours; s.vertex(iterPoints[0], iterPoints[1]); break;