The following code create two windows when my sketch is run:
Main file:
PWindow pwindow;
PFont font;
void setup() {
size(800, 800);
pwindow = new PWindow();
}
Second file:
class PWindow extends PApplet {
PWindow() {
super();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
}
void settings() {
size(400,400);
}
void setup() {
font = loadFont("AppleSymbols-24.vlw");
textFont(font, 24);
text("test", 100, 100);
}
}
Everything works, however, processing can’t seem to locate the font file in the data folder when I use loadFont
in my second file (RuntimeException: Could not load font AppleSymbols-24.vlw. Make sure that the font has been copied to the data folder of your sketch.
). But when I put loadFont
in my main file’s setup
, it is able to load with no error. How can I get processing to locate the font in the data folder when I attempt to load it from a file that’s not my main file?