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

边栏推荐
- R language uses ISNA function to check whether the list and dataframe contain missing values, marks abnormal values in data columns in dataframe as missing values Na, and uses na.omit function to dele
- The use of where condition in MySQL is not equal to! = The problem that null values are filtered out occurs when in, etc
- The new version of Alibaba Seata finally solves the idempotence, suspension and empty rollback problems of TCC mode
- Chapter IV drive subsystem development
- 启牛商学院靠谱吗?讲课老师推荐开华泰账户安全吗
- [untitled]
- Redis transaction learning
- 基于ABP实现DDD--领域逻辑和应用逻辑
- Promtool Check
- Current events on July 20
猜你喜欢

Notes on topic brushing (XXII) -- Dynamic Planning: basic ideas and topics

Daily question 1 · 1260. Two dimensional network migration · simulation

Cloud native observability tracking technology in the eyes of Baidu engineers

7.24 party notice
![[performance optimization] MySQL common slow query analysis tools](/img/97/c7604282544c5fa8cd7e85a6ab9154.png)
[performance optimization] MySQL common slow query analysis tools
![Why does [mindspore ascend] [custom operator] repeatedly assign values to one tensor affect another tensor?](/img/e3/135ac1e6eade70082c205d16ab8e34.jpg)
Why does [mindspore ascend] [custom operator] repeatedly assign values to one tensor affect another tensor?

mysql初次安装的root密码是什么

动态规划-01背包滚动数组优化

Pytorch structure reparameterization repvggblock

Install software on kubernetes cluster using helm 3 package manager
随机推荐
C language word translation (to help understand the basic meaning of words) is updated from time to time
Unity slider slider development
Improve static loading dynamic loading
7.24 party notice
Volley7 – networkdispatcher obtains data from the network [easy to understand]
Measurement and Multisim Simulation of volt ampere characteristics of circuit components (engineering documents attached)
Leetcode 0125. validate palindrome string
Wireshark introduction and packet capturing principle and process
Grafana connection tdengine reports an error 535
Educational events
2022 Henan Mengxin League game (2): Henan University of technology d-pair
Chapter IV drive subsystem development
Lambda&Stream
Internal network mapping port to external network
Redis 事务学习有感
Promtool Check
NFT chain game system development metauniverse gamefi construction
进程的几种状态
软考 --- 程序设计语言基础(下)
Simple use of mongodb database