CreateFont() doesn't work

Hello, I tried to use the createFont() function, but when I use it, the app just closes.

code:

PFont font;

void setup(){
  font=createFont("FieldGuide.ttf",100);
  textFont(font,100);
}

void draw() {
  background(255);
  fill(0);
  text("just text",50,500);
}

Did I do something wrong? How is there any way to fix this?
Thanks in advance.

Hi @AniManOtaku,

You can checkout this previous thread:

Also do you have any error logs or ways to see debug information?
Is your .ttf file accessible and valid for a font file? Did you try to load it in Processing Java?

1 Like

Hi

Well i tried that and i edited the code so that it shows the error

the code:

PFont myFont; 

void setup() { 
  size(200, 200); 
  background(255); 
  try{
    myFont = createFont("CYRIL1.TTF", 28); 
    fill(0);
    textFont(myFont); 
  }
  catch(Exception e){
    println(e);
  }
  textAlign(CENTER);
  println("Привет мир");
} 

void draw() { 
  text("Привет мир", width/2, height/2);
}

And this is what it shows:

And yeah i put the font in the data folder.

1 Like

Hi
On APDE it’s hard to work but with processing android mode works

1 Like

Unfortunately, i dont have PC.