Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: set stroke and fill properly in PFont.getShape #899

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions core/src/processing/core/PFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;

Expand Down
Loading