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

边栏推荐
- C language force buckle the flipped number of question 7. Violence Act
- Quartus:17.1版本的Quartus安装Cyclone 10 LP器件库
- Pain and happiness -nio programming
- C # "learning code snippet" - recursively obtain all files under the folder
- asp rs.open sql,conn,3,1中3,1代表什么?
- What can testers do when there is an online bug?
- 7.24 party notice
- Advanced multithreading (Part 2)
- Two numbers that appear only once in the array
- GUI basic application
猜你喜欢

Improve static loading dynamic loading

Managing databases in a hybrid cloud: eight key considerations

在混合云中管理数据库:八个关键注意事项

Nodejs package

Leetcode 1260. two dimensional grid migration: two solutions (k simulations / one step)

NXP i.mx6q development board software and hardware are all open source, and the schematic diagram of the core board is provided
![[hero planet July training leetcode problem solving daily] 24th line segment tree](/img/ae/1f3288a99cb07fcbb1836357e0229a.png)
[hero planet July training leetcode problem solving daily] 24th line segment tree
![[help] mindspire training based on ascend910 cannot reproduce the model effect on GPU](/img/b5/c02ef57526d208b02dfa00189e9ecb.jpg)
[help] mindspire training based on ascend910 cannot reproduce the model effect on GPU

Install software on kubernetes cluster using helm 3 package manager
![[mindspore] [xception model] script statement is suspected to be wrong](/img/86/3174f9edadf4b815a76678551cbfa5.jpg)
[mindspore] [xception model] script statement is suspected to be wrong
随机推荐
The use of Multimeter in circuit analysis experiment of Shandong University
Chapter IV drive subsystem development
"Usaco2006nov" corn fields solution
Redis管道技术/分区
The font changes with the change of the form
Pain and happiness -nio programming
[mindspore ascend] [user defined operator] graph_ In mode, customize how to traverse tensor
Educational events
Is qiniu Business School reliable? Is it safe to open Huatai account recommended by the lecturer
ROS机械臂 Movelt 学习笔记3 | kinect360相机(v1)相关配置
mysql初次安装的root密码是什么
Kusionstack open source | exploration and practice of kusion model library and tool chain
asp adodb.stream对象的方法属性
第四章 驱动子系统开发
Server intranet and Extranet
2022 Henan Mengxin League game 2: Henan University of technology K - Rice
Chapter III kernel development
启牛商学院靠谱吗?讲课老师推荐开华泰账户安全吗
Summary of MATLAB basic grammar
asp rs.open sql,conn,3,1中3,1代表什么?