Recording method and query method of dot matrix font library
By designing a dot matrix font library file format that supports the mixed coexistence of multiple character intervals of different attributes, the problems of excessive size and low query efficiency in the existing technology of Chinese dot matrix font library are solved, and more efficient compression and query effects are achieved.
Patent Information
- Application Number
- CN202510063191.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-06
AI Technical Summary
The prior art is difficult to effectively compress and query the Chinese dot matrix font library on embedded terminals with limited resources, especially when supporting the simultaneous existence of monospace and unequal width fonts, and the large number of characters leads to excessive volume and low query efficiency.
Design a dot matrix font library file format, including file header area, character access map area, and character bitmap information area. The file header area stores basic information of the font library. The character access mapping table area is divided into continuous encoding and discrete encoding tables according to the continuity and equiwidth of Unicode encoding points. The character bitmap information area is divided into equal width and unequal width areas according to the properties of the character interval. It adopts variable-length storage units, discards redundant data, and dynamically generates bitmap attributes.
It realizes the mixed coexistence of multiple character intervals of different attributes, compresses the font library volume, improves query efficiency, and is suitable for resource-constrained embedded terminals, especially on terminal products that require complete Chinese characters.
Smart Images

Figure CN119938619A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method for recording and querying a dot matrix font library of an embedded terminal with limited resources. Background Art
[0002] Font library files are divided into two types: vector font libraries and dot matrix font libraries. Vector font library files are relatively large in size and require more memory space when loading and querying characters. They are generally used on computers, mobile phones, and embedded terminals with rich resources. In comparison, dot matrix font libraries directly store the dot matrix bitmap data of characters, saving the resource overhead for loading and querying characters. Therefore, for embedded terminals with limited resources, dot matrix font libraries are the only choice.
[0003] However, for Chinese dot matrix font libraries, the number of Chinese characters is huge. If applied to terminal products that require complete Chinese characters, such as terminal products with input methods, the volume of the dot matrix font library will become very large. Correspondingly, how to efficiently query character dot matrices is also a problem.
[0004] Patent Publication No. CN112395828A, with the patent name "Method for Recording Dot Matrix Font Library Information and Method for Generating Dot Matrix Characters", provides a method for compressing the resources occupied by the font library. The deficiencies of this patent are as follows: 1. "One byte unit is designed in the file header area to indicate whether the font library characters are of equal width", which means that it does not support the coexistence of equal-width and non-equal-width fonts in one font library file; 2. For equal-width and non-equal-width characters, the dot matrix data is almost the same. The only difference is that non-equal-width characters have 2 more bytes of storage units than equal-width characters to describe the actual width of non-equal-width characters. In practical applications, in addition to the width difference, many characters also have height differences, such as "one" and "country". Correspondingly, there is also room for compression in height. When applied to terminal products that require complete Chinese characters, there is still a certain amount of compression space.
[0005] Patent Publication No. CN106844559A, with the patent name "A Method for Generating a Dot Matrix Font Library, a Query Method, and a Corresponding Device", provides a method for quickly querying a dot matrix font library. The deficiencies of this patent are as follows: "The secondary index information of each character includes not only the single code of the character, but also information such as the page, X coordinate, Y coordinate, width, height, X-axis offset, Y-axis offset, and step value of the character in the bitmap set". When applied to terminal products that require complete Chinese characters, the number of characters is huge, and the volume of the dot matrix font library will become very large. Summary of the Invention
[0006] The purpose of the present invention is to provide a recording method and a query method for a dot matrix font library. A dot matrix font library design supports the mixed coexistence of multiple character intervals with different attributes, including the mixed coexistence of equal-width character intervals, unequal-width character intervals, continuous encoded character intervals and discrete encoded character intervals, thereby improving ease of use, while better compressing the font library volume and efficiently querying character dot matrix bitmaps to solve the problems raised in the above-mentioned background technology.
[0007] In order to achieve the above object, the present invention adopts the following technical scheme: a recording method and query method of a dot matrix font library, comprising the following steps: designing a dot matrix font library file format layout as a file header area, a character access mapping table area, and a character bitmap information area; The file header area stores basic information description of the font library, and at least stores and records the following information: the dot height of the font, the drawing baseline of the character, the number of character intervals, and description information of multiple character intervals; The character access mapping table area contains a plurality of independent character access mapping tables, and the character access mapping tables are divided into: a continuously coded character access mapping table and a discretely coded character access mapping table according to a flag indicating whether the Unicode code points of the interval in the character interval description information are continuous; The character bitmap information area stores and records the bitmap attributes of the characters contained in the entire font library and the dot matrix bitmap data of the character effective graphics. The character bitmap attributes and the dot matrix bitmap data of the character effective graphics are used as a storage unit of character bitmap information. The number of units is the number of characters contained in the entire font library. Each character occupies one unit and is arranged closely. According to the flag of whether the Unicode code points of the intervals in the character interval description information are equal in width, the character bitmap information area is divided into: a bitmap information area for equal-width characters and a bitmap information area for unequal-width characters.
[0008] Preferably, the description information of the character interval at least stores and records the following information: the Unicode starting code point of the interval, the Unicode ending code point of the interval, the number of Unicode code points of the interval, a flag indicating whether the Unicode code points of the interval are continuous, a flag indicating whether the Unicode code points of the interval are of equal width, the x-axis width of characters in a monospaced font, and the offset of the character access mapping table of the interval in the font file.
[0009] Preferably, the continuously encoded character access mapping table stores a corresponding number of mapping table entries according to the number of Unicode code points of the interval in the character interval description information, and each mapping table entry stores at least the following information: the offset of the character bitmap information in the font file, the length of the character bitmap information, and a flag indicating whether it has independent character bitmap attributes.
[0010] Preferably, the discretely coded character access mapping table stores a corresponding number of mapping table entries according to the number of Unicode code points of the interval in the character interval description information, and each mapping table entry stores at least the following information: the offset of the character bitmap information in the font file, the length of the character bitmap information, a flag indicating whether it has independent character bitmap attributes, and the Unicode code point value of the character.
[0011] Preferably, the flag for indicating whether the character has independent character bitmap attributes is stored according to the following rules: when the character is of equal width, if it is found that the character fills the entire display block when extracting and making the character dot matrix, the corresponding character bitmap attribute in the font file will be discarded, and the value of the flag for indicating whether the character has independent character bitmap attributes is 0, otherwise it is 1.
[0012] Preferably, the storage rule of the dot matrix bitmap data of the effective graphics of the character is: discard the blank lines above and below the character, and only save the bitmap data of the effective rectangular area. At this time, the area of the effective graphics of the character is less than or equal to the entire display block, and the amount of data is less than or equal to the amount of data of the entire display block.
[0013] Preferably, the storage rule of the bitmap attributes of the characters is as follows: when the characters are equal-width characters, at least the following information is stored and recorded: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, and the y-axis offset of the actual effective graphic of the character; when the characters are unequal-width characters, at least the following information is stored and recorded: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, the y-axis offset of the actual effective graphic of the character, and the x-axis width of the character.
[0014] Preferably, when the character is a monospaced character, the x-axis width of the character is uniformly indicated by the field in the description information of the above-mentioned character interval: "x-axis width of characters in monospaced font", and it is not necessary to store the x-axis width of the actual effective graphic of each character.
[0015] Preferably, the bitmap information area of the equal-width characters includes the following three situations, depending on whether the characters fill the entire display block: 1) If it is found that the character fills the entire display block when extracting and making the character dot matrix, the storage unit of the character bitmap information will discard the character bitmap attribute and set the "flag of whether it has independent character bitmap attributes" field in the character access mapping table to 0. At this time, only the dot matrix bitmap data of the character effective graphic is included. The area of the character effective graphic is equal to the entire display block, and the data volume is equal to the data volume of the entire display block; 2) If it is found that the character cannot fill the entire display block when extracting and making the character dot matrix, that is, there is a blank line above or below the display block, and at the same time, the sum of the length of the character's bitmap attribute and the length of the dot matrix bitmap data of the character's effective graphic is less than or equal to the bitmap data length of the entire display block, then the storage unit of the character bitmap information is consistent with the above, including the character's bitmap attribute and the dot matrix bitmap data of the character's effective graphic, and the "flag of whether it has independent character bitmap attributes" field in the character access mapping table is set to 1 value, and the character's bitmap attribute is used to indicate the position information of the character in the display block. At this time, the display area of the character's effective graphic is smaller than the entire display block, and the data volume is smaller than the data volume of the entire display block; 3) If it is found during the extraction and production of the character dot matrix that the character cannot fill the entire display block, that is, there are blank lines above or below the display block, and the sum of the length of the character's bitmap attributes and the length of the dot matrix bitmap data of the character's effective graphic is greater than the bitmap data length of the entire display block, then the character's bitmap attributes will be discarded and processed according to the processing branch of point 1 "the character fills the entire display block"; when the character fills the entire display block, during the program running process, the entire character bitmap attributes will be dynamically generated according to the description information in the file header area, and there is no need to store and record the character bitmap attributes for each character.
[0016] The present invention provides a method for querying a dot matrix font library, comprising the following steps: 1. Read the file header area of the font library from the non-volatile storage medium, obtain the basic description information such as the dot height of the font, the drawing baseline of the character, the number of character intervals, and the description information of multiple character intervals, and save it in the memory; Second, if the memory is sufficient, the character access mapping table of the discrete character interval is saved in the memory to speed up the subsequent query efficiency; 3. When starting to query for a specified character, traverse the description information of the character interval stored in the memory in sequence to obtain the character interval where the specified character is located; 4. If it is a continuously encoded character interval, then according to the character code point and the Unicode starting code point information of the character interval, as well as the offset of the character access mapping table of the interval in the font file, directly locate and obtain the character access mapping table entry of the specified character; 5. If it is a discretely encoded character interval, traverse the entire character access mapping table to locate and obtain the character access mapping table entry for the specified character; 6. When a character has independent character bitmap attributes, the character bitmap attributes include: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, the y-axis offset of the actual effective graphic of the character, and the x-axis width of the character; if the character is a monospaced character, then the "x-axis width of the character in the monospaced font" field in the description information of the character interval is first used to assign the x-axis width of the actual effective graphic of the specified character, and then the remaining bitmap attributes and dot matrix data of the character are read from the non-volatile storage medium; if the character is an unequal character, then the complete bitmap attributes and dot matrix data of the character are directly read from the non-volatile storage medium; 7. When a character does not have an independent character bitmap attribute, the character is a monospaced character. The entire character bitmap attribute is first dynamically generated. The steps are: use the unified "x-axis width of monospaced font characters" field in the description information of the character interval to assign the x-axis width of the actual effective graphic of the specified character; use the "font dot matrix height" field in the file header area to assign the x-axis width of the actual effective graphic of the character and the y-axis height of the actual effective graphic of the character; assign the x-axis offset of the actual effective graphic of the character to 0; assign the y-axis offset of the actual effective graphic of the character to 0; and then read the dot matrix data of the character from the non-volatile storage medium.
[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. By designing a function that supports the mixed coexistence of multiple character intervals with different attributes on a dot matrix font library, it supports the mixed coexistence of equal-width character intervals, unequal-width character intervals, continuous-coded character intervals, and discrete-coded character intervals. Only one font file is needed to support complex and diverse application requirements and improve ease of use.
[0018] 2. The variable-length character bitmap information area is used to compress the data. When applied to terminal products with complete Chinese characters, the compression effect is obvious.
[0019] 3. By dividing the character intervals into multiple different intervals, different partitions use different query positioning methods to improve query efficiency: for continuously encoded character intervals, the method of directly calculating the offset is used; for discretely encoded character intervals, a search algorithm is used to obtain data more quickly. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A structural schematic diagram of a method for recording a dot matrix font library of the present invention; Figure 2 The present invention is a flowchart of a method for querying a dot matrix font library. DETAILED DESCRIPTION
[0021] In order to further explain the technical solution of the present invention, it is described in detail below through specific embodiments.
[0022] See also Figure 1 As shown, the present invention provides a method for recording a bitmap font library, including designing a bitmap font library file format layout into a file header area 100, a character access mapping table area 200, and a character bitmap information area 300.
[0023] The file header area 100 stores basic information description of the font library, specifically: stores and records information of annotation 101: dot height of the font, drawing baseline of the character, number of character intervals, and description information of multiple character intervals shown in annotation 102.
[0024] Furthermore, the description information of the character interval is specifically as follows: each character interval 103 stores and records the following information: the Unicode starting code point of the interval, the Unicode ending code point of the interval, the number of Unicode code points of the interval, a flag indicating whether the Unicode code points of the interval are continuous, a flag indicating whether the Unicode code points of the interval are of equal width, the x-axis width of characters in equal-width fonts, and the offset of the character access mapping table of the interval in the font file.
[0025] The character access mapping table area 200 contains multiple independent character access mapping tables. According to the flag indicating whether the Unicode code points of the interval in the above-mentioned character interval description information are continuous, the character access mapping table is divided into: a continuously encoded character access mapping table 201 and a discretely encoded character access mapping table 203.
[0026] Furthermore, the continuously encoded character access mapping table 201 stores and records the corresponding number of mapping table entries according to the number of Unicode code points of the interval in the above-mentioned character interval description information. Each mapping table entry 202 stores and records the following information: the offset of the character bitmap information in the font file, the length of the character bitmap information, and a flag indicating whether it has independent character bitmap attributes.
[0027] Furthermore, the discretely encoded character access mapping table 203 stores and records the corresponding number of mapping table entries according to the number of Unicode code points of the interval in the above-mentioned character interval description information, and each mapping table entry 204 stores and records the following information: the offset of the character bitmap information in the font file, the length of the character bitmap information, the flag indicating whether it has independent character bitmap attributes, and the Unicode code point value of the character.
[0028] Furthermore, the flag for whether it has independent character bitmap attributes is stored according to the following rules: when the character is of equal width, if it is found that the character fills the entire display block when extracting and making the character dot matrix, the corresponding character bitmap attribute in the font file will be discarded, and the value of the flag for whether it has independent character bitmap attributes is 0, otherwise it is 1.
[0029] The character bitmap information area 300 stores and records the bitmap attributes of the characters contained in the entire font and the dot matrix bitmap data of the effective graphics of the characters. The bitmap attributes of the characters and the dot matrix bitmap data of the effective graphics of the characters are used as a storage unit of the character bitmap information. The number of units is the number of characters contained in the entire font. Each character occupies one unit and is arranged closely. According to the flag of whether the Unicode code points of the intervals in the above-mentioned character interval description information are equal in width, the character bitmap information area is divided into: a bitmap information area 304 for equal-width characters and a bitmap information area 301 for unequal-width characters.
[0030] Furthermore, the storage rule for the dot matrix bitmap data of the effective graphics of the characters is as follows: the blank lines above and below the characters are discarded, and only the bitmap data of the effective rectangular area is saved. At this time, the area of the effective graphics of the characters is less than or equal to the entire display block, and the amount of data is less than or equal to the amount of data of the entire display block.
[0031] Furthermore, the storage rule for the bitmap attributes of the characters is as follows: when the character is a fixed-width character 304, the following information is stored and recorded: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, and the y-axis offset of the actual effective graphic of the character; when the character is a non-fixed-width character 301, the following information is stored and recorded: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, the y-axis offset of the actual effective graphic of the character, and the x-axis width of the character.
[0032] When the character is a monospaced character 304, the x-axis width of the character is uniformly indicated by the field in the description information of the above-mentioned character interval: "x-axis width of monospaced font character", and it is not necessary to store the x-axis width of the actual effective graphic of each character.
[0033] Furthermore, the bitmap information area of the monospaced character 304 is divided into the following three cases according to whether the character fills the entire display block: 1. As shown in the processing branch marked with the box 305: if it is found that the character fills the entire display block when extracting and making the character dot matrix, the storage unit of the character bitmap information will discard the character bitmap attribute and set the "flag of whether it has independent character bitmap attribute" field in the above-mentioned character access mapping table to 0. At this time, only the dot matrix bitmap data 305 of the character effective graphic is included. The area of the character effective graphic is equal to the entire display block, and the data volume is equal to the data volume of the entire display block; 2. As shown in the branches where the boxes marked 307 and 308 are located: if it is found that the character cannot fill the entire display block when extracting and making the character dot matrix, that is, there is a blank line above or below the display block, and at the same time, the sum of the length of the character's bitmap attribute and the length of the dot matrix bitmap data of the character's effective graphic is less than or equal to the bitmap data length of the entire display block, then the storage unit of the character bitmap information is consistent with the above, including the character's bitmap attribute 307 and the dot matrix bitmap data 308 of the character's effective graphic, and the "flag of whether it has independent character bitmap attributes" field in the above character access mapping table is set to 1 value, and the character's bitmap attribute 307 is used to indicate the position information of the character in the display block. At this time, the display area of the character's effective graphic 308 is smaller than the entire display block, and the data volume is smaller than the data volume of the entire display block; 3. As shown in the processing branch where the box marked 306 is located: If it is found during the extraction and production of the character dot matrix that the character cannot fill the entire display block, that is, there are blank lines above or below the display block, and at the same time, the sum of the length of the character's bitmap attribute and the length of the dot matrix bitmap data of the character's effective graphic is greater than the bitmap data length of the entire display block, then the character's bitmap attribute will be discarded and processed according to the processing branch of point 1 "the character fills the entire display block"; when the character fills the entire display block, during the program running process, the entire character bitmap attribute will be dynamically generated according to the description information in the header area of the above file, and there is no need to store and record the character bitmap attribute for each character.
[0034] like Figure 2 As shown, a method for querying a dot matrix font library proposed by the present invention comprises the following steps: 1. As shown in the process marked S500, the file header area of the font library is read from the non-volatile storage medium, and basic description information such as the dot height of the font, the drawing baseline of the character, the number of character intervals, and description information of multiple character intervals are obtained and stored in the memory; 2. If the memory is sufficient, preferably, the character access mapping table of the discrete character interval is saved in the memory to speed up the subsequent query efficiency; 3. As shown in the process marked S600, when the specified character is started to be queried, the description information of the character interval stored in the memory is traversed in sequence to obtain the character interval where the specified character is located; 4. If it is a continuously encoded character interval, as shown in the process marked S601, according to the code point of the character and the Unicode starting code point information of the character interval, and the offset of the character access mapping table of the interval in the font file, directly locate and obtain the character access mapping table entry of the specified character, specifically: multiply the difference between the code point of the character and the Unicode starting code point information of the character interval by the byte size of the character access mapping table entry, and then add the offset of the character access mapping table of the interval in the font file to obtain the character access mapping table entry of the specified character; 5. If it is a discretely coded character interval, traverse the entire character access mapping table, as shown in the process marked S602, locate and obtain the character access mapping table entry of the specified character, specifically: use a search algorithm to quickly locate and obtain the character access mapping table entry of the specified character; 6. When a character has independent character bitmap attributes, the character bitmap attributes include: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, the y-axis offset of the actual effective graphic of the character, and the x-axis width of the character; if the character is a monospaced character, as shown in the process marked S603, first use the unified "x-axis width of characters in monospaced fonts" field in the description information of the character interval to assign the x-axis width of the actual effective graphic of the specified character, then execute the steps shown in the process marked S604 to read the remaining bitmap attributes of the character from the non-volatile storage medium, and finally execute the steps shown in the process marked S606 to read the dot matrix data of the effective graphic of the character from the non-volatile storage medium; if the character is an unequal character, then directly execute the steps shown in the process marked S605 to read the complete bitmap attributes of the character from the non-volatile storage medium, and then execute the steps shown in the process marked S606 to read the dot matrix data of the effective graphic of the character from the non-volatile storage medium; 7. When a character does not have an independent character bitmap attribute, the character is a monospaced character at this time, and the entire character bitmap attribute is first dynamically generated, as shown in the process marked S607: use the unified "x-axis width of characters in monospaced fonts" field in the description information of the character interval to assign the x-axis width of the actual effective graphic of the specified character; use the "dot matrix height of the font" field in the file header area to assign the x-axis width of the actual effective graphic of the character and the y-axis height of the actual effective graphic of the character; assign the x-axis offset of the actual effective graphic of the character to 0; assign the y-axis offset of the actual effective graphic of the character to 0; and then execute the steps shown in the process marked S608 to read the dot matrix data of the effective graphic of the character (equivalent to the display block) from the non-volatile storage medium.
[0035] The present invention provides a recording method and a query method for a dot matrix font library. 1. By designing a function that supports the mixed coexistence of multiple character intervals with different attributes on a dot matrix font library, the mixed coexistence of equal-width character intervals, unequal-width character intervals, continuous-coded character intervals and discrete-coded character intervals is supported. Only one font file is needed to support complex and diverse application requirements, thereby improving ease of use.
[0036] 2. The variable-length character bitmap information area is used to compress the data. When applied to terminal products with complete Chinese characters, the compression effect is obvious, as follows: 1) When the characters are of different widths, the character bitmap information of each character is of complete size, including: complete bitmap attributes and dot matrix data of the character's effective graphics; 2) When the character is of equal width and fills the entire display block, the corresponding character bitmap attributes in the font file will be discarded; when the character cannot fill the entire display block, and the sum of the length of the character's bitmap attributes and the length of the dot matrix bitmap data of the character's effective graphics is less than or equal to the bitmap data length of the entire display block, the character bitmap information of each character is of a simplified size, including: simplified bitmap attributes and dot matrix data of the character's effective graphics; when the character cannot fill the entire display block, and the sum of the length of the character's bitmap attributes and the length of the dot matrix bitmap data of the character's effective graphics is greater than the bitmap data length of the entire display block, the character's bitmap attributes will be discarded and processed according to the processing branch of "the character fills the entire display block".
[0037] 3. By dividing the character intervals into multiple different intervals, different partitions use different query positioning methods to improve query efficiency: for continuously encoded character intervals, the method of directly calculating the offset is used; for discretely encoded character intervals, a search algorithm is used to obtain data more quickly.
[0038] The above description is only a preferred example of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for recording a dot matrix font library, characterized in that: The following steps are involved: Design the layout of the dot matrix font file format to include a file header area, a character access mapping table area, and a character bitmap information area; The file header area stores basic information description of the font library, and at least stores and records the following information: the dot height of the font, the drawing baseline of the character, the number of character intervals, and description information of multiple character intervals; The character access mapping table area contains a plurality of independent character access mapping tables, and the character access mapping tables are divided into: a continuously coded character access mapping table and a discretely coded character access mapping table according to a flag indicating whether the Unicode code points of the interval in the character interval description information are continuous; The character bitmap information area stores and records the bitmap attributes of the characters contained in the entire font library and the dot matrix bitmap data of the character effective graphics. The character bitmap attributes and the dot matrix bitmap data of the character effective graphics are used as a storage unit of character bitmap information. The number of units is the number of characters contained in the entire font library. Each character occupies one unit and is arranged closely. According to the flag of whether the Unicode code points of the intervals in the character interval description information are equal in width, the character bitmap information area is divided into: a bitmap information area for equal-width characters and a bitmap information area for unequal-width characters.
2. A method for recording a dot matrix font library according to claim 1, characterized in that: The description information of the character interval at least stores and records the following information: the Unicode starting code point of the interval, the Unicode ending code point of the interval, the number of Unicode code points of the interval, a flag indicating whether the Unicode code points of the interval are continuous, a flag indicating whether the Unicode code points of the interval are of equal width, the x-axis width of characters in a monospaced font, and the offset of the character access mapping table of the interval in the font file.
3. A method for recording a dot matrix font library according to claim 1, characterized in that: The continuously encoded character access mapping table stores and records a corresponding number of mapping table entries according to the number of Unicode code points of the interval in the character interval description information. Each mapping table entry stores and records at least the following information: the offset of the character bitmap information in the font file, the length of the character bitmap information, and a flag indicating whether it has independent character bitmap attributes.
4. A method for recording a dot matrix font library according to claim 1, characterized in that: The discretely coded character access mapping table stores and records a corresponding number of mapping table entries according to the number of Unicode code points of the interval in the character interval description information, and each mapping table entry stores and records at least the following information: the offset of the character bitmap information in the font file, the length of the character bitmap information, a flag indicating whether it has independent character bitmap attributes, and the Unicode code point value of the character.
5. A method for recording a dot matrix font library according to claim 4, characterized in that: The flag for indicating whether the character has independent bitmap attributes is stored according to the following rules: when the character is of equal width, if it is found that the character fills the entire display block when extracting and making the character dot matrix, the corresponding character bitmap attribute in the font file will be discarded, and the value of the flag for indicating whether the character has independent bitmap attributes is 0, otherwise it is 1.
6. A method for recording a dot matrix font library according to claim 1, characterized in that: The storage rule of the dot matrix bitmap data of the effective graphic of the character is: discard the blank lines above and below the character, and only save the bitmap data of the effective rectangular area. At this time, the area of the effective graphic of the character is less than or equal to the entire display block, and the data volume is less than or equal to the data volume of the entire display block.
7. The method for recording a dot matrix font library according to claim 1, characterized in that: The storage rule of the bitmap attributes of the characters is as follows: when the characters are equal-width characters, at least the following information is stored and recorded: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, and the y-axis offset of the actual effective graphic of the character; when the characters are unequal-width characters, at least the following information is stored and recorded: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, the y-axis offset of the actual effective graphic of the character, and the x-axis width of the character.
8. A method for recording a dot matrix font library according to claim 7, characterized in that: When the character is a monospaced character, the x-axis width of the character is uniformly indicated by the field "x-axis width of monospaced font character" in the description information of the above-mentioned character interval, and it is not necessary to store the x-axis width of the actual effective graphic of each character.
9. A method for recording a dot matrix font library according to claim 8, characterized in that: The bitmap information area of the equal-width character includes the following three situations, depending on whether the character fills the entire display block: 1) If it is found that the character fills the entire display block when extracting and making the character dot matrix, the storage unit of the character bitmap information will discard the character bitmap attribute and set the "flag of whether it has independent character bitmap attribute" field in the character access mapping table to 0. At this time, only the dot matrix bitmap data of the character effective graphic is included. The area of the character effective graphic is equal to the entire display block, and the data volume is equal to the data volume of the entire display block; 2) If it is found that the character cannot fill the entire display block when extracting and making the character dot matrix, that is, there is a blank line above or below the display block, and the sum of the length of the character bitmap attribute and the length of the dot matrix bitmap data of the character effective graphic is less than or equal to the bitmap data length of the entire display block, then the storage unit of the character bitmap information is consistent with the above, including the character bitmap attribute and the dot matrix bitmap data of the character effective graphic, and the "flag of whether it has independent character bitmap attributes" field in the character access mapping table is set to 1 value, and the character bitmap attribute is used to indicate the position information of the character in the display block. At this time, the display area of the character effective graphic is smaller than the entire display block, and the data volume is smaller than the data volume of the entire display block; 3) If it is found during the extraction and production of the character dot matrix that the character cannot fill the entire display block, that is, there are blank lines above or below the display block, and the sum of the length of the character's bitmap attribute and the length of the dot matrix bitmap data of the character's effective graphic is greater than the bitmap data length of the entire display block, then the character's bitmap attribute will be discarded and processed according to the processing branch of point 1 "the character fills the entire display block"; when the character fills the entire display block, during the program running process, the entire character bitmap attribute will be dynamically generated according to the description information in the file header area, and there is no need to store and record the character bitmap attribute for each character.
10. The method for querying a dot matrix font library according to claim 1, characterized in that: The following steps are involved:
1. Read the file header area of the font library from the non-volatile storage medium, obtain the basic description information such as the dot height of the font, the drawing baseline of the character, the number of character intervals, and the description information of multiple character intervals, and save it in the memory; Second, if the memory is sufficient, the character access mapping table of the discrete character interval is saved in the memory to speed up the subsequent query efficiency; 3. When starting to query for a specified character, traverse the description information of the character interval stored in the memory in sequence to obtain the character interval where the specified character is located; 4. If it is a continuously encoded character interval, then according to the character code point and the Unicode starting code point information of the character interval, as well as the offset of the character access mapping table of the interval in the font file, directly locate and obtain the character access mapping table entry of the specified character; 5. If it is a discretely encoded character interval, traverse the entire character access mapping table to locate and obtain the character access mapping table entry for the specified character; 6. When a character has independent character bitmap attributes, the character bitmap attributes include: the x-axis width of the actual effective graphic of the character, the y-axis height of the actual effective graphic of the character, the x-axis offset of the actual effective graphic of the character, the y-axis offset of the actual effective graphic of the character, and the x-axis width of the character; if the character is a monospaced character, then the "x-axis width of the character in monospaced font" field in the description information of the character interval is first used to assign the x-axis width of the actual effective graphic of the specified character, and then the remaining bitmap attributes and dot matrix data of the character are read from the non-volatile storage medium; if the character is an unequal character, then the complete bitmap attributes and dot matrix data of the character are directly read from the non-volatile storage medium; 7. When a character does not have an independent character bitmap attribute, the character is a monospaced character. The entire character bitmap attribute is first dynamically generated. The steps are: use the unified "x-axis width of monospaced font characters" field in the description information of the character interval to assign the x-axis width of the actual effective graphic of the specified character; use the "font dot matrix height" field in the file header area to assign the x-axis width of the actual effective graphic of the character and the y-axis height of the actual effective graphic of the character; assign the x-axis offset of the actual effective graphic of the character to 0; assign the y-axis offset of the actual effective graphic of the character to 0; and then read the dot matrix data of the character from the non-volatile storage medium.
Citation Information
Patent Citations
Lattice library generation method, query method and corresponding devices
CN106844559A
Dot matrix font library information recording method and dot matrix character generation method
CN112395828A