Seeking ControlP5's Fonts in text()

I seek to know what font is used in ControlP5 library’s button labels. I desire to use the same for text placed on screen using the text() function. No font I have chosen so far looks as good.

example to use same font

  • in CP5 label
  • with text() function
/** ControlP5 Button * by Andreas Schlegel, 2012 * www.sojamo.de/libraries/controlp5 */

import controlP5.*;
ControlP5 cp5;
PFont font;

void setup() {
  size(400,200);
  printArray( PFont.list() ); //_______ list all available fonts
  cp5 = new ControlP5(this);
  font = createFont("Verdana Bold Italic",15); //_ select a font
  textFont(font); //___________________ set font for text function
  cp5.addButton("button")
     .setValue(0)
     .setPosition(100,100)
     .setSize(200,19)
     .setFont(font)
     .setLabel("") 
     ;

  cp5.addLabel("my Button text as label")
     .setPosition(100,100)
     .setSize(200,19)
     .setFont(font) //_________________ set font for CP5
     ;
     
     
  // ControlP5.printPublicMethodsFor(Button.class);
}

void draw() {
  background(200,200,0);
  text("text() function",10,height-20);
}

public void button(int theValue) {
  println("a 'button' event : "+theValue);
}

hope it helps.

It does not help. I seek to know the default font used in the ControlP5 library. In your code example you are setting the font to one you selected.

yes, as you will probably find no way to use the CP5 internal bitmap font
but still want to use one unique font for your app.

It is:

import controlP5.BitFont;

You can browse the source code to see how it is used internally. It extends PFont.

1 Like