Configuration method, device and storage medium of flash memory font library
By compressing and optimizing the storage of character data, the problem of slow reading speed caused by cross-block reading of character data in existing technologies is solved, achieving faster character data reading and higher storage efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-18
- Publication Date
- 2026-03-13
AI Technical Summary
The existing character data storage method in the font library results in cross-block reading, which leads to slow reading speed.
The system compresses the character data to be stored using a preset standard compression ratio and stores it separately in a standard character library. It then searches for and outputs the character data based on the character encoding, font data, and character model data in external instructions, thus optimizing the storage and retrieval of the character data.
By reducing the number of times character data is searched and optimizing storage space utilization, read speed and storage efficiency are improved.
Smart Images

Figure CN115221132B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of chip manufacturing, and in particular to a method, apparatus and storage medium for configuring a flash memory word library. Background Technology
[0002] A font library is software embedded in a hardware chip. Many mobile phone programs, control information, and font library information are stored in a dedicated chip. The main part of the chip is the font library, which contains several read blocks for storing character data.
[0003] In the process of developing this application, the inventors discovered that the technology has at least the following problems: the existing font library directly stores all character data uniformly, and there are cases where some character data are stored in different reading blocks. When the computer reads these character data, it needs to read across blocks, which makes the reading speed slow. Summary of the Invention
[0004] To improve the speed of reading character data, this application provides a method, apparatus, and storage medium for configuring a flash memory font library.
[0005] In a first aspect, this application provides a method for configuring a flash memory font library, which uses the following techniques to obtain character data to be stored;
[0006] Compress the character data to be stored using a preset standard compression ratio;
[0007] The compressed character data to be stored is stored separately in the standard character library;
[0008] Obtain external instructions to be processed, including character encoding, font data, and character model data;
[0009] According to the character encoding, the corresponding character unit is searched in the standard character library;
[0010] Based on the font data, find the font unit corresponding to the font data in the character unit;
[0011] Based on the character model data, the corresponding character data is searched in the font unit and output.
[0012] By optimizing the standard character library through the above technical solution, the character data in the standard character library can be stored separately, which helps to reduce the number of times character data is searched when reading character data, thereby improving the reading speed.
[0013] In one specific implementation scheme, after acquiring the character data to be stored, the method further includes:
[0014] The character data to be stored is compared with commonly used characters in a preset common character library;
[0015] If there is a commonly used character that is consistent with the character data to be stored, then the character data to be stored is determined to be a commonly used character;
[0016] The step of separately storing the compressed character data to be stored into the standard character library includes:
[0017] If the character data to be stored is a commonly used character, then the compressed character data to be stored is stored in the first character library;
[0018] Otherwise, the character data to be stored is stored in the second character library.
[0019] By using the above technical solution, frequently used characters in the character data to be stored are stored separately in the first character library. When reading frequently used characters, they can be read directly from the first character library, which helps to reduce the number of times frequently used characters are searched. Since frequently used characters are used frequently, reducing the number of times frequently used characters are read can effectively reduce the time spent reading character data.
[0020] In a specific feasible implementation, the compressed character data to be stored is stored separately to form a standard character library, specifically including:
[0021] The size of the first character data to be stored after being compressed using the standard compression ratio is compared with the remaining space size of the read block;
[0022] If the first character data to be stored is not greater than the remaining space of the read block, then the first character data to be stored is stored in the remaining space of the read block;
[0023] Otherwise, the character data to be stored is compressed according to a preset minimum compression rate, and the second character data to be stored after being compressed using the minimum compression rate is stored in the remaining space of the read block.
[0024] By compressing the character data to be stored before storing it, the space occupied by the character data to be stored in the read block can be effectively reduced, which helps the standard character library to store more character data. According to the size of the remaining space in the read block, compressing the character data to be stored using different compression ratios can achieve the effect of storing the character data to be stored in a single read block, thereby improving the utilization rate of the remaining space in the read block.
[0025] In one specific implementation, storing the second character data to be stored, compressed using the lowest compression ratio, in the remaining space of the read block specifically includes:
[0026] The size of the second character data to be stored after being compressed using the lowest compression ratio is compared with the remaining space size of the read block;
[0027] If the second character data to be stored is not greater than the remaining space of the read block, then the second character data to be stored is stored in the remaining space of the read block;
[0028] Otherwise, the second character data to be stored is stored in the remaining space of the next read block.
[0029] Through the above technical solution, when the character data to be stored cannot be stored in the remaining space of the read block after being compressed using the lowest compression rate, the character data to be stored after being compressed using the lowest compression rate can be stored in the remaining space of the next read block. This achieves the effect of storing one character data in one read block. As a result, when the character data output module reads one character data, it can complete the reading in one operation, effectively reducing the time spent reading character data.
[0030] In one specific implementation scheme, after acquiring the character data to be stored, the method further includes:
[0031] The character data to be stored is compared with rare characters in a preset rare character library;
[0032] If there is an uncommon character that matches the character data to be stored, then the character data to be stored is compressed according to the preset minimum compression rate;
[0033] The size of the second character data to be stored after being compressed using the lowest compression ratio is compared with the remaining space size of the read block;
[0034] If the second character data to be stored is not greater than the remaining space of the read block, then the second character data to be stored is stored in the remaining space of the read block;
[0035] Otherwise, a portion of the second character data to be stored is stored in the remaining space of the read block, and the size of the portion of the second character data to be stored is the same as the size of the remaining space of the read block, until all the second character data to be stored is stored in several read blocks.
[0036] Through the above technical solution, since rare characters are used less frequently, they can be compressed and divided into multiple parts and stored in the remaining space of multiple read blocks. This helps to make full use of the remaining space of the read blocks, reduce the possibility of wasting the remaining space, and thus enable the standard character library to store more character data.
[0037] In one specific implementation, after searching for and outputting the character data corresponding to the character model data in the font unit according to the character model code, the method further includes:
[0038] Record the number of times the font data corresponding to the standard character library is read within a preset period;
[0039] The number of reads corresponding to the font data to be read is stored in a preset reading database;
[0040] Record the second font data most recently read from the standard character library within a preset period;
[0041] The second font data is stored in the preset reading database.
[0042] The above technical solution stores the number of times the font data is read within a cycle in a preset reading database. This allows staff to know the number of times each type of font data is read by reading the data in the reading database. This enables staff to adjust the font data and delete infrequently read font data in the subsequent design of the standard character library, thereby improving the practicality of the standard character library.
[0043] In one specific implementation, after searching for the font unit corresponding to the font data in the character unit according to the font data, the method further includes:
[0044] If a font unit corresponding to the font data exists, the character data corresponding to the character model data is searched in the font unit according to the character model code and output;
[0045] Otherwise, search for the first font data with the most reads in the preset reading database, and compare the first font data with the second font data;
[0046] If the first font data is consistent with the second font data, then search for the font unit corresponding to the first font data in the character unit.
[0047] Through the above technical solution, when a font unit that matches the font data contained in the external instruction cannot be found in the character unit, the first font data and the second font data can be retrieved in the read data and compared. When the first font data and the second font data match, the character data output module will read the character data corresponding to the first font data according to the external instruction. This helps to reduce the situation where the specific character data cannot be read when a font unit that matches the font data contained in the external instruction cannot be found in the character unit, thereby reducing the possibility of garbled characters in the read character data and improving the practicality of the standard character library.
[0048] In one specific implementation, after comparing the first font data with the second font data, the method further includes:
[0049] If the first font data and the second font data are inconsistent, the reading time of the single character data corresponding to the first font data and the reading time of the single character data corresponding to the second font data are searched within a preset period.
[0050] Compare the reading time of a single character data corresponding to the first font data with the reading time of a single character data corresponding to the second font data;
[0051] If the reading time of a single character data corresponding to the first font data is not greater than the reading time of a single character data corresponding to the second font data, then the font unit corresponding to the first font data is searched in the character unit;
[0052] Modify the reading time of a single character data corresponding to the first font data;
[0053] Otherwise, search for the font unit in the character unit that corresponds to the most recently read font data;
[0054] Modify the reading time of a single character data corresponding to the second font data.
[0055] By retrieving and comparing the first font data and the second font data, if the first font data and the second font data are inconsistent, the font data with the shorter reading time for a single character can be found by comparing the reading time of the single character data corresponding to the first font data and the reading time of the single character data corresponding to the second font data. The font data with the shorter reading time for a single character can be used as the basis for finding the font unit in the character unit during this reading. This helps to reduce the situation where specific character data cannot be read when the first font data and the second font data are inconsistent.
[0056] Secondly, this application provides a configuration device for a flash memory font library, employing the following technical solution: the device includes:
[0057] The character data receiving module is used to acquire character data to be stored.
[0058] The character data compression module is used to compress the character data to be stored using a preset standard compression ratio;
[0059] The character data storage module is used to store the compressed character data to be stored separately into the standard character library;
[0060] The instruction data receiving module is used to acquire external instructions to be processed, the external instructions including character encoding, font data and character model data;
[0061] A character unit lookup module is used to search for a character unit in the standard character library that corresponds to the character encoding according to the character encoding.
[0062] The font unit lookup module is used to find the font unit corresponding to the font data in the character unit according to the font data;
[0063] The character data output module is used to search for and output the character data corresponding to the character model data in the font unit according to the character model data.
[0064] Through the above technical solution, the character data receiving unit receives the character data to be stored and sends it to the character data compression unit. The character data compression unit compresses the character data to be stored using a standard compression ratio. The character data storage unit stores the compressed character data separately to form a standard character library. The character unit search module finds the character unit in the standard character library through the external instruction received by the external instruction receiving unit. The font unit search module searches for the font unit in the character unit. The character data output module searches for and outputs the character data in the font unit. This reduces the number of times users need to search for the required character data when reading the standard character library, thereby improving the reading time of the standard character library.
[0065] Thirdly, this application provides a computer-readable storage medium that employs the following technical solution: storing a computer program capable of being loaded by a processor and executing any of the above-mentioned flash memory font library configuration methods.
[0066] In summary, this application includes at least one of the following beneficial technical effects:
[0067] 1. By optimizing the standard character library, the character data in the standard character library can be stored separately, which helps to reduce the number of times character data is searched when reading character data, thereby improving the reading speed;
[0068] 2. Compressing the character data to be stored before storage can effectively reduce the space occupied by the character data in the read block, which helps the standard character library to store more character data. Depending on the size of the remaining space in the read block, compressing the character data to be stored using different compression ratios can achieve the effect of storing the character data to be stored in a single read block, thereby improving the utilization rate of the remaining space in the read block. Attached Figure Description
[0069] Figure 1 This is a flowchart of the configuration method of the flash memory font library in the embodiments of this application.
[0070] Figure 2 This is a state diagram used to illustrate character data storage in the embodiments of this application.
[0071] Figure 3 This is a state diagram used in the embodiments of this application to illustrate the storage of rare Chinese characters.
[0072] Figure 4 This is a structural block diagram of the flash memory font library configuration device in this embodiment of the present application.
[0073] Reference numerals: 301, Character data receiving module; 302, Character data compression module; 303, Character data storage module; 304, Instruction data receiving module; 305, Character unit search module; 306, Font unit search module; 307, Character data output module. Detailed Implementation
[0074] The following is in conjunction with the appendix Figure 1-4 This application will be described in further detail.
[0075] This application discloses a method for configuring a flash memory font library. This method is applied in the field of flash memory. The corresponding instructions are pre-stored in a controller module located on the flash memory. In this embodiment, the flash memory can be NAND-Flash. The flash memory is equipped with a character data receiving module 301, a character data compression module 302, a character data storage module 303, an instruction data receiving module 304, a character unit lookup module 305, a font unit lookup module 306, and a character data output unit 307. Data transmission occurs between the flash memory and external devices. The external devices include input devices and output devices. Input devices can be a keyboard and mouse, and output devices can be a display screen and a printer. The input devices are used to send external instructions and character data to be stored to the flash memory, and the output devices are used to receive character data from the flash memory.
[0076] like Figure 1 As shown, the method includes the following steps:
[0077] S10, Obtain the character data to be stored.
[0078] When designing a standard character library, staff need to store the characters to be stored in the standard character library located on flash memory. The character data to be stored can be character data corresponding to copyrighted fonts, such as KaiTi, SongTi, or HeiTi. Simultaneously, the character data to be stored can also be character data designed by users according to their own needs; for example, some cultural and creative companies will design some creative character data according to their requirements. Specifically, the character data to be stored is all the information of a character stored in the computer. The flash memory can obtain the character data to be stored in the following ways: staff can transmit the character information to be stored to the character data receiving unit of the flash memory through an external device's input device, or the external device can send the character data to be stored to the character data receiving unit according to preset instructions sent to the computer after startup.
[0079] S20 compresses the character data to be stored using a preset standard compression ratio.
[0080] Specifically, the acquired character data to be stored is compressed by reading the standard compression ratio from the preset compression ratio library, thereby reducing the space occupied by the character data to be stored, and thus enabling the standard database to store more character data.
[0081] S30, the compressed character data to be stored is stored separately into the standard character library;
[0082] The compressed character data to be stored is stored separately in a read block to form a standard character library. Each individual character data in the standard character library is stored in only one read block. For example, the standard capacity of a read block is 4Kbyte, the remaining space capacity of the current read block is 2.5Kbyte, and the remaining space of the next read block is 3.8Kbyte. The size of a font data is 5Kbyte, and the compressed character data is 3.5Kbyte. The compressed character data cannot be fully stored in the remaining space of the current read block, but the compressed character data can be fully stored in the remaining space of the next read block. Then, the compressed character data is stored in the remaining space of the next read block, ensuring that all the content of each character data is stored in only one read block. All the character data is stored in several read blocks in this way, and the several read blocks form a standard character library. Among them, the user accesses the standard character library through a read-only file system.
[0083] S40. Obtain an external instruction to be processed. The external instruction includes a character encoding, font data, and character model data.
[0084] Specifically, the external instruction is an instruction sent by an operator through an input device of an external device to the instruction data receiving module 304 for reading character data in the standard character library. The external instruction includes a character encoding, font data, and character model data. The character encoding is information used to inform the character unit search module 305 of the specific location of the character unit. The font data is information used to inform the font unit search module 306 of the font of the character data read this time; for example, it is informed that the font of the character data read this time is Song typeface. The character model data is information used to inform the character data output module 307 of the character model of the character data read this time; for example, it is informed that the character model of the character data read this time by the character data output module 307 is No. 5 font.
[0085] S50, as Figure 2 shown, search for the character unit corresponding to the character encoding in the standard character library according to the character encoding.
[0086] Specifically, the character unit is the area in the read block that stores all the character data of a certain character. The character encoding is parsed to obtain the character address corresponding to the character encoding, and the character unit corresponding to the character address is searched in the standard character library according to the parsed character address; for example, for this read, the character "中" needs to be read. The character unit search module 305 will first obtain the character address according to the character encoding. All the character data of the character "中" is stored in the area 0022 - 0056 in the second read block, and the character data output module 307 will directly read this area according to the character address.
[0087] S60, as Figure 2As shown, find the font unit corresponding to the font data in the character unit according to the font data.
[0088] Specifically, the font unit is the area in the read block that stores all the character data of a certain font of a certain character. Find the font unit corresponding to the font data in the character unit according to the font data. For example, this time it is necessary to read the character '中' in Song typeface. All the character data of the character '中' in Song typeface is stored in the area 0030 - 0035 in the second read block. The font unit search module 306 knows that the font to be read this time is Song typeface according to the font data, and then finds the area 0030 - 0035 where the character '中' in Song typeface is located in the area 0022 - 0056 in the second read block.
[0089] S70, such as Figure 2 As shown, find and output the character data corresponding to the character model code in the font unit according to the character model data.
[0090] Specifically, find the character data corresponding to the character model data in the font unit according to the character model data in the external instruction. For example, this time it is necessary to read the character '中' in No. 5 Song typeface. The character '中' in No. 5 Song typeface is stored in the area 0030 - 0031 in the second read block. The character data output module 307 will know that the character model to be read this time is No. 5 according to the character model data, and then find the area 0030 - 0031 where the character '中' in No. 5 Song typeface is located in the area 0030 - 0035 in the second read block; after compressing the character data to be stored through a preset standard compression ratio, and storing the compressed character data to be stored separately, so that all the content of a single character data is continuously stored in a read block, so that when reading a single character data, only one read operation is required, which helps to reduce the time spent on reading character data, and after being compressed by the standard compression ratio, the space occupied by the character data to be stored in the read block is reduced, so that more font units can be stored in the standard character library, which helps to improve the applicability of the standard character library.
[0091] In one embodiment, considering the high usage frequency and large number of reads of common characters, in order to improve the rate of reading character data, the standard character library is divided into the first character library and the second character library. After obtaining the character data to be stored, the following steps can also be performed:
[0092] Compare the obtained character data to be stored with the common characters in the preset common character library; if there is a common character that is the same as the character data to be stored, determine that the character data to be stored is a common character; compress the character data to be stored using the standard compression ratio;
[0093] The steps of storing the compressed character data to be stored separately into the standard character library can be specifically performed as follows:
[0094] The compressed character data to be stored is stored in the first character library; otherwise, the character data to be stored is stored in the second character library.
[0095] When the flash memory is used, the character data on the read block in the first character library is directly loaded into the cache of the flash memory; when reading frequently used words, the character unit lookup module 305 can directly read the character data in the cache, effectively reducing the time spent reading character data.
[0096] In one embodiment, such as Figure 2 As shown, in order to ensure that character data in the standard character library, excluding rare characters, can be stored separately, after storing the compressed character data to be stored separately into the standard character library, the following steps can also be performed:
[0097] The acquired character data to be stored is compared with commonly used characters in the preset common character library. If there is a common character that is consistent with the character data to be stored, the character data to be stored after being compressed using the standard compression ratio is stored in the read block of the data block. The first character data to be stored after being compressed using the standard compression ratio is compared with the size of the remaining space of the current read block. If the first character data to be stored is not greater than the remaining space of the current read block, the first character data to be stored is stored in the remaining space of the current read block.
[0098] Otherwise, the acquired character data to be stored is compressed using the preset minimum compression ratio to obtain the second character data to be stored. The second character data to be stored is the character data to be stored compressed using the minimum compression ratio. The size of the second character data to be stored is compared with the remaining space of the current read block. If the second character data to be stored is not greater than the remaining space of the current read block, the second character data to be stored is stored in the remaining space of the current read block. Compressing the character data to be stored using the minimum compression ratio allows a single character data to be stored in a read block, thereby improving the utilization rate of the remaining space in the read block and helping to reduce the time spent reading character data.
[0099] In one embodiment, considering the possibility that the second character data to be stored may exceed the remaining space of the current read block, thus preventing the second character data from being stored in the remaining space of the current read block, the step of storing the second character data compressed using the lowest compression ratio in the remaining space of the read block can be specifically performed as follows:
[0100] The size of the second character data to be stored is compared with the remaining space size of the next read block until the second character data to be stored is not greater than the remaining space of the read block; for example, the standard capacity of the read block is 4Kbyte, the remaining space capacity of the current read block is 2.5Kbyte, the remaining space of the next read block is 2.8Kbyte, the remaining space of the next read block is 3.2KByte, and the size of a font data is 5Kbyte;
[0101] The character data, after being compressed at the standard compression rate, is 3.5 KB in size. This means the first character data to be stored is 3.5 KB, while the remaining space in the current read block is 2.5 KB. The first character data cannot be entirely stored in the remaining space of the current read block. Then, the character data is compressed using the lowest compression rate, resulting in a second character data size of 3 KB. This still cannot be entirely stored in the remaining space of the current read block, nor can it be entirely stored in the remaining space of the next read block. The remaining space in the next read block is 3.8 KB, which is sufficient for storage. The entire content of the second character data to be stored is stored in the remaining space of the current reading block. If the remaining space of the reading block is less than the second character data, a pop-up window will be displayed to inform the staff that the character data cannot be stored. The second character data is compared with the remaining space of the reading blocks after the current reading block, and then stored in the remaining space of the reading block that can completely store the second character data. This ensures that even when the second character data is larger than the remaining space of the current reading block, the second character data can still be stored in a reading block, which helps to improve the speed of reading character data.
[0102] In one embodiment, such as Figure 3 As shown, considering the low frequency of use and infrequent reading of rare characters, in order to improve the utilization of remaining space, the following steps can be performed after obtaining the character data to be stored:
[0103] The acquired character data to be stored is compared with rare characters in the preset rare character library. If a rare character that matches the character data to be stored is found, the character data to be stored is compressed using the lowest compression rate to obtain the second character data to be stored. The size of the second character data to be stored is compared with the size of the remaining space of the current reading block. If the second character data to be stored is not greater than the remaining space of the current reading block, the second character data to be stored is stored in the remaining space of the current reading block; otherwise, a portion of the data content is separated from the second character data to be stored and stored in the remaining space of the reading block, and the size of this portion of data content is the same as the size of the remaining space of the reading block, until all the second character data to be stored is stored in the remaining space of the reading block.
[0104] For example, the standard size of a read block is 4Kbytes. The remaining space of the current read block is 0.8Kbytes, the remaining space of the next read block is 1.2Kbytes, and the remaining space of the next read block is 2.5Kbytes. The font data size of a rare character is 5Kbytes. After compression at the lowest compression rate, the size of the second character data to be stored is 3.5Kbytes. The second character data to be stored is divided into three parts: 0.8Kbytes, 1.2Kbytes, and 1.5Kbytes, and stored in the remaining space of different read blocks respectively. Block storage of rare characters helps to improve the utilization rate of the remaining space of the read blocks. Moreover, since rare characters are used less frequently, even if rare characters are stored in blocks, it will not have a significant impact on the reading time of the standard character library. It is worth mentioning that rare characters are only stored in the second character library, and the settings of the first character library have no impact on the storage of rare characters.
[0105] In one embodiment, in order to more accurately understand the font data commonly used by users in the subsequent design of the standard character library, after finding and outputting the character data corresponding to the character type data in the font unit according to the character type encoding, the following steps can also be performed:
[0106] The database records the number of times font data in the standard character library is read within a preset period. For example, if the preset period is 30 days, then each 30-day period records the number of times each font data in the standard character library is read within each period. If the font data read is SimSun and a corresponding font unit for SimSun is found in the character unit, then the number of times the font data for SimSun is read is incremented by one in the database. The database also records the most recently read font data in the standard character library within the preset period, which is the second font data. This second font data is stored in the preset database. For example, if the font data read is SimSun and the character data corresponding to the character model is found and output according to the character model code in the font unit corresponding to SimSun, then the second font data is modified to SimSun in the database. By retrieving the number of times the font data is read in the database, staff can quickly identify the most frequently used fonts in the standard character library, which can serve as a reference for the design of subsequent standard character libraries and help improve their practicality.
[0107] In one embodiment, considering that the font data required by the user may not exist in the standard character library, thus preventing the user from obtaining the reading result, after searching for and outputting the character data corresponding to the character model data in the font unit according to the character model encoding, the following steps can also be performed:
[0108] If a font unit corresponding to the font data exists in the standard character library, the character data corresponding to the character model data in the external instruction is searched for and output in the font unit. Otherwise, the first font data with the most reads is searched in the preset reading database. The first font data is the font data with the most reads in the reading database. The first font data is compared with the second font data. If the first font data and the second font data are consistent, the font unit corresponding to the first font data is searched in the character unit. Recording the number of times the font data is read and the second font data helps to reduce the situation where the specific character data cannot be read when the font unit corresponding to the font data in the external instruction cannot be found in the standard character library, thereby reducing the possibility of garbled characters in the read character data.
[0109] In one embodiment, considering the situation where the font unit lookup module 306 cannot determine which font data to use when the first font data and the second font data are inconsistent, after comparing the first font data and the second font data, the following steps can also be performed:
[0110] The system searches the preset character library for the reading time of a single character corresponding to the first font data and the reading time of a single character corresponding to the second font data within the current period. The reading database stores the number of character data corresponding to the font data read within the current period and the time spent reading these character data. The reading time of a single character corresponding to the font data is the number of font data read within the current period divided by the time spent reading these character data. The reading time of a single character corresponding to the first font data and the reading time of a single character corresponding to the second font data are compared.
[0111] If the reading time of a single character corresponding to the first font data is not greater than the reading time of a single character corresponding to the second font data, then the font unit corresponding to the first font data is searched in the character unit and the reading time of the single character corresponding to the first font data is modified; otherwise, the font unit corresponding to the most recently read font data is searched in the character unit and the reading time of the single character corresponding to the second font data is modified. For example, if the first font data in this cycle is SimSun and the second font data is KaiTi, and reading the character data with SimSun font data takes 60 seconds and reads 10,000 characters, and reading the character data with KaiTi font data takes 50 seconds and reads 20,000 characters, then the reading time of a single character corresponding to SimSun font is 0.00028 seconds, and the reading time of a single character corresponding to KaiTi font is... If the interval is 0.0025 seconds, then the reading time for a single character data corresponding to Song typeface is less than the reading time for a single character data corresponding to Kai typeface. Therefore, the font unit corresponding to Song typeface is searched in the character unit search. After the character data is read this time, the number of character data read and the time spent are counted, and the counted number of character data and the reading time spent are added to the number of character data corresponding to Song typeface and the reading time in the reading database, respectively. By recording the number of character data corresponding to the font data read in this cycle and the time spent reading these character data, the reading time of a single character data corresponding to the font data can be obtained. This helps the font unit search module 306 to use a font with a relatively shorter reading time when the first font data and the second font data are inconsistent, thereby reducing the time spent reading character data.
[0112] The implementation principle of this application embodiment is as follows: When designing a standard character library, the staff sends the character information to be stored to the character data receiving unit through an input device. The character data receiving unit sends the data to be stored to the character data compression unit. The character data compression unit compares the received character data to be stored with a preset rare character library. If there is a rare character in the rare character library that is consistent with the character data to be stored, the character data to be stored is compressed according to the minimum compression ratio to obtain the second character data to be stored. The size of the second character data to be stored is compared with the size of the remaining space of the reading block. If the second character data to be stored is not greater than the remaining space of the reading block, the second character data to be stored is stored in the remaining space of the reading block. Otherwise, the second character data to be stored is divided into parts according to the size of the remaining space of the reading block, and the divided parts are stored in the remaining space of the reading block, until the second character data to be stored is completely stored in the remaining space of the reading block.
[0113] If no rare character matching the character data to be stored exists in the rare character library, the character data to be stored is compressed using the standard compression rate to obtain the first character data to be stored. The size of the first character data to be stored is compared with the size of the remaining space in the current reading block. If the first character data to be stored is not greater than the remaining space in the reading block, the first character data to be stored is stored in the remaining space of the reading block. Otherwise, the obtained character data to be stored is compressed using the preset minimum compression rate to obtain the second character data to be stored. The size of the second character data to be stored is compared with the remaining space in the current reading block. If the second character data to be stored is not greater than the remaining space in the reading block, the second character data to be stored is stored in the remaining space of the reading block. If the second character data to be stored is greater than the remaining space in the current reading block, the size of the second character data to be stored is compared with the remaining space in the reading blocks after the current reading block, until the second character data to be stored is not greater than the remaining space in the reading blocks. If the remaining space in the reading blocks is less than the second character data to be stored, a pop-up window is displayed to inform the staff that the character data cannot be stored, thus forming the standard character library.
[0114] Users send external commands to the external command receiving unit via input devices. The controller module reads the character data that matches the data carried by the external command from the standard character library. The existence of the standard character library reduces the time spent reading character data from the flash memory.
[0115] Figure 1 This is a flowchart illustrating a method for configuring a flash memory font library in one embodiment. It should be understood that, although... Figure 1The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows; unless explicitly stated otherwise, there is no strict order requirement for the execution of these steps, and they can be executed in other orders; and Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0116] Based on the above method, this application also discloses a flash memory font configuration device.
[0117] like Figure 4 As shown, the device includes the following modules:
[0118] Character data receiving module 301 is used to acquire character data to be stored;
[0119] The character data compression module 302 is used to compress the character data to be stored using a preset standard compression ratio;
[0120] The character data storage module 303 is used to store the compressed character data to be stored separately into the standard character library;
[0121] The instruction data receiving module 304 is used to acquire external instructions to be processed, including character encoding, font data, and character model data.
[0122] The character unit lookup module 305 is used to look up the character unit corresponding to the character encoding in the standard character library according to the character encoding;
[0123] The font unit lookup module 306 is used to find the font unit corresponding to the font data in the character unit according to the font data;
[0124] The character data output module 307 is used to find and output the character data corresponding to the character model data in the font unit according to the character model data.
[0125] In one embodiment, the character data receiving module 301 is further configured to compare the character data to be stored with commonly used characters in a preset common character library;
[0126] If there is a common character that matches the character data to be stored, then the character data to be stored is determined to be a common character;
[0127] The character data storage module 303 is also used to store the compressed character data into the first character library if the character data to be stored is a commonly used character.
[0128] Otherwise, the character data to be stored will be stored in the second character library.
[0129] In one embodiment, the character data storage unit is further configured to compare the size of the first character data to be stored after being compressed using a standard compression ratio with the remaining space size of the read block;
[0130] If the first character data to be stored is not greater than the remaining space of the read block, then the first character data to be stored will be stored in the remaining space of the read block;
[0131] Otherwise, the character data compression module 302 is also used to compress the character data to be stored according to a preset minimum compression rate, and the character database output module is also used to store the second character data to be stored after being compressed using the minimum compression rate in the remaining space of the read block.
[0132] In one embodiment, the character data storage module 303 is further configured to compare the size of the second character data to be stored after being compressed using the lowest compression ratio with the remaining space size of the read block;
[0133] If the second character data to be stored is not greater than the remaining space of the read block, then the second character data to be stored will be stored in the remaining space of the read block;
[0134] Otherwise, the second character data to be stored is stored in the remaining space of the next read block.
[0135] In one embodiment, the character data receiving module 301 is further configured to compare the character data to be stored with rare characters in a preset rare character library;
[0136] If there is a rare character that matches the character data to be stored, the character data compression module 302 is also used to compress the character data to be stored according to the preset minimum compression rate;
[0137] The size of the second character data to be stored, compressed using the lowest compression ratio, is compared with the remaining space size of the read block;
[0138] If the second character data to be stored is not greater than the remaining space of the read block, the character data storage module 303 is also used to store the second character data to be stored in the remaining space of the read block;
[0139] Otherwise, a portion of the second character data to be stored is stored in the remaining space of the read block, and the size of the portion of the second character data to be stored is the same as the size of the remaining space of the read block, until all the second character data to be stored is stored in several read blocks.
[0140] In one embodiment, the font unit lookup module 306 is further configured to record the number of times the font data of the standard character library is read within a preset period;
[0141] The number of reads corresponding to the font data to be read is stored in a preset reading database;
[0142] Records the second font data that was most recently read from the standard character library within a preset period;
[0143] Store the second font data in a preset read database.
[0144] In one embodiment, the character data output module 307 is further configured to, if there is a font unit corresponding to the font data, search for and output the character data corresponding to the character model data in the font unit according to the character model code;
[0145] Otherwise, the font unit module is also used to find the first font data with the most reads in the preset reading database, and compare the first font data with the second font data;
[0146] If the first font data is the same as the second font data, then search for the font unit corresponding to the first font data in the character unit.
[0147] In one embodiment, the font unit lookup module 306 is further configured to, if the first font data and the second font data are inconsistent, look up the reading time of a single character data corresponding to the first font data and the reading time of a single character data corresponding to the second font data within a preset period.
[0148] Compare the reading time of a single character data corresponding to the first font data with the reading time of a single character data corresponding to the second font data;
[0149] If the reading time of a single character data corresponding to the first font data is not greater than the reading time of a single character data corresponding to the second font data, then search for the font unit corresponding to the first font data in the character unit;
[0150] Modify the read time of a single character data corresponding to the first font data;
[0151] Otherwise, search for the font unit in the character unit that corresponds to the most recently read font data;
[0152] Modify the reading time of a single character data corresponding to the second font data.
[0153] This application also discloses a computer-readable storage medium.
[0154] Specifically, the computer-readable storage medium stores a computer program that can be loaded by a processor and executed as described above regarding the configuration method of the flash memory font library. The computer-readable storage medium includes, for example, various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0155] This specific embodiment is merely an explanation of the present invention and is not intended to limit the invention. After reading this specification, those skilled in the art can make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they are within the scope of the claims of the present invention.
Claims
1. A method for configuring a flash memory font library, characterized in that, The method is applied to the field of NAND-Flash flash memory, and the method includes: Retrieve the character data to be stored; Compress the character data to be stored using a preset standard compression ratio; The compressed character data to be stored is stored separately in the standard character library; Obtain external instructions to be processed, including character encoding, font data, and character model data; According to the character encoding, the corresponding character unit is searched in the standard character library; Based on the font data, find the font unit corresponding to the font data in the character unit; Based on the character model data, the corresponding character data is searched in the font unit and output; Each character data in the standard character library is stored in only one read block, and the user calls the standard character library through the read-only file system; The process of separately storing the compressed character data to be stored in a standard character library, and compressing the character data to be stored using different compression ratios according to the remaining space in the read block, specifically includes: The size of the first character data to be stored after being compressed using the standard compression ratio is compared with the remaining space size of the read block; If the first character data to be stored is not greater than the remaining space of the read block, then the first character data to be stored is stored in the remaining space of the read block; Otherwise, the character data to be stored is compressed according to a preset minimum compression rate, and the second character data to be stored after being compressed using the minimum compression rate is stored in the remaining space of the read block; The step of storing the second character data to be stored, compressed using the lowest compression ratio, in the remaining space of the read block specifically includes: The size of the second character data to be stored after being compressed using the lowest compression ratio is compared with the remaining space size of the read block; If the second character data to be stored is not greater than the remaining space of the read block, then the second character data to be stored is stored in the remaining space of the read block; Otherwise, the second character data to be stored is stored in the remaining space of the next read block.
2. The method for configuring a flash memory font library according to claim 1, characterized in that, The standard character library includes a first character library and a second character library. After acquiring the character data to be stored, it further includes: The character data to be stored is compared with commonly used characters in a preset common character library; If there is a commonly used character that is consistent with the character data to be stored, then the character data to be stored is determined to be a commonly used character; The step of separately storing the compressed character data to be stored into the standard character library includes: If the character data to be stored is a commonly used character, then the compressed character data to be stored is stored in the first character library; Otherwise, the character data to be stored is stored in the second character library; after storage is completed, the flash memory is used, and the character data located on the read block in the first character library is directly loaded into the cache of the flash memory.
3. The method for configuring a flash memory font library according to claim 2, characterized in that, After obtaining the character data to be stored, the process also includes: The character data to be stored is compared with rare characters in a preset rare character library; If there is a rare character that matches the character data to be stored, the character data to be stored is compressed according to the preset minimum compression rate, and the compressed character data to be stored is stored in the second character library. The size of the second character data to be stored after being compressed using the lowest compression ratio is compared with the remaining space size of the read block; If the second character data to be stored is not greater than the remaining space of the read block, then the second character data to be stored is stored in the remaining space of the read block; Otherwise, a pop-up window will appear to inform the staff that the second character data to be stored cannot be stored, and a portion of the second character data to be stored will be stored in the remaining space of the reading block, with the size of the portion of the second character data to be stored being the same as the size of the remaining space of the reading block, until all the second character data to be stored is stored in several reading blocks.
4. The method for configuring a flash memory font library according to claim 1, characterized in that, After searching for and outputting the character data corresponding to the character model data in the font unit according to the character model data, the method further includes: The number of times the font data of the standard character library is read within a preset period is recorded, wherein the preset period is set according to the actual usage frequency of the flash memory font library; The number of reads corresponding to the font data to be read is stored in a preset reading database; Record the second font data most recently read from the standard character library within a preset period; The second font data is stored in a preset reading database, wherein the preset reading database stores the reading time of each individual character corresponding to each font data.
5. The method for configuring a flash memory font library according to claim 1, characterized in that, After searching for the font unit corresponding to the font data in the character unit based on the font data, the method further includes: Record the number of times the font data is read and the second font data; If a font unit corresponding to the font data exists, the character data corresponding to the character model data is found in the font unit according to the character model data and output. Otherwise, search for the first font data with the most reads in the preset reading database, and compare the first font data with the second font data; If the first font data is consistent with the second font data, then search for the font unit corresponding to the first font data in the character unit.
6. The method for configuring a flash memory font library according to claim 5, characterized in that, After comparing the first font data with the second font data, the method further includes: If the first font data and the second font data are inconsistent, the reading time of a single character data corresponding to the first font data and the reading time of a single character data corresponding to the second font data are found within a preset period. The reading time of a single character data corresponding to the font data is the number of characters data corresponding to the font data read within the preset period divided by the total time spent reading these characters data. Compare the reading time of a single character data corresponding to the first font data with the reading time of a single character data corresponding to the second font data; If the reading time of a single character data corresponding to the first font data is not greater than the reading time of a single character data corresponding to the second font data, then the font unit corresponding to the first font data is searched in the character unit; Modify the reading time of a single character data corresponding to the first font data; Otherwise, search for the font unit in the character unit that corresponds to the most recently read font data; Modify the reading time of a single character data corresponding to the second font data.
7. A configuration device for a flash memory font library, characterized in that, The device includes: A character data receiving module (301) is used to acquire character data to be stored; The character data compression module (302) is used to compress the character data to be stored using a preset standard compression ratio; The character data storage module (303) is used to store the compressed character data to be stored separately into the standard character library; The instruction data receiving module (304) is used to acquire external instructions to be processed, the external instructions including character encoding, font data and character model data; The character unit lookup module (305) is used to look up the character unit corresponding to the character encoding in the standard character library according to the character encoding; The font unit lookup module (306) is used to look up the font unit corresponding to the font data in the character unit according to the font data; The character data output module (307) is used to search for and output the character data corresponding to the character model data in the font unit according to the character model data; Each character data in the standard character library is stored in only one read block, and the user calls the standard character library through the read-only file system; The process of separately storing the compressed character data to be stored in a standard character library, and compressing the character data to be stored using different compression ratios according to the remaining space in the read block, specifically includes: The size of the first character data to be stored after being compressed using the standard compression ratio is compared with the remaining space size of the read block; If the first character data to be stored is not greater than the remaining space of the read block, then the first character data to be stored is stored in the remaining space of the read block; Otherwise, the character data to be stored is compressed according to a preset minimum compression rate, and the second character data to be stored after being compressed using the minimum compression rate is stored in the remaining space of the read block; The step of storing the second character data to be stored, compressed using the lowest compression ratio, in the remaining space of the read block specifically includes: The size of the second character data to be stored after being compressed using the lowest compression ratio is compared with the remaining space size of the read block; If the second character data to be stored is not greater than the remaining space of the read block, then the second character data to be stored is stored in the remaining space of the read block; Otherwise, the second character data to be stored is stored in the remaining space of the next read block.
8. A computer-readable storage medium, characterized in that, The computer program is stored that can be loaded by a processor and executed as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Compression and decompression methods and devices for lattice character library and characters in lattice character library
CN103366716A
Cache distribution method, device and apparatus
CN103595653A
Font display processing method and device
CN111353114A
Method and device for acquiring characters
CN114692641A