Ink Screen Font Library Tutorial

From Waveshare Wiki
Jump to: navigation, search

The following are examples of Chinese characters. We take the Raspberry Pi demo with a 2.13 V3 ink screen as an explanation, and other demos/fonts are similar.

Add the Chinese Font Library

Here is an example of adding font24CN.c.
Open the Zimo221.7z software and follow the steps below to configure the software.
Choose "Font selection for the text area."

Ink Screen Font Library Tutorial01.jpg

Please select the corresponding font type according to the picture, and click "OK" after completing the configuration.
Font: Microsoft YaHei
Style: Regular
Size: 24
Character set: GB2312

Ink Screen Font Library Tutorial02.jpg

Select "Other options".

Ink Screen Font Library Tutorial03.jpg

Select the corresponding configuration according to the picture, and then click "OK".
Pattern extraction method: Horizontal extraction.
Keep a comma at the end of the reserved byte.
We will use C51 pattern extraction later, so the A51 format can be ignored.

Ink Screen Font Library Tutorial04.jpg
①Input the Chinese characters here, and then press Ctrl + Enter.
②The preview of the inputted Chinese characters is displayed in Location 2.
③Click on the C51 format on the left side for the pattern extraction.
④The corresponding hexadecimal data will be generated afterward.
Ink screen Font Library Tutorial05.jpg
Ink screen font library tutorial06.jpg

Open the corresponding file of the demo. The software I am using here is VS Code. Change the format from UTF-8 to GB2312.

Ink screen font library tutorial07.jpg
Ink screen font library tutorial08.jpg
Ink screen font library tutorial09.jpg

To copy and modify the data that has just been extracted to the corresponding file according to the file format:

Ink screen font library tutorial10.jpg

Open the "EPD_2in13_V3_test.c" file and replace "微雪电子" with "中文字库". Compile and run the demo, you will see that the previous "微雪电子" on the demo has been changed to "中文字库".

Ink screen font library tutorial11.jpg
Ink screen font library tutorial12.jpg
Ink screen font library tutorial13.jpg

Add New Font Library

Here is an example of adding font48CN.c.
Open the Zimo221.7z software and follow the steps below to configure the software.
Choose "Font selection for the text area."

Ink Screen Font Library Tutorial01.jpg

Please select the corresponding font type according to the picture, and click "OK" after completing the configuration.
Font: Microsoft YaHei
Style: Regular
Size: 48
Character set: GB2312

Ink Screen Font Library Tutoria12.jpg

Select "Other options".

Ink Screen Font Library Tutorial03.jpg

Select the corresponding configuration according to the picture, and click "OK" after completing the configuration.
Pattern extraction method: Horizontal extraction.
Keep a comma at the end of the reserved byte.
We will use C51 pattern extraction later, so the A51 format can be ignored.

Ink Screen Font Library Tutorial04.jpg
①Input the Chinese characters here, and then press Ctrl + Enter.
②The preview of the inputted Chinese characters is displayed in Location 2.
③Click on the C51 format on the left side for the pattern extraction.
④The corresponding hexadecimal data will be generated afterward.
Ink screen Font Library Tutorial05.jpg
Ink screen font library tutorial06.jpg

Create a new font48CN.c file in the corresponding file directory:

Ink screen font library tutorial6.jpg

Follow the example of font24CN.c file and add the corresponding data to the font48CN.c file:

Ink screen font library tutorial7.jpg

Modify font.h file data:

Ink screen font library tutorial8.jpg
Ink screen font library tutoria21.jpg

Open the file EPD_2in13_V3_test.c and modify it to the demo shown in the figure:

Ink screen font library tutorial9.jpg

The display effect is shown below:

Ink screen font library tutoria20.jpg