Skip to content

Commit 7b2a490

Browse files
authored
Merge pull request #910 from Junology/pfontshape
Fix: set stroke and fill properly in PFont.getShape
2 parents 5e1161c + 56d3659 commit 7b2a490

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: core/src/processing/core/PFont.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public PShape getShape(char ch, float detail) {
740740
// six element array received from the Java2D path iterator
741741
float[] iterPoints = new float[6];
742742
// array passed to createGlyphVector
743-
char[] textArray = new char[] { ch };
743+
char[] textArray = { ch };
744744

745745
//Graphics2D graphics = (Graphics2D) this.getGraphics();
746746
//FontRenderContext frc = graphics.getFontRenderContext();
@@ -755,16 +755,17 @@ public PShape getShape(char ch, float detail) {
755755
shp.getPathIterator(null, detail); // convert to line segments
756756

757757
int contours = 0;
758+
s.beginShape();
759+
s.noStroke();
760+
s.fill(0);
758761
while (!iter.isDone()) {
759762
int type = iter.currentSegment(iterPoints);
760763
switch (type) {
761764
case PathIterator.SEG_MOVETO: // 1 point (2 vars) in textPoints
762-
if (contours == 0) {
763-
s.beginShape();
764-
} else {
765+
if (contours > 0) {
765766
s.beginContour();
766767
}
767-
contours++;
768+
++contours;
768769
s.vertex(iterPoints[0], iterPoints[1]);
769770
break;
770771

0 commit comments

Comments
 (0)