CN113326087A - Chinese character library processing method and device on LVGL - Google Patents

Chinese character library processing method and device on LVGL Download PDF

Info

Publication number
CN113326087A
CN113326087A CN202110545319.2A CN202110545319A CN113326087A CN 113326087 A CN113326087 A CN 113326087A CN 202110545319 A CN202110545319 A CN 202110545319A CN 113326087 A CN113326087 A CN 113326087A
Authority
CN
China
Prior art keywords
character
chinese
lvgl
character library
characters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110545319.2A
Other languages
Chinese (zh)
Other versions
CN113326087B (en
Inventor
胡文
黄金华
于嘉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ASR Microelectronics Co Ltd
Original Assignee
ASR Microelectronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ASR Microelectronics Co Ltd filed Critical ASR Microelectronics Co Ltd
Priority to CN202110545319.2A priority Critical patent/CN113326087B/en
Publication of CN113326087A publication Critical patent/CN113326087A/en
Application granted granted Critical
Publication of CN113326087B publication Critical patent/CN113326087B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding

Abstract

The application discloses a Chinese character library processing method on LVGL. A text file containing chinese characters is provided. Utf8 encoding of each character in the text file is extracted and converted to unicode encoding. And generating a Chinese character library in a C file form from the text file by utilizing a conversion tool provided by an LVGL system framework according to unicode codes of each character in the text file. And adding the generated Chinese character library in the form of the C file to the tail of the character library linked list with the corresponding character size. When the electronic equipment displays a text, the LVGL system framework inquires utf8 codes of characters to be displayed and converts the utf8 codes into unicode codes. The LVGL system framework searches each font file one by one in a font chain table with the size of the font size to be displayed according to unicode codes of characters to be displayed; and returning corresponding dot matrix bitmap data when the corresponding dot matrix bitmap data is found, and drawing the corresponding characters on a screen by the LVGL system framework. The method and the device have the advantage that the Chinese can be displayed in the LVGL system framework which does not support the Chinese display originally.

Description

Chinese character library processing method and device on LVGL
Technical Field
The present application relates to a method of processing a chinese language library on an electronic device to display chinese.
Background
At present, there are two GUI (graphical user interface) schemes used by electronic devices adopting embedded systems (embedded systems), wherein an Android GUI system frame is used by a high-end electronic device, and a miniGUI system frame is used by a low-end electronic device. The android GUI system framework has a large code amount and cannot be stored in an electronic device with a limited storage space. The miniGUI system framework is old in function, not rich in picture effect and not small enough in code volume.
LVGL (Light and virtual Graphics Library) is a new GUI system framework, which has the advantages of small code amount and easy UI (user interface) development, and can load firmware of electronic devices with only 16MB of flash memory space. However, the LVGL system framework only supports a few English word libraries at present and does not support Chinese word libraries; therefore, the electronic device using the LVGL as the GUI system frame can only display english and common english characters, and cannot display chinese and common chinese characters.
Disclosure of Invention
The technical problem to be solved by the application is to add a Chinese character library in an LVGL system framework and enable a User Interface (UI) to support Chinese character display.
In order to solve the above technical problem, the present application provides a method for processing a chinese character library on an LVGL, comprising the following steps. Step S1: a text file containing the chinese characters is provided as a chinese library to be imported into an electronic device that employs LVGL as a GUI system framework. Step S2: extracting the utf8 code of each character in the text file, and converting the utf8 code of each character in the text file into unicode code. Step S3: and exporting the bitmap of each character in the text file according to unicode coding of each character in the text file by using a conversion tool provided by an LVGL system framework, generating a Chinese character library in a C file form, and storing the Chinese character library in the firmware of the electronic equipment. Step S4: and adding the generated Chinese character library in the form of the C file to the tail of the character library linked list with the corresponding character size. Step S5: when the electronic equipment displays a text, the LVGL system framework inquires utf8 codes of characters to be displayed, and converts the utf8 codes of the characters to be displayed into unicode codes. Step S6: the LVGL system framework searches each character library file in the character library linked list one by one according to unicode codes of characters to be displayed in the character library linked list with the size of the character size to be displayed; and finding unicode codes of the characters to be displayed in the array of any character library, returning corresponding dot matrix bitmap data, and drawing the corresponding characters on a screen by the LVGL system framework.
Further, the text file contains 6000 commonly used Chinese characters. Chinese characters can be deleted or added in the text file according to the actual needs of a client.
Further, the text file also contains common chinese characters.
Further, after the step S3 is completed, a chinese character library in the form of a C file is generated corresponding to each text file.
Further, the step S3 is repeated to generate a plurality of chinese character libraries in the form of C files with different font sizes, and the chinese character libraries are saved in the electronic device.
Further, when the body text in the user interface of the electronic device uses a font with a height of 20 pixels and the title uses a font with a height of 30 pixels, the step S4 is repeated twice to generate two libraries of chinese characters in the form of C-files with a height of 20 pixels and a height of 30 pixels, respectively.
Further, when the number of the Chinese characters used for the title in the user interface of the electronic device is smaller than the number of the Chinese characters used for the text, a text file containing only the Chinese characters required for the title is prepared, and the steps S1 to S3 are repeated to generate a reduced version Chinese character library in the form of a C file with the size of the title characters.
Further, in step S4, in the LVGL system framework, the word banks with the same word size are managed by using one word bank linked list, and the word banks with different word sizes are managed by using different word bank linked lists.
Further, in step S6, the first traversal in the word stock linked list is the english word stock, and if the english word stock cannot find the unicode code of the character to be displayed, the next word stock is skipped to through the word stock linked list until the chinese word stock.
The application also provides a Chinese character library processing device on the LVGL, which comprises a text providing unit, an extraction conversion unit, a character library conversion unit, a linked list adding unit, an inquiry conversion unit and a retrieval display unit. The text providing unit is used for providing a text file containing Chinese as a Chinese character library to be imported into the electronic equipment, and the electronic equipment adopts LVGL as a GUI system framework. The extraction and conversion unit is used for extracting the utf8 code of each character in the text file and converting the utf8 code of each character in the text file into unicode code. The word stock conversion unit is used for exporting the bitmap of each character in the text file according to unicode coding of each character in the text file by using a conversion tool provided by an LVGL system framework, generating a Chinese word stock in a C file form and storing the Chinese word stock in the firmware of the electronic equipment. The linked list adding unit is used for adding the generated Chinese character library in the C file form to the tail of the linked list of the character libraries with corresponding word sizes. The query conversion unit is used for querying the utf8 code of the character to be displayed when the text is displayed by the electronic equipment, and converting the utf8 code of the character to be displayed into unicode code. The retrieval display unit is used for retrieving each character library file in the character library linked list one by one according to unicode codes of characters to be displayed in the character library linked list with the size of the character size to be displayed; and finding unicode codes of the characters to be displayed in the array of any character library, returning corresponding dot matrix bitmap data, and drawing the corresponding characters on a screen by the LVGL system framework.
The technical effect that this application obtained is: on the GUI framework of the LVGL with the minimum code quantity, a processing method of a Chinese character library is newly added, so that the Chinese character library can display Chinese characters and Chinese characters with different character sizes, and the functional requirements of electronic equipment are met.
Drawings
Fig. 1 is a schematic flow chart of a chinese character library processing method on LVGL according to the present application.
Fig. 2 is a schematic structural diagram of a chinese character library processing apparatus on the LVGL of the present application.
The reference numbers in the figures illustrate: the system comprises a text providing unit 1, an extraction and conversion unit 2, a word stock conversion unit 3, a linked list adding unit 4, an inquiry and conversion unit 5 and a retrieval and display unit 6.
Detailed Description
Referring to fig. 1, the method for processing a chinese character library on LVGL of the present application includes the following steps.
Step S1: a text file (txt format) containing chinese and common chinese characters is provided as a chinese library to be imported into an electronic device that employs LVGL as a GUI system framework. Preferably, the text file contains 6000 frequently used Chinese characters. The common Chinese characters include commas, periods, question marks, and the like.
Step S2: extracting the utf8 code of each character in the text file, and converting the utf8 code of each character in the text file into unicode code.
Step S3: the LVGL system framework provides a conversion tool for exporting bitmaps of unicode-encoded corresponding characters input by a user as C-files. This step uses the conversion tool provided by the LVGL system framework to export the bitmap of each character in the text file according to the unicode code of each character in the text file, generate a chinese character library in the form of a C file and store the chinese character library in the firmware of the electronic device. And generating a Chinese character library in the form of a C file corresponding to each text file.
Preferably, in order to meet the requirement that the electronic device displays chinese in different sizes, the step S3 is repeated to generate a plurality of chinese libraries in the form of C files in different sizes, and the chinese libraries are saved in the electronic device. For example, the body text in the UI of the electronic device is in a font of 20 pixels in height and the title is in a font of 30 pixels in height, the step S4 is repeated twice to generate two libraries of chinese characters in the form of C-files of 20 pixels in height and 30 pixels in height, respectively.
Preferably, the number of Chinese characters used for the title in the UI of the electronic device is much smaller than the number of Chinese characters used for the body, for example, the title only needs dozens of Chinese characters, and then step S1 to step S3 are repeated to prepare a text file containing only dozens of required Chinese characters, and a reduced version Chinese character library in the form of a C file with the size of the title characters is generated. The obtained simplified version of the C file has small volume of the character library, and does not waste the storage space of the electronic equipment.
Step S4: in the LVGL system framework, word banks with the same word size are managed by adopting one word bank linked list, and word banks with different word sizes are managed by adopting different word bank linked lists. For example, a word library linked list one links all word libraries of 20 pixels height. And all the word banks with the height of 30 pixels are linked in the word bank linked list II. This step increases the chinese character library in the form of the C-file generated at step S4 to the end of the library linked list of the corresponding word size.
Step S5: when the electronic equipment displays a text, the LVGL system framework inquires utf8 codes of characters to be displayed, and converts the utf8 codes of the characters to be displayed into unicode codes.
Step S6: the LVGL system framework searches each of the font files one by one according to unicode codes of characters to be displayed in the font size font chain table to be displayed. The first traversal in the word stock linked list is the English word stock, if the English word stock can not find the unicode code of the character to be displayed, the next word stock is jumped to through the word stock linked list until the Chinese word stock. No matter which character library array finds the unicode code of the character to be displayed, corresponding dot matrix bitmap data is returned, and the LVGL system framework draws the corresponding character on a screen.
Referring to fig. 2, the apparatus for processing a chinese character library on an LVGL of the present application includes a text providing unit 1, an extracting and converting unit 2, a character library converting unit 3, a linked list adding unit 4, an inquiring and converting unit 5, and a retrieval and display unit 6. The apparatus shown in fig. 2 corresponds to the method shown in fig. 1.
The text providing unit 1 is used to provide a text file containing chinese and common chinese characters as a chinese character library to be imported into an electronic device using LVGL as a GUI system framework.
The extraction and conversion unit 2 is used for extracting the utf8 code of each character in the text file and converting the utf8 code of each character in the text file into unicode code.
The word stock conversion unit 3 is configured to export a bitmap of each character in the text file according to unicode coding of each character in the text file by using a conversion tool provided by an LVGL system framework, generate a chinese word stock in a C-file form, and store the chinese word stock in the firmware of the electronic device.
The linked list adding unit 4 is used for adding the generated Chinese character library in the form of the C file to the tail of the linked list of the character libraries with corresponding word sizes.
The query conversion unit 5 is used for querying the utf8 code of the character to be displayed when the text is to be displayed by the electronic device, and converting the utf8 code of the character to be displayed into unicode code.
The retrieval display unit 6 is used for retrieving each character library file in the character library linked list one by one according to unicode codes of characters to be displayed in the character library linked list with the size of the character size to be displayed. And finding unicode codes of the characters to be displayed in the array of any character library, returning corresponding dot matrix bitmap data, and drawing the corresponding characters on a screen by the LVGL system framework.
The method and the device have the advantage that the Chinese can be displayed in the LVGL system framework which does not support the Chinese display originally.
The above are merely preferred embodiments of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A Chinese character library processing method on LVGL is characterized by comprising the following steps;
step S1: providing a text file containing Chinese characters as a Chinese character library to be imported into electronic equipment, wherein the electronic equipment adopts LVGL as a GUI system framework;
step S2: extracting the utf8 code of each character in the text file, and converting the utf8 code of each character in the text file into unicode code;
step S3: exporting bitmaps of each character in the text file according to unicode codes of each character in the text file by using a conversion tool provided by an LVGL system framework, generating a Chinese character library in a C file form, and storing the Chinese character library in the firmware of the electronic equipment;
step S4: adding the generated Chinese character library in the C file form to the tail of a character library linked list with the corresponding character size;
step S5: when the electronic equipment displays a text, the LVGL system framework inquires utf8 codes of characters to be displayed, and converts the utf8 codes of the characters to be displayed into unicode codes;
step S6: the LVGL system framework searches each character library file in the character library linked list one by one according to unicode codes of characters to be displayed in the character library linked list with the size of the character size to be displayed; and finding unicode codes of the characters to be displayed in the array of any character library, returning corresponding dot matrix bitmap data, and drawing the corresponding characters on a screen by the LVGL system framework.
2. The method of claim 1, wherein the text file comprises 6000 commonly used Chinese characters.
3. The method of library processing on LVGL of claim 1, wherein said text file further comprises common chinese characters.
4. The method as claimed in claim 1, wherein after the step S3, a chinese character library in the form of C-file is generated for each text file.
5. The method as claimed in claim 1, wherein the step S3 is repeated to generate a plurality of C-files with different font sizes and store the C-files in the electronic device.
6. The method as claimed in claim 5, wherein when the text in the user interface of the electronic device is in a font of 20 pixels height and the title is in a font of 30 pixels height, the step S4 is repeated twice to generate two C-files of 20 pixels height and 30 pixels height.
7. The method as claimed in claim 5, wherein when the number of the Chinese characters used for the title in the user interface of the electronic device is less than the number of the Chinese characters used for the body text, the step S1 to the step S3 are repeated to prepare a text file containing only the Chinese characters required for the title, and a C-file-type reduced version of the Chinese character library with the title size is generated.
8. The method as claimed in claim 1, wherein in step S4, the word banks with the same word size are managed by using one word bank linked list, and the word banks with different word sizes are managed by using different word bank linked lists in the LVGL system framework.
9. The method as claimed in claim 1, wherein in step S6, the first traversal in the word stock linked list is an english word stock, and if the english word stock cannot find the unicode code of the character to be displayed, the next word stock is skipped to until the chinese word stock.
10. A Chinese character library processing device on LVGL is characterized by comprising a text providing unit, an extraction conversion unit, a character library conversion unit, a linked list adding unit, an inquiry conversion unit and a retrieval display unit;
the text providing unit is used for providing a text file containing Chinese as a Chinese character library to be imported into the electronic equipment, and the electronic equipment adopts LVGL as a GUI system framework;
the extraction and conversion unit is used for extracting the utf8 code of each character in the text file and converting the utf8 code of each character in the text file into unicode code;
the word stock conversion unit is used for exporting the bitmap of each character in the text file according to unicode codes of each character in the text file by using a conversion tool provided by an LVGL system framework, generating a Chinese word stock in a C file form and storing the Chinese word stock in the firmware of the electronic equipment;
the linked list increasing unit is used for increasing the generated Chinese character library in the C file form to the tail of the linked list of the character library with the corresponding character size;
the query conversion unit is used for querying the utf8 code of the character to be displayed when the text is displayed by the electronic equipment, and converting the utf8 code of the character to be displayed into unicode code;
the retrieval display unit is used for retrieving each character library file in the character library linked list one by one according to unicode codes of characters to be displayed in the character library linked list with the size of the character size to be displayed; and finding unicode codes of the characters to be displayed in the array of any character library, returning corresponding dot matrix bitmap data, and drawing the corresponding characters on a screen by the LVGL system framework.
CN202110545319.2A 2021-05-19 2021-05-19 Chinese character library processing method and device on LVGL Active CN113326087B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110545319.2A CN113326087B (en) 2021-05-19 2021-05-19 Chinese character library processing method and device on LVGL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110545319.2A CN113326087B (en) 2021-05-19 2021-05-19 Chinese character library processing method and device on LVGL

Publications (2)

Publication Number Publication Date
CN113326087A true CN113326087A (en) 2021-08-31
CN113326087B CN113326087B (en) 2023-01-24

Family

ID=77416279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110545319.2A Active CN113326087B (en) 2021-05-19 2021-05-19 Chinese character library processing method and device on LVGL

Country Status (1)

Country Link
CN (1) CN113326087B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4883291A (en) * 1988-05-11 1989-11-28 Telesis Controls Corporation Dot matrix formed security fonts
JP2000357197A (en) * 1999-04-16 2000-12-26 Konica Corp Document issuing device and system provided with external character registration information converting function, and method for managing external character registration information
US20030226118A1 (en) * 2002-05-28 2003-12-04 E C D Interactive Corp. Method of uploading and editing words at a network station
CN1983239A (en) * 2006-04-06 2007-06-20 华为技术有限公司 Method and system for inputting and displaying character
CN101008939A (en) * 2007-01-25 2007-08-01 深圳创维-Rgb电子有限公司 Implementation method of dot matrix word library of embedded system
CN101477441A (en) * 2009-01-21 2009-07-08 上海闻泰电子科技有限公司 Method for displaying and inputting symbol in mobile terminal
CN101483035A (en) * 2009-01-12 2009-07-15 腾讯科技(深圳)有限公司 Method and system for display text on graphical interface
CN102880690A (en) * 2012-09-18 2013-01-16 北京汉仪科印信息技术有限公司 Method for simplifying character library of electronic book, and processing device for electronic book
US20160148538A1 (en) * 2014-11-20 2016-05-26 Sultan Qaboos University Method and system to convert portable document format file to braille
US20170121370A1 (en) * 2012-10-30 2017-05-04 Esperance Pharmaceuticals, Inc. Antibody/drug conjugates and methods of use
KR20180002967A (en) * 2016-06-29 2018-01-09 엘지디스플레이 주식회사 Light valve panel and liquid crystal display device using the same
CN107948078A (en) * 2017-11-01 2018-04-20 上海斐讯数据通信技术有限公司 A kind of method and system of router screen display Chinese
CN111353114A (en) * 2018-12-20 2020-06-30 深圳市茁壮网络股份有限公司 Font display processing method and device

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4883291A (en) * 1988-05-11 1989-11-28 Telesis Controls Corporation Dot matrix formed security fonts
JP2000357197A (en) * 1999-04-16 2000-12-26 Konica Corp Document issuing device and system provided with external character registration information converting function, and method for managing external character registration information
US20030226118A1 (en) * 2002-05-28 2003-12-04 E C D Interactive Corp. Method of uploading and editing words at a network station
CN1983239A (en) * 2006-04-06 2007-06-20 华为技术有限公司 Method and system for inputting and displaying character
CN101008939A (en) * 2007-01-25 2007-08-01 深圳创维-Rgb电子有限公司 Implementation method of dot matrix word library of embedded system
CN101483035A (en) * 2009-01-12 2009-07-15 腾讯科技(深圳)有限公司 Method and system for display text on graphical interface
CN101477441A (en) * 2009-01-21 2009-07-08 上海闻泰电子科技有限公司 Method for displaying and inputting symbol in mobile terminal
CN102880690A (en) * 2012-09-18 2013-01-16 北京汉仪科印信息技术有限公司 Method for simplifying character library of electronic book, and processing device for electronic book
US20170121370A1 (en) * 2012-10-30 2017-05-04 Esperance Pharmaceuticals, Inc. Antibody/drug conjugates and methods of use
US20160148538A1 (en) * 2014-11-20 2016-05-26 Sultan Qaboos University Method and system to convert portable document format file to braille
KR20180002967A (en) * 2016-06-29 2018-01-09 엘지디스플레이 주식회사 Light valve panel and liquid crystal display device using the same
CN107948078A (en) * 2017-11-01 2018-04-20 上海斐讯数据通信技术有限公司 A kind of method and system of router screen display Chinese
CN111353114A (en) * 2018-12-20 2020-06-30 深圳市茁壮网络股份有限公司 Font display processing method and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHANGYUAN HU ET AL: "Automatic synthesis of contrast controlled grayscale characters with component-based parametrisable fonts", 《 PROCEEDINGS 1999 INTERNATIONAL CONFERENCE ON IMAGE PROCESSING (CAT. 99CH36348)》 *
HUANGCHENG188: "littlevgl 6.0 外部spiflash 显示中文", 《CSDN或开元中国:LITTLEVGL 6.0 外部SPIFLASH 显示中文:HTTPS://BLOG.CSDN.NET/HC_HUANGCHENG/ARTICLE/DETAILS/108465880或HTTPS://MYOSCHINA.NET.U/4415996/BLOG/4556602》 *
余辉等: "多种字库在嵌入式系统中的应用", 《武汉工业学院学报》 *

Also Published As

Publication number Publication date
CN113326087B (en) 2023-01-24

Similar Documents

Publication Publication Date Title
US10417348B2 (en) Method for processing and loading web pages supporting multiple languages and system thereof
US7512533B2 (en) Method and system of creating and using chinese language data and user-corrected data
CN101271463B (en) Structure processing method and system of layout file
CN104753540B (en) Data compression method, data decompression method and apparatus
CN101996160B (en) Method and system for processing script data
US20090109227A1 (en) System and method for independent font substitution of string characters
CN101196917A (en) Implementing method and apparatus for sharing letter form
CN104881469A (en) Data exporting method and device
CN102147790B (en) Text type-setting method and type-setting engine
CN101963954A (en) Method and device for displaying words
US8862989B2 (en) Extensible input method editor dictionary
US7900143B2 (en) Large character set browser
CN102970596A (en) Method and system for realizing multi-language font display of set top box and set top box
CN101483035B (en) Method and system for display text on graphical interface
CN109086256B (en) Method for generating and using variable-length word stock dot matrix
CN104424192A (en) Method and device for forming multi-font font library and method and device for displaying different fonts
JP5551660B2 (en) Computer-implemented method for encoding text into matrix code symbols, computer-implemented method for decoding matrix code symbols, encoder for encoding text into matrix code symbols, and decoder for decoding matrix code symbols
CN113326087B (en) Chinese character library processing method and device on LVGL
CN112433995B (en) File format conversion method, system, computer device and storage medium
CN104424163B (en) Literal processing method and system
US8656371B2 (en) System and method of report representation
CN104536947A (en) Layout document processing method and device
CN102467490B (en) Font data processing method and device
CN111597292A (en) Text formatting cleaning method based on webpage label position
EP3385860A1 (en) Compression of text using multiple dynamic dictionaries

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant