FS (예 : SD/Spiffs/FATFS)에서 TrueType (.ttf)를 읽고 FrameBuffer를 작성하십시오.
Truetype ™ 참조 매뉴얼
https://developer.apple.com/fonts/truetype-reference-manual/
STM32의 기본 라이브러리는 여기에 있습니다.
//TrueType class declaration
truetypeClass truetype = truetypeClass();
uint8_t *framebuffer;
void setup() {
//Prepare a frame buffer
framebuffer = (uint8_t *)calloc(sizeof(uint8_t), FRAMEBUFFER_SIZE);
//Read TrueType file
//Example in SPIFFS
//I think that SD, FATFS and other codes will be almost the same
SPIFFS.begin(true);
File fontFile = SPIFFS.open("/FONTFILE.ttf", "r");
//Set framebuffer array in TrueType class
//Pay attention to the format of the framebuffer
truetype.setFramebuffer(DISPLAY_WIDTH, DISPLAY_HEIGHT, 4, 0, framebuffer);
//Initial reading of ttf files
if (!truetype.setTtfFile(fontFile)) {
Serial.println("read ttf failed");
return;
}
//TrueType class string parameter settings
truetype.setCharacterSize(100);
truetype.setCharacterSpacing(0);
truetype.setTextBoundary(10, DISPLAY_WIDTH, DISPLAY_HEIGHT);
truetype.setTextColor(0x00, 0x00);
//Write a string to the framebuffer
truetype.textDraw(10, 10, "The quick brown fox jumps over the lazy dog");
//Export framebuffer to screen
FLASH_TO_SCREEN();
//end
truetype.end();
}
uint8_t setttffile (파일 _file, uint8_t _checkchecksum = 0);
void setframebuffer (uint16_t _framebufferwidth, uint16_t _framebufferheight, uint16_t _framebuffer_bit, uint8_t _framebufferdirection, uint8_t *_framebuffer);
void setcharacterspacing (int16_t _characterspace, uint8_t _kerning = 1);
void setcharactersize (uint16_t _charactersize);
void settextBoundary (uint16_t _start_x, uint16_t _end_x, uint16_t _end_y);
void setTextColor (uint8_t _online, uint8_t _inside);
void settextrotation (uint8_t _rotation);

UINT8_T _ROTATION : 회전 각도.
void text draw (uint16_t _x, uint16_t _y, const wchar_t _character []);
void text draw (uint16_t _x, uint16_t _y, const char _character []);
void text draw (uint16_t _x, uint16_t _y, const string _string);
uint16_t getstringwidth (const wchar_t _character []);
uint16_t getstringwidth (const char _character []);
uint16_t getstringwidth (const string _string);
void end ();
비트 방향 프레임 버퍼의 바이트 당 여러 픽셀에 대한 정보를 저장할 때.
프레임 버퍼의 유형은이 방향에 따라 크게 나뉩니다.
현재 지원되는 : 수평 -1,4,8 비트
1 비트 / 1pixel의 예 
1 비트 / 1pixel의 예 
수정 및 개선에 대한 버그 나 아이디어를 자유롭게 게시하십시오!
글꼴 파일의 저작권을 확인하십시오. 글꼴 파일을 배포하지 않았습니다.
Garretlab의 코드를 기반으로하며 변경되었습니다.
https://github.com/garretlab/truetype
https://garretlab.web.fc2.com/arduino/lab/truetype/