setTextSize()
描述
設定文字的大小。預設值是 “1”。每增加 1 代表文字的高度會增加 10 像素,”1″ = 10 像素,”2″ = 20 像素,以此類推。
語法
screen.setTextSize(size);
參數
size: 1~5,型態為 int
回傳
無回傳值
範例
#include <SPI.h>
#include <TFT.h>
#define cs 10
#define dc 9
#define rst 8
TFT screen = TFT(cs, dc, rst);
void setup() {
// 初始化 TFT 物件
screen.begin();
// 設定背景色為黑色
screen.background(0,0,0);
// 用白色填滿顯示的圖形
screen.fill(255,255,255);
// 設定文字大小
screen.setTextSize(1);
// 在左上角顯示文字
screen.text("Testing!", 0, 0);
// 設定文字大小
screen.setTextSize(5);
// 在底部顯示文字
screen.text("BIG!", 0, 10);
}
void loop() {
}
See also
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
