TFT.setTextSize()

名称

TFT.setTextSize()

説明

文字列のサイズを設定する。デフォルトサイズは"1"である。サイズを1増やすと、高さが10ピクセル増える。size 1が10ピクセル、size 2が20ピクセル、…である。

書式

void Adafruit_GFX::setTextSize(uint8_t s);

引数

s1-5。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <SPI.h>
#include <TFT.h>            // Arduino TFT library

#define cs   10
#define dc   9
#define rst  8

TFT screen = TFT(cs, dc, rst);

void setup() {
  // initialize the screen
  screen.begin();

  // make the background black
  screen.background(0,0,0);

  // set the stroke color to white
  screen.fill(255,255,255);

  // default text size
  screen.setTextSize(1);
  // write text to the screen in the top left corner
  screen.text("Testing!", 0, 0);
  // increase text size
  screen.setTextSize(5);
  // write text to the screen below
  screen.text("BIG!", 0, 10);
}

void loop() {

}

オリジナルのページ

https://www.arduino.cc/reference/en/libraries/tft/settextsize/

最終更新日

January 8, 2024

inserted by FC2 system