LoginSignup
1
0

More than 1 year has passed since last update.

ControlP5の文字サイズを変更する

Posted at

ControlP5使ってて文字サイズを変更できなくて調べても違ったのでメモ書き

ボタンの文字サイズを変更したい

ボタンの文字が妙に小さくて困った
image.png

main.java
void setup() {
  ControlP5 cp = new ControlP5(this);
  cp.addButton("Reset")
    .setSize(width/5*2, height/20)
    .setPosition(width/10*3, height-height/20);
}

調べて出たもの(違ったver)

.captionLabel()はないってエラーメッセージが出たので没

ヒントになったサイト

How to have a different font size inside the text field than the font size of its description with ControlP5?
こう書いてあった

setFont.java
cp5.getController("input").getCaptionLabel().setFont(new ControlFont(controlFont));

getCaptionLabel()じゃね?

結論

フォントサイズ変更.java
void setup() {
  float fontSize = 48;
  ControlFont font = new ControlFont(createFont("MS Gothic",fontSize));
  ControlP5 cp = new ControlP5(this);
  Button b = cp.addButton("Reset");
  b.setSize(width/5*2, height/20);
  b.setPosition(width/10*3, height-height/20);
  b.getCaptionLabel().setFont(font);
}

無事変更されました ださい
image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0