当前位置:网站首页>Esp32 OLED lvgl displays common Chinese characters
Esp32 OLED lvgl displays common Chinese characters
2022-07-25 00:47:00 【Cocoa core Italy】
One 、 Environmental Science
This example is based on esp-idf-5.0 , Let's find a way to build it by ourselves , Or you can refer to my construction environment
Two 、 step
be based on example , Location :
esp-idf-5.0\examples\peripherals\lcd\i2c_oledReference resources Baiwen Of LVGL course , You can get Siyuan font
file :http://lvgl.100ask.net/8.2/tools/fonts-zh-source.html
Video tutorial :https://www.bilibili.com/video/BV1Ya411r7K2?p=15Export Fonts

I made a trick here , Direct use
lv_font_simsun_16_cjkThe name , Replace the original Chinese font , So you don't have to make any big changesNotice here , It's better to start with menuconfig Everything is configured inside , Otherwise, if the configuration is changed , The following error will appear , It means , If you want to run again CMake, You must use something that has not been modified component, Unless we keep this change to the new component Go inside , I'm too lazy to revise , So you can configure the project first , Again ( Everything is lazy …)

Open it directly
i2c_oled\managed_components\lvgl__lvgl\src\font\lv_font_simsun_16_cjk.c, Take the document we just produced , Copy the pastThe head is a little different , It needs to be slightly modified , Then the rest is the same , No need to deal with
/******************************************************************************* * Size: 16 px * Bpp: 1 * Opts: ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE #include "lvgl.h" #else #include "../../lvgl.h" #endif #ifndef LV_FONT_SIMSUN_16_CJK #define LV_FONT_SIMSUN_16_CJK 1 #endifOpen the macro of this Chinese font
i2c_oled\managed_components\lvgl__lvgl\src\lv_conf_internal.h
Happy compilation , Now let's put my test code , Create a new style , Use this font
```cpp
static lv_style_t label_shadow_style1; // Create a style
lv_style_init(&label_shadow_style1); // Initialization style
lv_style_set_text_font(&label_shadow_style1, &lv_font_simsun_16_cjk);
lv_obj_t * Label3 = lv_label_create(scr); // Create a label on the main screen
lv_label_set_long_mode(Label3, LV_LABEL_LONG_DOT); // Label long content box , Maintain control width , If the content is too long, wrap
lv_obj_set_width(Label3, 64); // Set the label width
lv_label_set_recolor(Label3, true); // Enable character command to recolor characters
lv_label_set_text(Label3, " Test Chinese fonts "); // Set display text
lv_obj_align(Label3, LV_ALIGN_CENTER, 0, 0); // Align to the lower center
lv_obj_add_style(Label3, &label_shadow_style1, 0); // Apply effect style
```
3、 ... and 、 test result

边栏推荐
- Pytorch structure reparameterization repvggblock
- Wireshark packet capturing and rapid packet location skills
- Invitation letter | "people, finance, tax" digital empowerment, vigorously promote retail enterprises to achieve "doubling" of economies of scale
- What is the root password of MySQL initial installation
- The use of Multimeter in circuit analysis experiment of Shandong University
- How to better use the touchpad of notebook
- [leetcode weekly replay] game 83 biweekly 20220723
- 494. Target sum · depth first search · knapsack problem
- Mobile terminal touch event
- The number of palindromes in question 9 of C language deduction. Two pointer array traversal method
猜你喜欢

paddlepaddle论文系列之Alexnet详解(附源码)

Daily question 1 · 1260. Two dimensional network migration · simulation
![[LeetCode周赛复盘] 第 303 场周赛20220724](/img/ba/0f16f1f42e4a2593ec0124f23b30d7.png)
[LeetCode周赛复盘] 第 303 场周赛20220724

Summary of MATLAB basic grammar

Wireshark introduction and packet capturing principle and process

Tencent low code platform is officially open source! You can drag and drop and generate mobile phone projects and PC projects! Get private benefits

Unity+photon self made multiplayer TPS game

If real-time intersection with line segments in online CAD drawings is realized

Pain and happiness -nio programming
![[mindspore] [xception model] script statement is suspected to be wrong](/img/86/3174f9edadf4b815a76678551cbfa5.jpg)
[mindspore] [xception model] script statement is suspected to be wrong
随机推荐
Vscode installation and configuration
[mindspore] [xception model] script statement is suspected to be wrong
js && ||
EF core: self referencing organizational structure tree
Improve static loading dynamic loading
C language force buckle the flipped number of question 7. Violence Act
Add the two numbers in the linked list of the second question of C language. Ergodic method
Promtool Check
Does opengauss support using Sqlalchemy connections?
阿里 Seata 新版本终于解决了 TCC 模式的幂等、悬挂和空回滚问题
Volley7 – networkdispatcher obtains data from the network [easy to understand]
Related knowledge of paging
Verification of Kirchhoff's law and Multisim Simulation (engineering documents attached)
Netease game Flink SQL platform practice
[英雄星球七月集训LeetCode解题日报] 第24日 线段树
Promtool Check
[mindspore] [mode] spontaneous_ The difference between mode and graph mode
Mobile terminal touch event
Unity panel control
Educational events