{"id":16991549,"url":"https://github.com/takkao/m5fontrender","last_synced_at":"2025-04-12T03:31:48.568Z","repository":{"id":53490897,"uuid":"319044275","full_name":"takkaO/M5FontRender","owner":"takkaO","description":"TTF font render library for M5Stack with Arduino IDE.","archived":false,"fork":false,"pushed_at":"2021-08-18T08:24:28.000Z","size":1890,"stargazers_count":19,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T22:02:22.784Z","etag":null,"topics":["arduino-ide","font","m5stack","ttf"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takkaO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-06T13:50:03.000Z","updated_at":"2025-02-24T09:21:09.000Z","dependencies_parsed_at":"2022-08-19T15:40:14.134Z","dependency_job_id":null,"html_url":"https://github.com/takkaO/M5FontRender","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takkaO%2FM5FontRender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takkaO%2FM5FontRender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takkaO%2FM5FontRender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takkaO%2FM5FontRender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takkaO","download_url":"https://codeload.github.com/takkaO/M5FontRender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512762,"owners_count":21116674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino-ide","font","m5stack","ttf"],"created_at":"2024-10-14T03:26:29.639Z","updated_at":"2025-04-12T03:31:48.054Z","avatar_url":"https://github.com/takkaO.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# M5 Font Render\r\n\r\n## 🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧\r\n\r\n### 🚨 Now we have released a better library !\r\n### 🚨 We recommend you to use [Open Font Render](https://github.com/takkaO/OpenFontRender) !\r\n\r\n## 🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧\r\n\r\nTTF font render support for M5Stack / M5Core2 with Arduino IDE.  \r\nThis library can render TTF font files in the SD card or TTF font files embedded in the program.\r\n\r\n![image](https://github.com/takkaO/M5FontRender/blob/images/sample.jpg?raw=true)\r\n\r\n\r\n## How to use\r\n1. Clone this repository into Arduino library directory.\r\n2. Include ```M5FontRender.h``` **AFTER include MtStack.h / M5Core2.h**.\r\n\r\n## Sample code\r\n#### Load TTF from binary TTF file\r\n```c++\r\n#include \"M5Core2.h\"\r\n#include \"binaryttf.h\" // This is font file\r\n#include \"M5FontRender.h\" // Include after M5Stack.h / M5Core2.h\r\n\r\nM5FontRender render;\r\n\r\nvoid setup() {\r\n\t// put your setup code here, to run once:\r\n\tM5.begin();\r\n\tM5.Lcd.fillScreen(BLACK);\r\n\t\r\n\t// Load TTF from C header file\r\n\tif (!render.loadFont(binaryttf, sizeof(binaryttf))) {\r\n\t\tSerial.println(\"Render initialize error\");\r\n\t\treturn;\r\n\t}\r\n\r\n\trender.setTextColor(WHITE);\r\n\trender.printf(\"Hello World\\n\");\r\n\trender.seekCursor(0, 10);\r\n\trender.setTextSize(30);\r\n\trender.setTextColor(GREEN);\r\n\trender.printf(\"完全なUnicodeサポート\\n\");\r\n\trender.seekCursor(0, 10);\r\n\trender.setTextSize(40);\r\n\trender.setTextColor(ORANGE);\r\n\trender.printf(\"こんにちは世界\\n\");\r\n}\r\n\r\nvoid loop() {\r\n\t// put your main code here, to run repeatedly:\r\n\r\n}\r\n```\r\n\r\n#### Load TTF from SD card\r\n```c++\r\n#include \"M5Core2.h\"\r\n#include \"M5FontRender.h\" // Include after M5Stack.h / M5Core2.h\r\n\r\nM5FontRender render;\r\n\r\nvoid setup() {\r\n\t// put your setup code here, to run once:\r\n\tM5.begin();\r\n\tM5.Lcd.fillScreen(BLACK);\r\n\t\r\n\t// Load TTF from microSD card\r\n\tif (!render.loadFont(\"/JKG-M_3.ttf\")) {\r\n\t\tSerial.println(\"Render initialize error\");\r\n\t\treturn;\r\n\t}\r\n\r\n\trender.setTextColor(WHITE);\r\n\trender.printf(\"Hello World\\n\");\r\n\trender.seekCursor(0, 10);\r\n\trender.setTextSize(30);\r\n\trender.setTextColor(GREEN);\r\n\trender.printf(\"完全なUnicodeサポート\\n\");\r\n\trender.seekCursor(0, 10);\r\n\trender.setTextSize(40);\r\n\trender.setTextColor(ORANGE);\r\n\trender.printf(\"こんにちは世界\\n\");\r\n}\r\n\r\nvoid loop() {\r\n\t// put your main code here, to run repeatedly:\r\n\r\n}\r\n```\r\n\r\n## How to create binary TTF file\r\nWe use [binary2ttf.py](https://github.com/takkaO/M5FontRender/tree/master/tools/ttf2bin) in tools directory to create binary TTF font file.  \r\nThe ```binary2ttf.py``` is provided in the [M5EPD](https://github.com/m5stack/M5EPD/tree/main/tools/ttf2bin) library.\r\nThe same program is included in ```tools``` directory in this repo.  \r\nYou only execute below command.\r\n\r\n```sh\r\npython3 binary2ttf.py your_font_file.ttf\r\n```\r\n\r\n## Reduce TTF font size\r\nBy deleting unnecessary characters in a TTF font file, you can reduce the size of the TTF font file.  \r\nI used [「サブセットフォントメーカー」](https://opentype.jp/subsetfontmk.htm) to reduce TTF font size. (I'm sorry. I was not able to find English lang software.)\r\n\r\n## Note\r\nWe have used below font file for the sample program.  \r\nWe would like to thank sozai-font-hako for providing us with an easy-to-use license for these wonderful fonts.\r\n\r\n| Font | Copyright | \r\n| --- | --- | \r\n|[JK Gothic M](http://font.cutegirl.jp/jk-font-medium.html#i)|Copyright  (c) 2014 M+ FONTS PROJECT \u003cbr\u003e Copyright  (c) 2015 JK FONTS|\r\n\r\n## Reference\r\n- [m5stack/M5EPD - github](https://github.com/m5stack/M5EPD)\r\n- [h1romas4/m5stack-core2-template at freetype - github](https://github.com/h1romas4/m5stack-core2-template/tree/freetype)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakkao%2Fm5fontrender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakkao%2Fm5fontrender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakkao%2Fm5fontrender/lists"}