A font library merging method and system
By calculating the font library length and address, adopting a one-to-one merging method and using identifiers to distinguish storage areas, the problem of complex and error-prone font library merging operations is solved, achieving simple, efficient font library merging and accurate reading.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FORYOU GENERAL ELECTRONICS
- Filing Date
- 2022-07-21
- Publication Date
- 2026-07-31
AI Technical Summary
Existing font merging methods are complex and error-prone, leading to garbled characters or incorrect characters when reading the font library.
By calculating the length and address of the font libraries to be merged, the storage address of the target font library in the merged font library is determined sequentially. A one-to-one merging method is adopted, which simplifies the font library integration process. The storage areas of different font libraries are distinguished by identifiers to prevent content overlap.
The font merging process has been simplified, reducing operational errors and ensuring the accuracy and consistency of font reading.
Smart Images

Figure CN115407935B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer word processing technology, and in particular to a method and system for merging character libraries. Background Technology
[0002] Currently, in all information systems and operating systems, displaying different fonts within the same text requires switching between different font libraries. This is because a standard font library can only store and display one font type. For example, the Song font library can only display the Song font type, the Hei font library can only display the Hei font type, the Kai font library can only display the Kai font type, and so on. For some personalized documents, text paragraphs need to display several font types simultaneously. For example, when different font types need to be displayed, different font libraries must be selected. If the required font library does not exist, it is necessary to download and install the font library, which is a cumbersome process. Moreover, storing multiple font libraries wastes storage space. Therefore, a new type of multi-font library is needed to display different font types.
[0003] Dot matrix displays require custom-made font libraries with different font sizes and fonts. Currently, the basic method for merging multiple font libraries is to open each font file using UltraEdit, then paste the contents of multiple font libraries into one, and calculate the address distribution. This method is complex and error-prone, leading to garbled characters or incorrect character reading during font library retrieval. Summary of the Invention
[0004] This invention provides a font merging method and system, which solves the technical problems of existing font merging methods being complex to operate and prone to errors.
[0005] To solve the above technical problems, the present invention provides a font merging method, including the following steps:
[0006] S1. Obtain the first target font library and the second target font library from the font libraries to be merged;
[0007] S2. Calculate the length of the first target character library and the length of the second target character library respectively;
[0008] S3. Based on the length of the first character library and the length of the second character library, determine the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library in sequence;
[0009] S4. Determine whether all the fonts to be merged have been merged. If yes, end the current merging operation; otherwise, return to step S1.
[0010] This basic solution is based on the merging requirements of character libraries. It sequentially obtains two sets of character libraries to be merged (i.e., the first target character library and the second target character library) and merges them one-to-one. According to the length of the first character library and the length of the second character library, it sequentially determines the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library. The merging method of two groups is simple and clear, simplifies the character library integration process, reduces the likelihood of errors when integrating character libraries, and makes the character library addresses clear and directly callable.
[0011] In a further embodiment, step S1 includes the following steps:
[0012] S11. Obtain two or more character sets to be merged;
[0013] S12. Select two character libraries to be merged as the first target character library and the second target character library according to the preset rules.
[0014] In a further implementation, step S2 specifically involves: calculating the maximum value of data contained in the currently input first target character library, and using it as the length of the first character library; calculating the maximum value of data contained in the currently input second target character library, and using it as the length of the second character library.
[0015] In a further embodiment, step S3 includes the following steps:
[0016] S31. Set the first address of the first target font library in the target merged font library;
[0017] S32. Based on the length of the first character library and the first starting address, calculate the first ending address of the final byte of the first target character library in the target merged character library;
[0018] S33. Determine the second starting address of the second target character library in the target merged character library based on the first ending address;
[0019] S34. Based on the length of the second character library and the second starting address, calculate the second ending address of the final byte of the second target character library in the target merged character library.
[0020] The first storage address includes a first starting address and a first ending address, and the second storage address includes a second starting address and a second ending address.
[0021] In a further embodiment, the second end address is,
[0022] PD3=FontSizeMax1+N+m+FontSizeMax2;
[0023] Where PD3 is the second end address, m is the identifier length, N is the first start address, FontSizeMax1 is the first font size length, and FontSizeMax2 is the second font size length.
[0024] This solution defines the starting point of the first target character library storage by setting a first starting address and determines the ending point (i.e., the first ending address) of the first target character library storage by using sequential storage rules. Then, based on the first ending address and combined with the identifier length, the starting point (i.e., the second starting address) of the second target character library storage is calculated. In other words, the first and second target character libraries are stored in sequential partitions at physical addresses. An identifier address is reserved between the first and second target character libraries to distinguish the end of the current character library (i.e., the first target character library) and prevent the content of the first and second target character libraries from overlapping when reading the character libraries.
[0025] The present invention also provides a character library merging system, comprising a character library input module, a character library merging module and a character library output module connected in sequence;
[0026] The character input module is used to input the first target character library and the second target character library to be merged;
[0027] The character library merging module is used to calculate the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library;
[0028] The font output module is used to output the merged target font library.
[0029] In a further embodiment, the character merging module includes a length calculation unit, a first address calculation module, and a second address calculation module that are interconnected.
[0030] The length calculation unit is used to calculate the length of the first target character set and the length of the second target character set currently input;
[0031] The first address calculation module is used to obtain the first start address and the first end address of the first target character library in the target merged character library based on the length of the first character library;
[0032] The second address calculation module is used to calculate the second starting address and the second ending address of the second target character library in the target merged character library based on the length of the second character library and the first ending address.
[0033] In a further embodiment, the first address calculation module includes a first length storage unit, a first address setting unit, and a first calculation unit; the first calculation unit is connected to the first length storage unit, the first address setting unit, and the first address calculation module.
[0034] The first length storage unit is used to store the first character length of the first target character set;
[0035] The first address setting unit is used to set the first first address of the first target font library;
[0036] The first address calculation module is used to calculate the first end address based on the first starting address and the first character library length.
[0037] In a further embodiment, the second address calculation module includes a second length storage unit, a second calculation unit, a third calculation unit, and an identifier setting unit. The second length storage unit is connected to the length calculation unit and the second calculation unit, and the third calculation unit is connected to the second calculation unit, the first address calculation module, and the identifier setting unit.
[0038] The second length storage unit is used to store the second character length of the second target character set;
[0039] The identifier setting unit is used to set the identifier length;
[0040] The third calculation unit is used to calculate the second starting address based on the identifier length, the second character library length, and the first starting address;
[0041] The second calculation unit is used to calculate the second end address based on the second starting address and the second character library length.
[0042] The font merging system in this solution uses various modules and units to implement each step of the font merging method, providing a hardware foundation for the method and facilitating its implementation. Attached Figure Description
[0043] Figure 1 This is a flowchart illustrating the workflow of a character library merging method provided in an embodiment of the present invention;
[0044] Figure 2 This is a system framework diagram of a font merging system provided in an embodiment of the present invention. Detailed Implementation
[0045] The embodiments of the present invention are described in detail below with reference to the accompanying drawings. The embodiments are given for illustrative purposes only and should not be construed as limiting the present invention. The accompanying drawings are for reference and illustration only and do not constitute a limitation on the scope of patent protection of the present invention, because many changes can be made to the present invention without departing from the spirit and scope of the present invention.
[0046] Example 1
[0047] This invention provides a method for merging character libraries, such as... Figure 1 As shown, in this embodiment, steps S1 to S4 are included:
[0048] S1. Obtain the first target font library and the second target font library from the font libraries to be merged, including steps S11 to S12:
[0049] S11. Obtain two or more character sets to be merged;
[0050] S12. Select two character sets to be merged as the first target character set and the second target character set according to the preset rules.
[0051] S2. Calculate the lengths of the first and second target character sets respectively:
[0052] Calculate the maximum value of data contained in the first target character set currently being input, and use it as the length of the first character set; calculate the maximum value of data contained in the second target character set currently being input, and use it as the length of the second character set.
[0053] S3. Based on the length of the first character library and the length of the second character library, determine the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library in sequence, including steps S31 to S34:
[0054] S31. Set the first address of the first target font library in the target merged font library;
[0055] S32. Based on the length of the first character set and the first starting address, calculate the first ending address of the final byte of the first target character set in the target merged character set;
[0056] The first end address is PD1 = FontSizeMax1 + N;
[0057] Where PD1 is the first end address, N is the first start address, and FontSizeMax1 is the first font size.
[0058] When merging font libraries for the first time, the first starting address can be set based on the starting address of the target font library to be merged. When merging font libraries for subsequent times, the first starting address can be set based on the starting address of the remaining storage space of the target font library to be merged, or the second ending address of the previous merge and the identifier length, to determine the first starting address of the first target font library in this round.
[0059] S33. Determine the second starting address of the second target font library in the target merged font library based on the first ending address;
[0060] The second address is PD2 = FontSizeMax1 + N + m;
[0061] Where PD2 is the second address, m is the identifier length, N is the first address, and FontSizeMax1 is the first font size.
[0062] S34. Based on the length of the second character library and the second starting address, calculate the second ending address of the final byte of the second target character library in the target merged character library.
[0063] The first storage address includes a first starting address and a first ending address, and the second storage address includes a second starting address and a second ending address.
[0064] The second end address is PD3 = FontSizeMax1 + N + m + FontSizeMax2;
[0065] Where PD3 is the second end address, m is the identifier length, N is the first start address, FontSizeMax1 is the first font size length, and FontSizeMax2 is the second font size length.
[0066] This embodiment defines the starting point of the first target character library storage by setting a first starting address and determines the ending point (i.e., the first ending address) of the first target character library storage by using sequential storage rules. Then, based on the first ending address and combined with the identifier length, the starting point (i.e., the second starting address) of the second target character library storage is calculated. That is, the first target character library and the second target character library achieve sequential partitioned storage in terms of physical address. An identifier address is reserved between the first target character library and the second target character library to distinguish the end of the current character library (i.e., the first target character library) and prevent the content of the first target character library and the second target character library from overlapping when reading the character library.
[0067] S4. Determine whether all fonts to be merged have been merged. If yes, end the current merging operation; otherwise, return to step S1.
[0068] Based on the merging requirements of character libraries, this invention sequentially acquires two sets of character libraries to be merged (i.e., the first target character library and the second target character library) and merges them one-to-one. According to the length of the first character library and the length of the second character library, the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library are determined in sequence. The merging method of two groups is simple and clear, simplifies the character library integration process, reduces the likelihood of errors when integrating character libraries, and makes the character library addresses clear for direct access.
[0069] Example 2
[0070] The reference numerals appearing in the accompanying drawings of this embodiment include: font input module 1; font merging module 2, length calculation unit 21, first address calculation module 22, first length storage unit A, first address setting unit B, first calculation unit C; second address calculation module 23, second length storage unit D, second calculation unit E, third calculation unit F, identifier setting unit G; font output module 3.
[0071] This invention also provides a font merging system, see [link to relevant documentation]. Figure 2 It includes a character input module 1, a character merging module 2, and a character output module 3 connected in sequence;
[0072] Font input module 1 is used to input the first target font and the second target font to be merged;
[0073] The font merging module 2 is used to calculate the first storage address and the second storage address of the first target font library and the second target font library in the target merged font library;
[0074] Font output module 3 is used to output the merged target font library.
[0075] In a further embodiment, the character merging module 2 includes a length calculation unit 21, a first address calculation module 22, and a second address calculation module 23 that are interconnected.
[0076] The length calculation unit 21 is used to calculate the length of the first target character library and the length of the second target character library currently input;
[0077] The first address calculation module 22 is used to obtain the first start address and the first end address of the first target character library in the target merged character library according to the length of the first character library;
[0078] The second address calculation module 23 is used to calculate the second starting address and the second ending address of the second target character library in the target merged character library based on the length of the second character library and the first ending address.
[0079] In a further embodiment, the first address calculation module 22 includes a first length storage unit A, a first address setting unit B, and a first calculation unit C; the first calculation unit C is connected to the first length storage unit A, the first address setting unit B, and the first address calculation module 22.
[0080] The first length storage unit A is used to store the first character length of the first target character library;
[0081] The first address setting unit B is used to set the first address of the first target font library;
[0082] The first address calculation module 22 is used to calculate the first end address based on the first starting address and the length of the first character library.
[0083] In a further embodiment, the second address calculation module 23 includes a second length storage unit D, a second calculation unit E, a third calculation unit F, and an identifier setting unit G. The second length storage unit D is connected to the length calculation unit 21 and the second calculation unit E, and the third calculation unit F is connected to the second calculation unit E, the first address calculation module 22, and the identifier setting unit G.
[0084] The second length storage unit D is used to store the second character length of the second target character library;
[0085] The identifier setting unit G is used to set the identifier length;
[0086] The third calculation unit F is used to calculate the second starting address based on the identifier length, the second character library length, and the first starting address;
[0087] The second calculation unit E is used to calculate the second end address based on the second starting address and the second character library length.
[0088] The font merging system in this solution uses various modules and units to implement each step of the font merging method, providing a hardware foundation for the method and facilitating its implementation.
[0089] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A method for merging character libraries, characterized in that, Including the following steps: S1. Obtain the first target font library and the second target font library from the font libraries to be merged; S2. Calculate the length of the first target character library and the length of the second target character library respectively; S3. Based on the length of the first character library and the length of the second character library, determine the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library in sequence; S4. Determine whether all the font libraries to be merged have been merged. If yes, end the merging operation; otherwise, return to step S1. Step S3 includes the following steps: S31. Set the first address of the first target font library in the target merged font library; S32. Calculate the first end address of the final byte of the first target character library in the target merged character library based on the length of the first character library and the first starting address; S33. Determine the second starting address of the second target character library in the target merged character library based on the first end address and the identifier length; the identifier length is used to separate the first target character library and the second target character library to prevent content overlap during reading; S34. Based on the length of the second character library and the second starting address, calculate the second ending address of the final byte of the second target character library in the target merged character library; The first storage address includes a first starting address and a first ending address, and the second storage address includes a second starting address and a second ending address; The second starting address is: PD2 = FontSizeMax1 + N + m; The second end address is: PD3 = FontSizeMax1 + N + m + FontSizeMax2; Where PD2 is the second starting address, PD3 is the second ending address, m is the identifier length, N is the first starting address, FontSizeMax1 is the first font size length, and FontSizeMax2 is the second font size length.
2. The character library merging method as described in claim 1, characterized in that, Step S1 includes the following steps: S11. Obtain two or more character sets to be merged; S12. Select two character libraries to be merged as the first target character library and the second target character library according to the preset rules.
3. The character library merging method as described in claim 2, characterized in that, Step S2 specifically involves: calculating the maximum value of data contained in the currently input first target character library, and using it as the length of the first character library; calculating the maximum value of data contained in the currently input second target character library, and using it as the length of the second character library.
4. A font merging system, applied to implement a font merging method as described in any one of claims 1 to 3, characterized in that: It includes a font input module, a font merging module, and a font output module connected in sequence; The character input module is used to input the first target character library and the second target character library to be merged; The character library merging module is used to calculate the first storage address and the second storage address of the first target character library and the second target character library in the target merged character library; The font output module is used to output the merged target font library; The character library merging module includes a length calculation unit, a first address calculation module, and a second address calculation module that are interconnected. The length calculation unit is used to calculate the length of the first target character set and the length of the second target character set currently input; The first address calculation module is used to obtain the first start address and the first end address of the first target character library in the target merged character library based on the length of the first character library; The second address calculation module is used to calculate the second starting address and the second ending address of the second target character library in the target merged character library based on the length of the second character library and the first ending address; The first address calculation module includes a first length storage unit, a first address setting unit, and a first calculation unit; the first calculation unit is connected to the first length storage unit, the first address setting unit, and the first address calculation module. The first length storage unit is used to store the first character length of the first target character set; The first address setting unit is used to set the first first address of the first target font library; The first address calculation module is used to calculate the first end address based on the first starting address and the first character library length; The second address calculation module includes a second length storage unit, a second calculation unit, a third calculation unit, and an identifier setting unit. The second length storage unit is connected to the length calculation unit and the second calculation unit, and the third calculation unit is connected to the second calculation unit, the first address calculation module, and the identifier setting unit. The second length storage unit is used to store the second character length of the second target character set; The identifier setting unit is used to set the identifier length; The third calculation unit is used to calculate the second starting address based on the identifier length, the second character library length, and the first starting address; The second calculation unit is used to calculate the second end address based on the second starting address and the second character library length.