Printing template intelligent typesetting method and system, storage medium and equipment
By classifying and modularly calculating the printed characters and independently adjusting the character spacing and line spacing, the problem of misalignment and jagged on the right side of the printed data is solved, and the aesthetics is improved.
Patent Information
- Application Number
- CN202411257003.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2025-02-25
AI Technical Summary
The medical data printed in the prior art are prone to misalignment on the right side of the paper and jagged, which affects the aesthetics.
By sorting printed characters into Chinese character modules, digital modules, English modules and symbol modules, and separately calculate the module width and height of each character module, adjust the character spacing independently according to the printing area of each line, calculate the width spacing and lines of adjacent modules spacing, and then intelligently type.
It achieves neat endings of each line, avoiding jagged shapes on the right side of the paper, and improving the aesthetics of the printed data.
Smart Images

Figure CN119512478A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of printing and typesetting technology, and in particular to a printing template intelligent typesetting method, system, storage medium and device. Background Art
[0002] With the development of medical information technology, hospitals and other large medical institutions generally print out medical-related data, which puts forward new requirements for the aesthetics of the layout of medical-related data pages.
[0003] Many medical-related data need to be printed and saved, but in the prior art, the data automatically printed and saved by the system will appear misaligned on the right side of the paper and jagged, which is neither aesthetically pleasing nor meets the requirements. Summary of the invention
[0004] Based on this, the purpose of the present invention is to provide a printing template intelligent typesetting method, system, storage medium and device, which are used to solve the technical problem in the prior art that printed medical data is prone to misalignment on the right side of the paper and jagged appearance.
[0005] One aspect of the present invention provides a printing template intelligent typesetting method, comprising: Obtain printed characters, classify the printed characters according to categories to obtain multiple character modules, the character modules include Chinese character modules A, number modules S, English modules Y and symbol modules F, and calculate the module width W1 and module height H1 of each character module; Get the area width W2 and area height H2 of the print area in the print page, print characters in a loop, and get the corresponding module width W1 according to the module attribute of each printed character to calculate the total number of modules W that can be accommodated in each line count , according to the area width W2 and the total number of modules that can be accommodated in each row W count The difference between the two gets the remaining width W of each row temp ; According to the remaining width W of each line temp The total number of modules that can be accommodated in each row is W count Calculate the width of adjacent modules W interval ; Arrange the printed characters in order according to the width of adjacent modules. interval Set the spacing between two adjacent character modules in the current line; Print characters in a loop and get the height H of each line line And the number of rows displayed per page H count Combined with the area height H2, the remaining height H of each page is calculated. temp , according to the remaining height H of each page temp H count Calculate the spacing H between each rowinterval ; Set the current printing page according to the line spacing H interval The spacing between two adjacent lines of typesetting is used to print characters.
[0006] The above-mentioned printing template intelligent typesetting method classifies the printed characters into Chinese character modules A, number modules S, English modules Y and symbol modules F, and separately calculates the module width W1 and module height H1 of each character module, so that the character spacing of the current line can be independently adjusted according to the printing area of each line, thereby ensuring that the end of each line is neat and avoids jaggedness; specifically, first calculate the total number of modules W that can be accommodated in each line count , according to the total number of modules that each row can accommodate W count Get the adjacent module width spacing W interval , according to the adjacent module width spacing W interval The spacing value between two adjacent character modules in the current line of typesetting; then according to the remaining height H of each page temp H count Calculate the spacing H between each row interval , so that the current printing page is divided into two parts according to the line spacing H. interval The spacing value between two adjacent lines of typesetting is used to print characters, avoid jagged edges on the right side of the paper, and improve aesthetics.
[0007] In addition, the above-mentioned printing template intelligent typesetting method according to the present invention may also have the following additional technical features: Further, when obtaining the row height H of each row line In the steps: and calculating the height difference of the modules in each row to obtain the highest module according to the maximum height; The line height corresponding to the highest module is used as the printed line height H line .
[0008] Furthermore, the width spacing W of adjacent modules interval The calculation method is: W interval = W temp / (W count -1); Where W temp The remaining width of each line; W count The total number of modules that can be accommodated in each row.
[0009] Furthermore, the row spacing H interval The calculation method is: H interval = H temp / (H count -1); In the formula, Htemp The remaining height of each page, H count Displays the number of rows per page.
[0010] Furthermore, each row can accommodate a total number of modules W count The calculation method is: W count =CA+CF+CS+CY; In the formula, CA is the number of Chinese character modules that can be accommodated in each line; CF is the number of symbol modules that can be accommodated in each line; CS is the number of number modules that can be accommodated in each line; CY is the number of English modules that can be accommodated in each line.
[0011] Furthermore, the remaining width W of each row temp The calculation method is: W temp =W-WA 总 -WF 总 -WS 总 -WY 总 ; Where W is the area width W2; WA 总 WF is the total width of each line of Chinese character modules; 总 WS is the total width of each row of symbol modules; 总 The total width of each row of digital modules; WY 总 The total width of each line of English module.
[0012] Furthermore, the remaining height H of each page temp The calculation method is: H temp =HH line_1 -H line_2 -H line_3 -…-H line_n ; Where, H is the area height H2; H line_1 The height of the first row, H line_2 The height of the second row, H line_3 is the row height of the third row. Similarly, H line_n The height of the last row, where n is the number of rows displayed per page H count .
[0013] Another aspect of the present invention provides a printing template intelligent typesetting system, the system comprising: An acquisition module, used for acquiring printed characters, classifying the printed characters according to categories to obtain a plurality of character modules, wherein the character modules include a Chinese character module A, a number module S, an English module Y and a symbol module F, and calculating a module width W1 and a module height H1 of each character module; The width spacing calculation module is used to obtain the area width W2 and area height H2 of the printing area in the printing page, print characters in a loop, and obtain the corresponding module width W1 according to the module attribute of each printed character to calculate the total number of modules W that can be accommodated in each line count , according to the area width W2 and the total number of modules that can be accommodated in each row W count The difference between the two gets the remaining width W of each row temp ; According to the remaining width W of each line temp The total number of modules that can be accommodated in each row is W count Calculate the width of adjacent modules W interval ; The width spacing typesetting module is used to arrange the printed characters in order according to the width spacing W of adjacent modules. interval Set the spacing between two adjacent character modules in the current line; Line spacing calculation module, used to print characters in a loop and obtain the line height H of each line line And the number of rows displayed per page H count Combined with the area height H2, the remaining height H of each page is calculated. temp , according to the remaining height H of each page temp H count Calculate the spacing H between each row interval ; The line spacing typesetting module is used to arrange the current printing page according to the line spacing H interval The spacing between two adjacent lines of typesetting is used to print characters.
[0014] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned printing template intelligent typesetting method.
[0015] Another aspect of the present invention provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned intelligent typesetting method for printing templates when executing the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flow chart of the printing template intelligent typesetting method in the first embodiment of the present invention; Figure 2 A system block diagram of a printing template intelligent typesetting system in a second embodiment of the present invention; The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0017] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0019] In order to solve the technical problem that the printed medical data in the prior art is prone to misalignment on the right side of the paper and jagged appearance, the present application provides a printing template intelligent typesetting method, system, storage medium and device, by classifying the printed characters into Chinese character modules A, digital modules S, English modules Y and symbol modules F, and separately calculating the module width W1 and module height H1 of each character module, so that the character spacing of the current line can be independently adjusted according to the printing area of each line, thereby ensuring that the end of each line is neat and avoids jagged appearance; specifically, first calculate the total number of modules W that can be accommodated in each line count , according to the total number of modules that each row can accommodate W count Get the adjacent module width spacing W interval , according to the adjacent module width spacing W interval The spacing value between two adjacent character modules in the current line of typesetting; then according to the remaining height H of each page temp H count Calculate the spacing H between each row interval , so that the current printing page is divided into two parts according to the line spacing H. interval The spacing value between two adjacent lines of typesetting is used to print characters, avoid jagged edges on the right side of the paper, and improve aesthetics.
[0020] In order to facilitate understanding of the present invention, several embodiments of the present invention will be provided below. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0021] Embodiment 1 See also Figure 1 , which shows a printing template intelligent typesetting method in a first embodiment of the present invention, the method comprises steps S101 to S105: S101, obtaining printed characters, classifying the printed characters according to categories to obtain multiple character modules, the character modules include Chinese character modules A, number modules S, English modules Y and symbol modules F, and calculating the module width W1 and module height H1 of each character module.
[0022] Text sentences used in daily life generally include Chinese characters, numbers, English and symbols. Therefore, incorporating Chinese characters, numbers, English and symbols into factors to be considered in printing can meet daily printing needs. Furthermore, setting Chinese characters, numbers, English and symbols as separate modules facilitates the use of "movable type" splicing technology. The amount of text displayed in each line can be dynamically calculated according to the text display size, and then the amount of text displayed in each line can be equally divided and displayed, which is convenient for solving the problem of misaligned text display. S102, obtain the area width W2 and area height H2 of the print area in the print page, print characters in a loop, and obtain the corresponding module width W1 according to the module attribute of each printed character to calculate the total number of modules W that can be accommodated in each line count , according to the area width W2 and the total number of modules that can be accommodated in each row W count The difference between the two gets the remaining width W of each row temp ; According to the remaining width W of each line temp The total number of modules that can be accommodated in each row is W count Calculate the width of adjacent modules W interval .
[0023] Width of adjacent modules W interval The calculation method is: W interval = W temp / (W count -1); Where W temp The remaining width of each line; W count The total number of modules that can be accommodated in each row.
[0024] Each row can accommodate a total number of modules W count The calculation method is: W count =CA+CF+CS+CY; In the formula, CA is the number of Chinese character modules that can be accommodated in each line; CF is the number of symbol modules that can be accommodated in each line; CS is the number of number modules that can be accommodated in each line; CY is the number of English modules that can be accommodated in each line.
[0025] The remaining width of each line is W temp The calculation method is: W temp =W-WA 总 -WF 总 -WS 总 -WY总 ; Where W is the area width W2; WA 总 WF is the total width of each line of Chinese character modules; 总 WS is the total width of each row of symbol modules; 总 The total width of each row of digital modules; WY 总 The total width of each line of English module.
[0026] As a specific example: WA 总 =WA1+WA2+…+WA CA ;WF 总 =WF1+WF2+…+WF CF ; WS 总 =WS1+WS2+…+WS CS ; WY 总 =WY1+WY2+…+WY CY ; In the formula, WA1 is the width of the first Chinese character module in each row, WA2 is the width of the second Chinese character module in each row, and so on. CA The width of the last Chinese character module in each line; WF1 is the width of the first symbol module in each row, WF2 is the width of the second symbol module in each row, and so on. CF The width of the last symbol module in each row; WS1 is the width of the first digital module in each row; WS2 is the width of the second digital module in each row, and so on. CS The width of the last digital module in each row; WY1 is the width of the first English module in each line; WY2 is the width of the second English module in each line, and so on. CY The width of the last English module in each line.
[0027] S103, arranging the printed characters in order, according to the width spacing W of adjacent modules interval Set the spacing between two adjacent character modules in the current line.
[0028] S104, print characters in a loop and obtain the height H of each line line And the number of rows displayed per page H count Combined with the area height H2, the remaining height H of each page is calculated. temp , according to the remaining height H of each page temp H count Calculate the spacing H between each row interval .
[0029] Get the row height H of each row line In the steps: and calculate the height difference of the modules in each row to obtain the highest module according to the maximum height; the row height corresponding to the highest module is used as the printed row height H line .
[0030] Line spacing H interval The calculation method is: H interval = H temp / (H count -1); In the formula, H temp The remaining height of each page, H count Displays the number of rows per page.
[0031] Among them, the remaining height of each page is H temp The calculation method is: H temp =HH line_1 -H line_2 -H line_3 -…-H line_n ; Where, H is the area height H2; H line_1 The height of the first row, H line_2 The height of the second row, H line_3 is the row height of the third row. Similarly, H line_n The height of the last row, where n is the number of rows displayed per page H count .
[0032] S105, the current printing page is divided into two parts according to the line spacing H. interval The spacing between two adjacent lines of typesetting is used to print characters.
[0033] In summary, the printing template intelligent typesetting method in the above embodiment of the present invention, by classifying the printed characters into Chinese character modules A, digital modules S, English modules Y and symbol modules F, and separately calculating the module width W1 and module height H1 of each character module, can independently adjust the character spacing of the current line according to the printing area of each line, thereby ensuring that the end of each line is neat and avoids jaggedness; specifically, first calculate the total number of modules W that can be accommodated in each line count , according to the total number of modules that each row can accommodate W count Get the adjacent module width spacing W interval , according to the adjacent module width spacing W interval The spacing value between two adjacent character modules in the current line of typesetting; then according to the remaining height H of each page temp H count Calculate the spacing H between each row interval , so that the current printing page is divided into two parts according to the line spacing H. intervalThe spacing value between two adjacent lines of typesetting is used to print characters, avoid jagged edges on the right side of the paper, and improve aesthetics.
[0034] Embodiment 2 See also Figure 2 , which is shown as a printing template intelligent typesetting system in a second embodiment of the present invention, comprising: An acquisition module, used for acquiring printed characters, classifying the printed characters according to categories to obtain a plurality of character modules, wherein the character modules include a Chinese character module A, a number module S, an English module Y and a symbol module F, and calculating a module width W1 and a module height H1 of each character module; The width spacing calculation module is used to obtain the area width W2 and area height H2 of the printing area in the printing page, print characters in a loop, and obtain the corresponding module width W1 according to the module attribute of each printed character to calculate the total number of modules W that can be accommodated in each line count , according to the area width W2 and the total number of modules that can be accommodated in each row W count The difference between the two gets the remaining width W of each row temp ; According to the remaining width W of each line temp The total number of modules that can be accommodated in each row is W count Calculate the width of adjacent modules W interval ; The width spacing typesetting module is used to arrange the printed characters in order according to the width spacing W of adjacent modules. interval Set the spacing between two adjacent character modules in the current line; Line spacing calculation module, used to print characters in a loop and obtain the line height H of each line line And the number of rows displayed per page H count Combined with the area height H2, the remaining height H of each page is calculated. temp , according to the remaining height H of each page temp H count Calculate the spacing H between each row interval ; The line spacing typesetting module is used to arrange the current printing page according to the line spacing H interval The spacing between two adjacent lines of typesetting is used to print characters.
[0035] In summary, the printing template intelligent typesetting system in the above embodiment of the present invention, by classifying the printed characters into Chinese character modules A, digital modules S, English modules Y and symbol modules F, and separately calculating the module width W1 and module height H1 of each character module, can independently adjust the character spacing of the current line according to the printing area of each line, thereby ensuring that the end of each line is neat and avoids jaggedness; specifically, first calculate the total number of modules W that can be accommodated in each line count , according to the total number of modules that each row can accommodate Wcount Get the adjacent module width spacing W interval , according to the adjacent module width spacing W interval The spacing value between two adjacent character modules in the current line of typesetting; then according to the remaining height H of each page temp H count Calculate the spacing H between each row interval , so that the current printing page is divided into two parts according to the line spacing H. interval The spacing value between two adjacent lines of typesetting is used to print characters, avoid jagged edges on the right side of the paper, and improve aesthetics.
[0036] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0037] In addition, an embodiment of the present invention further provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method in the above embodiment when executing the program.
[0038] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0039] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in another suitable manner as necessary, and then stored in a computer memory.
[0040] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0041] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0042] Although embodiments of the present invention have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A printing template intelligent typesetting method, characterized in that: include: Obtain printed characters, classify the printed characters according to categories to obtain multiple character modules, the character modules include Chinese character modules A, number modules S, English modules Y and symbol modules F, and calculate the module width W1 and module height H1 of each character module; Get the area width W2 and area height H2 of the print area in the print page, print characters in a loop, and get the corresponding module width W1 according to the module attribute of each printed character to calculate the total number of modules W that can be accommodated in each line count , according to the area width W2 and the total number of modules that can be accommodated in each row W count The difference between the two gets the remaining width W of each row temp ; According to the remaining width W of each line temp The total number of modules that can be accommodated in each row is W count Calculate the width of adjacent modules W interval ; Arrange the printed characters in order according to the width of adjacent modules. interval Set the spacing between two adjacent character modules in the current line; Print characters in a loop and get the height H of each line line And the number of rows displayed per page H count Combined with the area height H2, the remaining height H of each page is calculated. temp , according to the remaining height H of each page temp H count Calculate the spacing H between each row interval ; Set the current printing page according to the line spacing H interval The spacing between two adjacent lines of typesetting is used to print characters.
2. The printing template intelligent typesetting method according to claim 1, characterized in that: Get the row height H of each row line In the steps: and calculating the height difference of the modules in each row to obtain the highest module according to the maximum height; The line height corresponding to the highest module is used as the printed line height H line .
3. The printing template intelligent typesetting method according to claim 1, characterized in that: Width of adjacent modules W interval The calculation method is: IN interval = In temp / (IN count -1); Where W temp The remaining width of each line; W count The total number of modules that can be accommodated in each row.
4. The printing template intelligent typesetting method according to claim 1, characterized in that: Line spacing H interval The calculation method is: H interval = H temp / (H count -1); In the formula, H temp The remaining height of each page, H count Displays the number of rows per page.
5. The printing template intelligent typesetting method according to claim 1, characterized in that: Each row can accommodate a total number of modules W count The calculation method is: W count =CA+CF+CS+CY; In the formula, CA is the number of Chinese character modules that can be accommodated in each line; CF is the number of symbol modules that can be accommodated in each line; CS is the number of digital modules that can be accommodated in each line; CY is the number of English modules that can be accommodated in each line.
6. The printing template intelligent typesetting method according to claim 1, characterized in that: The remaining width of each line is W temp The calculation method is: W temp =W-WA 总 -WF 总 -WS 总 -WY 总 ; Where W is the area width W2; WA 总 WF is the total width of each line of Chinese character modules; 总 WS is the total width of each row of symbol modules; 总 The total width of each row of digital modules; WY 总 The total width of each line of English module.
7. The printing template intelligent typesetting method according to claim 1, characterized in that: Each page remaining height H temp The calculation method is: H temp =H-H line_1 -H line_2 -H line_3 -…-H line_n ; Where, H is the area height H2; H line_1 The height of the first row, H line_2 The height of the second row, H line_3 is the row height of the third row. Similarly, H line_n The height of the last row, where n is the number of rows displayed per page H count .
8. A printing template intelligent typesetting system, characterized in that: The system comprises: An acquisition module, used for acquiring printed characters, classifying the printed characters according to categories to obtain a plurality of character modules, wherein the character modules include a Chinese character module A, a number module S, an English module Y and a symbol module F, and calculating a module width W1 and a module height H1 of each character module; The width spacing calculation module is used to obtain the area width W2 and area height H2 of the printing area in the printing page, print characters in a loop, and obtain the corresponding module width W1 according to the module attribute of each printed character to calculate the total number of modules W that can be accommodated in each line count , according to the area width W2 and the total number of modules that can be accommodated in each row W count The difference between the two gets the remaining width W of each row temp ; According to the remaining width W of each line temp The total number of modules that can be accommodated in each row is W count Calculate the width of adjacent modules W interval ; The width spacing typesetting module is used to arrange the printed characters in order according to the width spacing W of adjacent modules. interval Set the spacing between two adjacent character modules in the current line; Line spacing calculation module, used to print characters in a loop and obtain the line height H of each line line And the number of rows displayed per page H count Combined with the area height H2, the remaining height H of each page is calculated. temp , according to the remaining height H of each page temp H count Calculate the spacing H between each row interval ; The line spacing typesetting module is used to arrange the current printing page according to the line spacing H interval The spacing between two adjacent lines of typesetting is used to print characters.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the printing template intelligent typesetting method as described in any one of claims 1 to 7 is implemented.
10. A data processing device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the printing template intelligent typesetting method as described in any one of claims 1 to 7 is implemented.