Caching method for character rendering acceleration of embedded environment vector word stock

By using a hash bucket and a bidirectional loop linked list in embedded devices, the position of the character node of the vector font library is dynamically adjusted, which solves the bottleneck of the vector font library rendering performance and excessive memory usage, and achieves efficient character rendering.

CN120371876APending Publication Date: 2025-07-25AITIWEIER ELECTRONICS TECH BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510470457.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

When using vector font library rendering in embedded devices, there are problems such as performance bottlenecks and excessive memory resource usage, especially traditional cache methods fail to effectively improve cache hit rate and rendering performance.

Method used

The hash bucket and a bidirectional circular linked list are combined with the LRU algorithm to dynamically adjust the character node position according to character encoding and usage frequency, and delete the least most recently used node when inserting a new node, and optimize memory usage.

Benefits of technology

It significantly improves the cache hit rate, reduces memory resource consumption, improves the efficiency of vector font library character rendering, and makes the rendering process unaware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371876A_ABST
    Figure CN120371876A_ABST
Patent Text Reader

Abstract

The invention provides a caching method for accelerating character rendering of an embedded environment vector font library, which comprises the following steps of: dynamically adjusting and storing character bitmap data according to character codes and use frequency for accelerating character rendering of the vector font library; when the character bitmap data is loaded, the use frequency of the character nodes is updated, the positions of the character nodes in the hash bucket are adjusted, and the least recently used nodes are reset; when a new character node is inserted, adding 1 to the use frequency of the character node, and when the new character node is inserted, only positioning the character node to a hash bucket, directly inserting the character node to the tail of the bidirectional circular linked list, and setting the character node as the least recently used node; when the new character nodes are inserted, if the sum of the number of the character nodes cached in all the hash buckets exceeds the preset cache node capacity, the least recently used nodes are deleted. The method has the advantages that the positions of the character nodes in the hash bucket are dynamically adjusted by using the frequency, so that quick retrieval and loading are facilitated, and the cache hit rate is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer storage, and particularly to a caching method for accelerating the rendering of vector font library characters in an embedded environment. Background Art

[0002] With the popularization and intelligent development of embedded devices, users' requirements for the aesthetics and personalization of device interfaces are increasing day by day. As an important element in interface design, the rendering effect of fonts directly affects the user experience. Limited by hardware resources, traditional embedded systems usually use dot matrix font libraries for text rendering. Although the rendering speed is fast, there are disadvantages such as distortion after font magnification, inability to support complex glyphs and diverse fonts.

[0003] Vector font libraries use mathematical curves to describe glyph outlines, with advantages such as lossless scaling, beautiful glyphs, and support for multiple fonts, and can better meet the requirements of embedded devices for high-quality text rendering. However, the rendering process of vector font libraries involves complex contour parsing and filling calculations, consuming more computing resources and time compared to dot matrix font libraries. In an embedded environment, directly using a vector font library for real-time rendering will cause performance bottlenecks and affect the user experience.

[0004] To solve the above problems, existing technologies usually adopt a caching mechanism to improve the rendering efficiency of vector font libraries. Common caching schemes include:

[0005] (1) Glyph caching: Store the rendered glyph bitmaps in memory and directly call them when rendering again to avoid repeated parsing and rendering. However, this method requires a large amount of memory space to store bitmap data and is not friendly to embedded systems with limited resources.

[0006] (2) Contour caching: Store the parsed glyph contour data in memory and only perform filling calculations when rendering again. Compared with glyph caching, contour caching occupies less memory, but still requires filling calculations and cannot completely avoid performance overhead.

[0007] In addition, most existing caching methods use a simple least recently used (LRU) strategy for cache replacement, lacking targeted optimization for the resource limitations of embedded systems and font usage characteristics, and it is difficult to achieve optimal cache hit rates and rendering performance under limited resources.

[0008] Therefore, in view of the characteristics of the embedded environment, it is of great significance to design an efficient vector font library caching method with low resource occupancy. Summary of the Invention

[0009] The purpose of the present invention is to provide a caching method for accelerating the rendering of vector font library characters in an embedded environment, so as to solve the aforementioned problems existing in the prior art.

[0010] To achieve the above object, the technical solution adopted by the present invention is as follows:

[0011] A caching method for accelerating the rendering of vector font library characters in an embedded environment, which dynamically adjusts and stores character bitmap data according to character encoding and usage frequency for accelerating the rendering of vector font library characters;

[0012] When loading character bitmap data, update the usage frequency of the character node, adjust the position of the character node in the hash bucket, so that the character nodes with high usage frequency in the hash bucket are arranged in the front position in the hash bucket, that is, sort the character nodes in the hash bucket in ascending order of usage frequency, and reset the least recently used node;

[0013] When inserting a new character node, the usage frequency of the character node is incremented by 1. It must be the least recently used node. When inserting, only need to locate the hash bucket and directly insert it into the tail of the doubly circular linked list, and set it as the least recently used node; when inserting a new character node, if the sum of the number of character nodes cached in all hash buckets exceeds the preset cache node capacity, delete the least recently used node.

[0014] Preferably, use the character encoding as the key of the hash function to locate the hash bucket where the character node is located; use a doubly circular linked list as the data structure of the hash bucket. The data field of the doubly circular linked list is of void type and is used to store the address of the custom type data dynamically allocated by the user; the doubly circular linked list is a headless doubly circular linked list, and the first node is the data storage node. When there is no character node in the hash bucket, directly destroy the doubly circular linked list representing the hash bucket.

[0015] Preferably, the caching method specifically includes the following steps:

[0016] S1. Input the character encoding and hash map it to the corresponding doubly circular linked list according to the character encoding;

[0017] S2. Traverse backward from the head of the doubly circular linked list to find a character node that matches the stretching and deformation parameters of the character encoding; if the character node is found, go to step S3; otherwise, go to step S4;

[0018] S3. Increment the usage frequency of the character node by 1, and keep the doubly circular linked list sorted in ascending order of usage frequency, select the least recently used node in all doubly circular linked lists, and return the node;

[0019] S4. Load the character node from the vector font library, call the cache insertion interface, and insert the new character node; determine whether the current cache node capacity in the hash bucket is greater than the preset capacity. If so, after deleting the least recently used node, go to step S5; otherwise, directly go to step S5;

[0020] S5. Hash map to the corresponding doubly circular linked list according to the character encoding, insert the new character node into the end of the list, set it as the least recently used node, set the usage frequency of the character node to 1, and return the node.

[0021] Preferably, when using the caching method at the application layer,

[0022] (1) It is necessary to declare a custom data type, and the type must include two fields: usage frequency and character encoding; according to the characteristics of the vector font library, bitmap data, deformation parameters, font size, font height, bitmap width, bitmap height, bitmap type, and horizontal offset can also be provided in the custom data type.

[0023] (2) Create a cache. When creating a cache, the number of hash buckets and the node capacity need to be provided; when creating a cache, an array of hash tables will be created according to the number of hash buckets. Each element of the hash table array is NULL, indicating that the current hash bucket / doubly circular linked list is empty. The doubly circular linked list serving as the hash bucket has no head node. If the stored address of the hash table is NULL, it means that there is no node in this hash bucket. Only when the first character node is inserted into this hash bucket, a doubly circular linked list will be created; the node capacity is used to limit the number of nodes stored in the entire cache.

[0024] Preferably, the cache algorithm provides a custom data type registration interface, a custom data type data comparison registration interface, a custom data type data acquisition registration interface, a custom data type destruction registration interface, a character encoding value acquisition registration interface, a usage frequency increment registration interface, and a usage frequency acquisition registration interface to customize the corresponding character data structure and character node search conditions, and can optimize the memory for the data structure of the character node according to the current embedded environment used at the application layer and release the occupied memory space.

[0025] Preferably, the custom data type data comparison registration interface is used to register a custom data type comparison function; the custom data type comparison function is a function used to compare whether the queried character node matches the expected character node;

[0026] The implementation process of the custom data type comparison function is as follows: The input parameters are pointers to two custom data types: pointer A and pointer B; assume that the custom data type contains the following fields: character encoding, usage frequency, deformation type, deformation multiple, and font size; then set the following conditions in the comparison function: the character encoding of pointer A = the character encoding of pointer B AND the deformation type of pointer A = the deformation type of pointer B AND the deformation multiple of pointer A = the deformation multiple of pointer B AND the font size of pointer A = the font size of the pointer. If the condition is true, return 1, otherwise return 0;

[0027] The custom data type data destruction registration interface is used to register a custom data type destruction function; the custom data type destruction function is a function used to destroy the memory space allocated in the heap memory inside the custom data type;

[0028] The implementation process of the custom data type destruction function is that the input parameter is a pointer to the custom data type, and internally calls the memory release function to release the fields allocated in the heap memory, and sets the corresponding fields to null after release.

[0029] Preferably, the character encoding acquisition registration interface is used to register a character encoding function; the character encoding function is a function used to acquire the character encoding field in the custom data type;

[0030] The implementation process of the character encoding function is that the input parameter is a pointer to the custom data type, and returns the character encoding field in the custom data type;

[0031] The usage frequency increment registration interface is used to register a usage frequency increment function; the usage frequency increment function is a function used to increment the usage frequency by 1 when a character node is queried;

[0032] The implementation process of the usage frequency increment function is that the input parameter is a pointer to the custom data type, and increments the usage frequency field in the custom data pointed to by the pointer by one;

[0033] The usage frequency acquisition registration interface is used to register a usage frequency acquisition function, and the usage frequency acquisition function is a function used to acquire the usage frequency field in the custom data type;

[0034] The implementation process of the usage frequency acquisition function is: the input parameter is a pointer to the custom data type, and returns the usage frequency field in the custom data type.

[0035] Preferably, the caching method also provides a cache destruction interface, and the cache destruction interface is used to release the heap memory occupied by the cache; when the vector font library and the caching method are not used, it is necessary to call the cache destruction interface to destroy it. At this time, the cache destruction interface of the doubly circular linked list will be called to destroy the character nodes stored in the doubly circular linked list in sequence, and then release the heap memory space occupied by the hash table to complete the destruction of the cache.

[0036] Preferably, the caching method further provides a cache query interface, which is used to find character nodes in the cache and call the screen display interface to render the character after finding it; when the cache query interface queries character nodes, it first uses a hash function to locate the hash bucket mapped by the character encoding. If the hash bucket is empty, it directly returns not found. Otherwise, it traverses the hash bucket from start to end and uses a custom data type comparison function to compare the traversed character node with the expected character node. If a node with the same conditions is found, its usage frequency is incremented, and its position in the hash bucket where it is located is adjusted to keep the order in the hash bucket as nodes with higher usage frequencies first and nodes with lower usage frequencies later, ensuring that nodes with higher usage frequencies are queried first. After adjusting the order, it is necessary to elect the latest least recently used node among all hash buckets, and only the tail nodes of each doubly circular linked list need to be compared.

[0037] Preferably, the caching method further provides a cache insertion interface, which is used to insert custom type data into the cache; if the cache query interface fails to find a character node, it calls the vector font library to load glyphs and outlines and generate a bitmap, uses a custom data type to dynamically allocate a memory space, fills in the glyph parameters, character encoding, deformation features, and bitmap data of the newly loaded character, then calls the cache insertion interface to insert the character into the cache, and then calls the screen display interface to render the character;

[0038] When inserting a new character node, first determine whether the sum of the character nodes stored in all hash buckets in the current cache is greater than the node capacity passed in when creating the cache. If it is greater, delete the least recently used node and then insert the new character node; otherwise, insert it directly; when inserting a character node, first use the hash function to locate the hash bucket mapped by the character encoding. If this hash bucket is empty, create a new doubly circular linked list as the hash bucket, and the first node of this list is the new node; after the new node is inserted, it should be set as the least recently used node. When deleting a character node, if the hash bucket where the deleted character node is located has only one node, directly destroy the doubly circular linked list representing the hash bucket.

[0039] The beneficial effects of the present invention are as follows: 1. By using the frequency to dynamically adjust the position of character nodes in the hash bucket, the present invention method facilitates quick retrieval and loading, significantly improving the cache hit rate. The provided various registration interfaces facilitate the storage and retrieval of bitmap data and parameters of vector font library characters of different types. It is convenient for transplantation and can adapt to its task scheduling interface according to different system environments, and can store characters with the same character encoding but multiple different deformation parameters. 2. The present invention method combines the LRU (Least Recently Used) algorithm idea, the restricted embedded environment, and the parameter characteristics of the vector font library, consuming as little memory resources as possible to accelerate character rendering, making the rendering process of characters displayed on the screen invisible to the human eye. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a flowchart of the cache method in an embodiment of the present invention;

[0041] Figure 2 is a schematic diagram of the interface of the cache method in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0042] In order to make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0043] As Figure 1 shown, in this embodiment, a cache method for accelerating the rendering of vector font library characters in an embedded environment is provided. This method dynamically adjusts and stores character bitmap data according to character encoding and usage frequency for accelerating the rendering of vector font library characters.

[0044] In this embodiment, the LRU algorithm idea is implemented using a hash table + doubly circular linked list and usage frequency, and the present invention method is designed in combination with the vector font library and the resource-restricted embedded environment.

[0045] When loading character bitmap data, update the usage frequency of the character node, adjust the position of the character node in the hash bucket, and reset the least recently used node.

[0046] When the sum of the number of character nodes cached in all hash buckets exceeds the preset cache node capacity, delete the least recently used node.

[0047] In this embodiment, the character encoding is used as the key of the hash function to locate the hash bucket where the character node is located. Since the hash table is created using the chaining method, the hash function uses the remainder method, and the number of hash buckets is used as the modulus p.

[0048] Use a doubly circular linked list as the data structure of the hash bucket. The data field of the doubly circular linked list is of void type and is used to store the addresses of custom type data dynamically allocated by users. This doubly circular linked list has no head node, and the first node is the data storage node. When there is no character node in a hash bucket, the algorithm directly destroys the doubly circular linked list representing the hash bucket.

[0049] Use a custom data type data comparison function as the query condition to query character nodes. After locating the hash bucket using the character encoding, call the comparison function. If the comparison function returns 1, the node is found; otherwise, it is not found. In the comparison function, fields such as deformation parameters, font sizes, and font heights can be compared, which depends on what fields are included in the custom data type.

[0050] In this embodiment, when loading character bitmap data, update the usage frequency of character nodes and adjust the positions of character nodes in the hash bucket so that the nodes with higher usage frequencies in the hash bucket are arranged in the front positions in the hash bucket, that is, sorted in ascending order of usage frequency, and reset the least recently used node.

[0051] When inserting a new character, its usage frequency is 1, and it must be the least recently used node. When inserting, only need to locate the hash bucket and directly insert it at the end of the list, and set it as the least recently used node.

[0052] When inserting a new character, if the sum of the number of character nodes cached in all hash buckets exceeds the preset cache node capacity, delete the least recently used node.

[0053] When users use the method of the present invention, there are two parts of operations:

[0054] (1) It is necessary to declare a custom data type, and the following fields must be provided in the custom data type: usage frequency and character encoding.

[0055] It is also possible to provide the following fields in the custom data type according to the characteristics of the vector font library (the vector font library is used to load and generate glyphs, outlines, bitmaps, etc. of vector characters): bitmap data, deformation parameters (such as: horizontal deformation, vertical deformation), font size, font height, bitmap width, bitmap height, bitmap type, horizontal and vertical offset, etc. Optimization can be done on the memory occupancy of the members of the custom data type according to one's own embedded platform. For example, in a 32-bit embedded platform, memory optimization can be done according to the platform memory characteristics and the characteristic parameters of the vector font library used. For example, if the range of the font size is 1 to 72 and there are only a few types in the bitmap type field, these fields can be set to the uint_8 type. If the range of the character encoding is 0x0000 to 0xFFFF, this field can be set to the uint_16 type, etc. If the usage frequency field needs to set a large range, it can be set to the uint32_t type. It is also possible to perform memory alignment on the custom data type using #pragma pack(push,n) and #pragma pack(pop) according to the requirements to save memory.

[0056] (2) Create a cache. When creating, the number of hash buckets and the node capacity need to be provided. When creating a cache, a hash table array will be created according to the number of hash buckets. Each element of the array is NULL, indicating that the current hash bucket / doubly circular linked list is empty. The doubly circular linked list serving as the hash bucket has no head node. If the storage address of the hash table is NULL, it means that there are no nodes in this hash bucket. Only when the first character node is inserted into this hash bucket will a doubly circular linked list be created. The node capacity is used to limit the number of nodes stored in the entire cache.

[0057] When using the method of the present invention, the corresponding task scheduling interface should be adapted according to one's own embedded platform to support multi-threaded use.

[0058] As Figure 2 shown, the present invention provides a custom data type registration interface, a custom data type data destruction registration interface, a custom data type data comparison registration interface, a custom data type data acquisition registration interface, a character encoding acquisition registration interface, a usage frequency increment registration interface, and a usage frequency increment acquisition interface, which are used to customize one's own character data structure and character node search conditions. Users can optimize the memory of the data structure of the character node according to the embedded environment used, occupying as little memory space as possible.

[0059] 1. Custom data type data comparison registration interface: The custom data type data comparison registration interface is used to register a custom data type comparison function; the custom data type comparison function is a function used to compare whether the queried character node matches the expected character node.

[0060] Internal implementation of the custom data type comparison function: The input parameters are pointers to two custom data types: Pointer A and Pointer B. Assume that the custom data type contains the following fields: character encoding, usage frequency, deformation type, deformation multiple, and font size. Then, the following conditions can be set in the comparison function: If (the character encoding of Pointer A = the character encoding of Pointer B AND the deformation type of Pointer A = the deformation type of Pointer B AND the deformation multiple of Pointer A = the deformation multiple of Pointer B AND the font size of Pointer A = the font size of the pointer), if the condition is true, return 1; otherwise, return 0.

[0061] 2. Custom data type data destruction registration interface: The custom data type data destruction registration interface is used to register a custom data type destruction function; the custom data type destruction function is a function used to destroy the memory space allocated in the heap memory inside the custom data type.

[0062] Internal implementation of the custom data type destruction function: The input parameter is a pointer to the custom data type. Internally, it calls a memory release function, such as free(), to release the fields allocated in the heap memory, and sets the corresponding fields to null after release.

[0063] 3. Character encoding acquisition registration interface: The character encoding acquisition registration interface is used to register a character encoding function; the character encoding function is a function used to obtain the character encoding field in the custom data type.

[0064] Internal implementation of the character encoding function: The input parameter is a pointer to the custom data type, and it returns the character encoding field in the custom data type.

[0065] 4. Usage frequency increment registration interface: The usage frequency increment registration interface is used to register a usage frequency increment function; the usage frequency increment function is a function used to increment the usage frequency by 1 when a character node is queried.

[0066] Internal implementation of the usage frequency increment function: The input parameter is a pointer to the custom data type, and it increments the usage frequency field in the custom data pointed to by the pointer by one.

[0067] 5. Usage frequency acquisition registration interface: The usage frequency acquisition registration interface is used to register a usage frequency acquisition function, and the usage frequency acquisition function is a function used to obtain the usage frequency field in the custom data type.

[0068] Internal implementation of the usage frequency acquisition function: The input parameter is a pointer to the custom data type, and it returns the usage frequency field in the custom data type.

[0069] The present invention provides task scheduling interface adaptation to support different embedded platforms and systems. Users can create, destroy caches, and perform insertion and query operations on caches at the application layer.

[0070] 1. Cache destruction interface: The cache destruction interface is used to release the heap memory occupied by the cache. When the vector font library and this cache algorithm are not in use, it is necessary to call the cache destruction interface to destroy them. At this time, the destruction interface of the doubly circular linked list will be called to sequentially destroy the character nodes stored in the doubly circular linked list, and then the heap memory space occupied by the hash table will be released to complete the destruction of the cache.

[0071] 2. Cache query interface: The cache query interface is used to find character nodes in the cache. After finding, the screen display interface can be called to render the character. The screen display interface is used to display graphics and text on the screen, and this interface is provided by the user's own embedded platform or written by the user himself. When the query interface queries character nodes, it first uses a hash function to locate the hash bucket mapped by the character encoding. If the hash bucket is empty, it directly returns not found. Otherwise, it traverses the hash bucket from beginning to end and uses the custom data type comparison function registered by the user to compare the traversed character node with the expected character node. If a node with the same condition is found, its usage frequency is incremented, and the position of the node in its hash bucket is adjusted to keep the order in the hash bucket as nodes with high usage frequency first and nodes with low usage frequency later, so as to ensure that nodes with high usage frequency are queried first as much as possible. After adjusting the order, it is necessary to elect the latest least recently used node among all hash buckets, and only the tail nodes of each doubly circular linked list need to be compared.

[0072] 3. Cache Insertion Interface: The cache insertion interface is used to insert custom type data into the cache. If the query interface fails to find a character node, the vector font library is called to load the glyph and outline and generate a bitmap. Using its own custom data type, a memory space is dynamically allocated, and the glyph parameters, character encoding, deformation features, and bitmap data of the newly loaded character are filled in. Then, the insertion interface provided by the cache algorithm is called to insert the character into the cache, and then the screen display interface is called to render the character. When inserting a new character node, first judge whether the sum of the character nodes stored in all hash buckets in the current cache is greater than the node capacity passed in when creating the cache. If it is greater, the least recently used node is deleted, and then the new character node is inserted; otherwise, it is inserted directly. When inserting a character node, first use the hash function to locate the hash bucket mapped by the character encoding. If this hash bucket is empty, a new doubly circular linked list is created as the hash bucket, and the first node of this linked list is the new node. After the new node is inserted, it should be set as the least recently used node (the usage frequency of the newly inserted node is definitely the lowest). When deleting a character node, if the hash bucket where the deleted character node is located has only one node, the doubly circular linked list representing the hash bucket is directly destroyed.

[0073] By adopting the above technical solutions disclosed in the present invention, the following beneficial effects are obtained:

[0074] The present invention provides a cache method for accelerating the character rendering of a vector font library in an embedded environment. By dynamically adjusting the position of character nodes in the hash bucket according to the usage frequency, it is convenient for quick retrieval and loading, and significantly improves the cache hit rate; the provided various registration interfaces facilitate the storage and retrieval of bitmap data and parameters of different types of vector font library characters; it is easy to transplant, and according to different system environments, its task scheduling interface can be adapted, and it can store characters with the same character encoding and various different deformation parameters. The method of the present invention combines the LRU (Least Recently Used) algorithm idea, the limited embedded environment, and the parameter characteristics of the vector font library, consumes as little memory resources as possible, accelerates character rendering, and makes the rendering process of the characters displayed on the screen invisible to the human eye.

[0075] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also fall within the protection scope of the present invention.

Claims

1. A caching method for accelerating the rendering of vector font library characters in an embedded environment, characterized in that: Dynamically adjust and store character bitmap data according to character encoding and usage frequency for accelerating the rendering of vector font library characters; When loading character bitmap data, update the usage frequency of character nodes, adjust the positions of character nodes in the hash bucket, so that the character nodes with high usage frequency in the hash bucket are arranged in the front positions in the hash bucket, that is, sort the character nodes in the hash bucket in ascending order of usage frequency, and reset the least recently used node; When inserting a new character node, the usage frequency of the character node is incremented by 1. It must be the least recently used node. When inserting, only need to locate the hash bucket and directly insert it into the tail of the doubly circular linked list, and set it as the least recently used node; when inserting a new character node, if the sum of the number of character nodes cached in all hash buckets exceeds the preset cache node capacity, delete the least recently used node.

2. The caching method for accelerating the character rendering of vector font libraries in an embedded environment according to claim 1, wherein: Use the character encoding as the key of the hash function to locate the hash bucket where the character node is located; Use a doubly circular linked list as the data structure of the hash bucket. The data field of the doubly circular linked list is of void type and is used to store the address of user-defined type data dynamically allocated; the doubly circular linked list is a headless doubly circular linked list, and the first node is the data storage node. When there is no character node in the hash bucket, directly destroy the doubly circular linked list representing the hash bucket.

3. The caching method for accelerating character rendering of vector font libraries in an embedded environment according to claim 2, wherein: The caching method specifically includes the following steps: S1. Input the character encoding and hash map it to the corresponding doubly circular linked list according to the character encoding; S2. Traverse backward from the head of the doubly circular linked list to find a character node that matches the stretching and deformation parameters of the character encoding; if the character node is found, go to step S3; otherwise, go to step S4; S3. Increment the usage frequency of the character node by 1, and keep the doubly circular linked list sorted in ascending order of usage frequency, select the least recently used node in all doubly circular linked lists, and return the node; S4. Load the character node from the vector font library, call the cache insertion interface, and insert the new character node; judge whether the current cache node capacity in the hash bucket is greater than the preset capacity. If so, after deleting the least recently used node, go to step S5; Otherwise, directly go to step S5; S5. Hash map according to the character encoding to the corresponding doubly circular linked list, insert the new character node into the tail of the list, and set it as the least recently used node. The usage frequency of the character node is 1, and return the node.

4. The cache method for accelerating the rendering of vector font library characters in an embedded environment according to claim 3, wherein: When using the caching method in the application layer, (1) It is necessary to declare a custom data type, and the type must include two fields: usage frequency and character encoding; it is also possible to provide fields such as bitmap data, deformation parameters, font size, font height, bitmap width, bitmap height, bitmap type, and horizontal offset in the custom data type according to the characteristics of the vector font library; (2) Create a cache. When creating the cache, the number of hash buckets and the node capacity need to be provided. When creating the cache, an array of hash tables will be created according to the number of hash buckets. Each element of the hash table array is NULL, indicating that the current hash bucket / doubly circular linked list is empty. The doubly circular linked list serving as the hash bucket has no head node. If the stored address in the hash table is NULL, it means that there are no nodes in this hash bucket. Only when the first character node is inserted into this hash bucket will a doubly circular linked list be created. The node capacity is used to limit the number of nodes stored in the entire cache.

5. The cache method for accelerating the rendering of vector font library characters in an embedded environment according to claim 4, characterized in that: The cache algorithm provides a custom data type registration interface, a custom data type data comparison registration interface, a custom data type data acquisition registration interface, a custom data type destruction registration interface, a character encoding value acquisition registration interface, a usage frequency increment registration interface, and a usage frequency acquisition registration interface to customize the corresponding character data structure and character node search conditions. When using the cache method at the application layer, it can optimize the memory for the data structure of the character nodes according to the current embedded environment used and release the occupied memory space.

6. The caching method for accelerating character rendering of vector font libraries in an embedded environment according to claim 5, characterized in that: The custom data type data comparison registration interface is used to register a custom data type comparison function. The custom data type comparison function is a function used to compare whether the queried character node matches the expected character node. The implementation process of the custom data type comparison function is as follows: The input parameters are pointers to two custom data types: pointer A and pointer B. Assume that the custom data type contains the following fields: character encoding, usage frequency, deformation type, deformation multiple, and font size. Then set the following conditions in the comparison function: the character encoding of pointer A = the character encoding of pointer B AND the deformation type of pointer A = the deformation type of pointer B AND the deformation multiple of pointer A = the deformation multiple of pointer B AND the font size of pointer A = the font size of the pointer. If the condition is true, return 1; otherwise, return 0. The custom data type data destruction registration interface is used to register a custom data type destruction function. The custom data type destruction function is a function used to destroy the memory space allocated in the heap memory inside the custom data type. The implementation process of the custom data type destruction function is that the input parameter is a pointer to the custom data type, and internally calls the memory release function to release the fields allocated in the heap memory and set the corresponding fields to NULL after release.

7. The caching method for accelerating character rendering of vector font libraries in an embedded environment according to claim 6, wherein: The character encoding acquisition registration interface is used to register a character encoding function. The character encoding function is a function used to obtain the character encoding field in the custom data type. The implementation process of the character encoding function is that the input parameter is a pointer to the custom data type, and it returns the character encoding field in the custom data type. The usage frequency increment registration interface is used to register a usage frequency increment function. The usage frequency increment function is a function used to increment the usage frequency by 1 when a character node is queried. The implementation process of the usage frequency increment function is that the input parameter is a pointer to the custom data type, and it increments the usage frequency field in the custom data pointed to by the pointer by one. The usage frequency acquisition registration interface is used to register a usage frequency acquisition function, and the usage frequency acquisition function is a function for acquiring the usage frequency field in a custom data type; The implementation process of the usage frequency acquisition function is as follows: the input parameter is a pointer to a custom data type, and the usage frequency field in the custom data type is returned.

8. The caching method for accelerating character rendering of vector font libraries in an embedded environment according to claim 7, wherein: The caching method also provides a cache destruction interface, which is used to release the heap memory occupied by the cache; when the vector font library and the caching method are not in use, it is necessary to call the cache destruction interface to destroy them. At this time, the cache destruction interface of the doubly circular linked list will be called to destroy the character nodes stored in the doubly circular linked list one by one, and then the heap memory space occupied by the hash table will be released to complete the destruction of the cache.

9. The caching method for accelerating the rendering of vector font library characters in an embedded environment according to claim 8, wherein: The caching method also provides a cache query interface, which is used to find a character node in the cache and call the screen display interface to render the character after finding it; When the cache query interface queries a character node, it first uses a hash function to locate the hash bucket mapped by the character encoding. If the hash bucket is empty, it directly returns not found. Otherwise, it traverses the hash bucket from beginning to end, and uses a custom data type comparison function to compare the traversed character node with the expected character node. If a node with the same condition is found, its usage frequency is incremented, and the position of the node in its hash bucket is adjusted to keep the order in the hash bucket as nodes with higher usage frequencies first and nodes with lower usage frequencies later, ensuring that nodes with higher usage frequencies are queried first. After adjusting the order, it is necessary to elect the latest least recently used node among all hash buckets, and only the tail nodes of each doubly circular linked list need to be compared.

10. The cache method for accelerating character rendering of vector font libraries in an embedded environment according to claim 9, wherein: The caching method also provides a cache insertion interface, which is used to insert custom type data into the cache; if the cache query interface does not find a character node, it calls the vector font library to load the glyph and outline and generate a bitmap, uses a custom data type to dynamically allocate a memory space, fills in the glyph parameters, character encoding, deformation features, and bitmap data of the newly loaded character, then calls the cache insertion interface to insert the character into the cache, and then calls the screen display interface to render the character; When inserting a new character node, first judge whether the sum of the character nodes stored in all hash buckets in the current cache is greater than the node capacity passed in when creating the cache. If it is greater, the least recently used node is deleted, and then the new character node is inserted; otherwise, it is directly inserted; when inserting a character node, first use the hash function to locate the hash bucket mapped by the character encoding. If this hash bucket is empty, a new doubly circular linked list is created as the hash bucket, and the first node of this list is the new node; after the new node is inserted, it is set as the least recently used node. When deleting a character node, if the hash bucket where the deleted character node is located has only one node, the doubly circular linked list representing the hash bucket is directly destroyed.