当前位置:网站首页>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

边栏推荐
- If real-time intersection with line segments in online CAD drawings is realized
- Multi merchant mall system function disassembly Lecture 14 - platform side member level
- The new version of Alibaba Seata finally solves the idempotence, suspension and empty rollback problems of TCC mode
- How to better use the touchpad of notebook
- [help] mindspire training based on ascend910 cannot reproduce the model effect on GPU
- Chapter IV drive subsystem development
- Unity slider slider development
- The model needs to use two losses_ FN, how to operate?
- Soft test --- fundamentals of programming language (Part 2)
- The troubleshooting process of a segment error (disassembly address troubleshooting)
猜你喜欢

Quartus:17.1版本的Quartus安装Cyclone 10 LP器件库

Cloud native observability tracking technology in the eyes of Baidu engineers

Managing databases in a hybrid cloud: eight key considerations
![[leetcode weekly replay] game 83 biweekly 20220723](/img/db/c264c94ca3307d4363d3cf7f5d770b.png)
[leetcode weekly replay] game 83 biweekly 20220723

Oracle is not null cannot filter null values

The new version of Alibaba Seata finally solves the idempotence, suspension and empty rollback problems of TCC mode

如果实现与在线CAD图中的线段实时求交点

Kusionstack open source | exploration and practice of kusion model library and tool chain

Nodejs package

动态规划-01背包滚动数组优化
随机推荐
GUI basic application
What can testers do when there is an online bug?
Heap and stack in embedded development
Lambda&Stream
[mindspore] [mode] spontaneous_ The difference between mode and graph mode
2022 Henan Mengxin League game 2: Henan University of technology K - Rice
The use of Multimeter in circuit analysis experiment of Shandong University
分页的相关知识
Improve static loading dynamic loading
Educational codeforces round 89 (rated for Div. 2) ABC problem solution
Number of palindromes in question 5 of C language deduction (two methods)
Unity3d calls between different script functions or parameters
Basic functions of tea
Heavy forecast! Analysys, together with Microsoft and the Central University of Finance and economics, talks about the digital economy
Codeworks round 651 (Div. 2) ABCD solution
Nodejs package
360 interview summary 2013 campus recruitment 2012-4-4
Wireshark introduction and packet capturing principle and process
[mindspore] [xception model] script statement is suspected to be wrong
Promtool Check