Closed knupel closed 2 years ago
Hey @StanLepunK 👋 Could you share the error you're getting with the existing code?
Hello @SableRaf like I write the function loadFont(String)
cannot accept argument loadFont(String, int)
see in the Processing core PApplet.java>PApplet>loadFont(String)
public PFont loadFont(String filename) {
if (!filename.toLowerCase().endsWith(".vlw")) {
throw new IllegalArgumentException("loadFont() is for .vlw files, try createFont()");
}
try {
InputStream input = createInput(filename);
return new PFont(input);
} catch (Exception e) {
die("Could not load font " + filename + ". " +
"Make sure that the font has been copied " +
"to the data folder of your sketch.", e);
}
return null;
}
It's why I think there an error in the example https://processing.org/reference/loadFont_.html
size(400, 400);
PFont font;
// The font must be located in the sketch's
// "data" directory to load successfully
font = loadFont("LetterGothicStd.otf", 128); // BAD
textFont(font, 128);
text("word", 50, 200);
must be like that
size(400, 400);
PFont font;
// The font must be located in the sketch's
// "data" directory to load successfully
font = loadFont("LetterGothicStd.otf"); // GOOD
textFont(font, 128);
text("word", 50, 200);
Et voilà, tralalala
Good catch @StanLepunK, thanks! 👍 Fixed in next release.
Hello, maybe there is an error in the example for the https://processing.org/reference/loadFont_.html
I think the good thing is
I think when the
int
is used to define the font size is forcreateFont(String, int);