How do I change the font that is used by a button in p5?

I am not sure how I can do this. I have tried all the style() properties that I know, but none of them are able to change the font on a button. Example code I am trying to write:

let drawButton;
let circle = false;

function setup() {
  txt = loadFont('assets/font.ttf');
  createCanvas(800, 800);

  drawButton = createButton('Draw');
  drawButton.position(230, 650);
  drawButton.size(350, 100);
  drawButton.mousePressed(yes);
  drawButton.style('background-color', 'black');
  drawButton.style('font-size', '44px');
  drawButton.style('color', 'white');

  //this code doesn't work the way I want it to
  drawButton.style('font-type', txt);
}

function yes() {
  circle = true
}

function draw() {
  background(220);
  if (circle === true) {
    ellipse(400, 400, 100, 100);
  }
}

Is this p5 or css or…?

1 Like

Maybe it’s drawButton.caption.style(…

1 Like

I tried that and it didn’t work.

You also haven’t answered my question

1 Like

It is p5. It says so in the tag for this question.

1 Like

Maybe you look here

1 Like