Line spacing adjustment method and device, equipment and storage medium
By detecting the bottom distance of the last line of content in the layout, the line spacing is automatically adjusted to solve the problem of low line spacing adjustment efficiency, and achieves automatic adjustment of content to fill the layout without affecting the layout effect.
Patent Information
- Application Number
- CN202111544958.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-12-16
AI Technical Summary
In document editing or book writing, existing technologies require users to manually adjust line spacing to make the content fill the entire page, resulting in low adjustment efficiency and affecting the overall layout effect.
By detecting the distance between the bottom of the last line of content in the current page layout and the bottom of the page layout, compressible or expandable lines that meet the set conditions are identified, and the line spacing is automatically adjusted based on this distance, including compressing or expanding the line spacing to make the content fill the page layout.
It enables content to fill the entire page without manually adjusting line spacing, improving the efficiency of line spacing adjustment and maintaining the integrity of the overall layout.
Smart Images

Figure CN114186157B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular, to a line spacing adjustment method and device, equipment and storage medium. BACKGROUND
[0002] In the related art, when editing official documents or compiling books, a user often hopes that the content to be compiled can fill the entire page, so as to make the visual effect more full and plump. However, due to the height of the content, the paragraph distance and other reasons, the content of a page does not reach the full page in many cases. In this case, the user usually needs to manually adjust the line spacing or paragraph spacing based on the actual content of the current page, which easily affects the overall layout effect and is low in adjustment efficiency. SUMMARY
[0003] Therefore, the present application provides a line spacing adjustment method, device, equipment and storage medium to solve the above technical problems.
[0004] To achieve the above purpose, the technical solution adopted by the present application is as follows:
[0005] According to a first aspect of the embodiment of the present application, a line spacing adjustment method is provided, comprising:
[0006] In response to detecting that the bottom of the last line of content in the page center of the current page exceeds the bottom of the page center, a first distance by which the bottom of the last line of content exceeds the bottom of the page center is obtained;
[0007] In response to determining that the first distance meets a first set condition, a compressible line in the current page that meets a preset compression condition is determined.
[0008] Based on a target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed.
[0009] In an embodiment, the method further comprises:
[0010] In response to detecting that the first distance is less than the sum of the maximum preset compression values of the compressible lines in the current page that meet the preset compression condition, it is determined that the first distance meets the first set condition.
[0011] In an embodiment, the determination of the compressible line in the current page that meets the preset compression condition comprises:
[0012] Comparing the line spacing of each line in the current page with a preset distance threshold;
[0013] Lines with a line spacing greater than or equal to the preset distance threshold are identified as compressible lines that meet the preset compression conditions.
[0014] In one embodiment, the method further includes pre-determining the target line spacing compression value based on the following:
[0015] The average compression value of the line spacing of the compressible lines is determined based on the ratio of the first distance to the number of compressible lines.
[0016] The target line spacing compression value for the compressible line is determined based on the average line spacing compression value.
[0017] In one embodiment, the method further includes pre-determining the target line spacing compression value based on the following:
[0018] Determine the product of the line spacing of each of the compressible lines and the first distance;
[0019] Determine the ratio of the product to the sum of the line spacing of the compressible lines in the current page that meet the preset compression conditions;
[0020] The target line spacing compression value for each of the compressible lines is determined based on the ratio.
[0021] In one embodiment, the method further includes:
[0022] In response to determining that the first distance does not meet the first set condition, the last line of content in the layout of the current page is adjusted to the next page after the current page;
[0023] In response to detecting that the bottom of the adjusted current page margin exceeds the bottom of the last line of content in the margin, a second distance is obtained between the bottom of the adjusted current page margin and the bottom of the last line of content in the margin.
[0024] In response to determining that the second distance satisfies the second set condition, determine the expandable rows in the current page that satisfy the preset expansion condition;
[0025] The line spacing of the expandable line is expanded based on the target line spacing expansion value determined in advance according to the second distance.
[0026] In one embodiment, the method further includes:
[0027] In response to detecting that the second distance is less than the sum of the maximum preset expansion values, it is determined that the second distance satisfies the second preset condition, wherein the sum of the maximum preset expansion values is the sum of the maximum preset expansion values of the expandable rows in the current page that satisfy the preset expansion condition.
[0028] In one embodiment, determining the expandable lines in the current page that satisfy preset expansion conditions includes:
[0029] The line spacing of each row in the current page is compared with a preset distance threshold;
[0030] Rows with a line spacing greater than or equal to the preset distance threshold are identified as expandable rows that meet the preset expansion conditions.
[0031] In one embodiment, the method further includes pre-determining the target line spacing expansion value based on the following:
[0032] The average row spacing expansion value of the expandable rows is determined based on the ratio of the first distance to the number of expandable rows.
[0033] The target line spacing expansion value of the expandable row is determined based on the average line spacing expansion value.
[0034] In one embodiment, the method further includes pre-determining the target line spacing expansion value based on the following:
[0035] Determine the product of the row spacing of each of the expandable rows and the first distance;
[0036] Determine the ratio of the product to the sum of the line spacing of the expandable rows in the current page that satisfy the preset expansion conditions;
[0037] The target line spacing expansion value for each of the expandable rows is determined based on the ratio.
[0038] According to a first aspect of the present invention, a line spacing adjustment device is provided, comprising:
[0039] The first distance acquisition module is used to acquire a first distance between the bottom of the last line of content and the bottom of the page center when the bottom of the last line of content in the current page center is detected to exceed the bottom of the page center.
[0040] A compressible line determination module is used to determine compressible lines in the current page that satisfy preset compression conditions in response to determining that the first distance satisfies a first preset condition;
[0041] A line spacing compression module is used to compress the line spacing of the compressible line based on a target line spacing compression value determined in advance according to the first distance.
[0042] In one embodiment, the device further includes:
[0043] The first condition judgment module is used to determine that the first distance satisfies the first preset condition in response to detecting that the first distance is less than the sum of the maximum preset compression values, wherein the sum of the maximum preset compression values is the sum of the maximum preset compression values of the compressible rows in the current page that satisfy the preset compression conditions.
[0044] In one embodiment, the compressible line determination module includes:
[0045] The first comparison unit is used to compare the line spacing of each row in the current page with a preset distance threshold.
[0046] A compressible row determination unit is used to determine rows whose line spacing is greater than or equal to the preset distance threshold as compressible rows that meet the preset compression conditions.
[0047] In one embodiment, the apparatus further includes: a first compression value determination module;
[0048] The first compression value determination module includes:
[0049] An average compression value determination unit is used to determine the average compression value of the line spacing of the compressible lines based on the ratio of the first distance to the number of compressible lines.
[0050] The first compression value determination unit is used to determine the target line spacing compression value of the compressible line based on the average line spacing compression value.
[0051] In one embodiment, the apparatus further includes: a second compression value determination module;
[0052] The second compression value determination module includes:
[0053] A product determination unit is used to determine the product of the line spacing of each of the compressible lines and the first distance;
[0054] A ratio determination unit is used to determine the ratio of the product to the sum of the line spacing of the compressible lines in the current page that meet the preset compression conditions;
[0055] The second compression value determination unit is used to determine the target line spacing compression value for each of the compressible lines based on the ratio.
[0056] In one embodiment, the device further includes:
[0057] The line content adjustment module is used to adjust the last line of content in the current page layout to the next page in response to determining that the first distance does not meet the first set condition;
[0058] The second distance acquisition module is used to acquire a second distance in response to detecting that the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area.
[0059] An expandable row determination module is used to determine expandable rows in the current page that satisfy preset expansion conditions in response to determining that the second distance satisfies the second preset condition;
[0060] A line spacing expansion module is used to expand the line spacing of the expandable line based on a target line spacing expansion value determined in advance according to the second distance.
[0061] In one embodiment, the device further includes:
[0062] The second condition judgment module is used to determine that the second distance satisfies the second setting condition in response to detecting that the second distance is less than the sum of the maximum preset expansion values, wherein the sum of the maximum preset expansion values is the sum of the maximum preset expansion values of the expandable rows in the current page that satisfy the preset expansion conditions.
[0063] In one embodiment, the expandable row determination module includes:
[0064] The second comparison unit is used to compare the line spacing of each row in the current page with a preset distance threshold.
[0065] An expandable row determination unit is used to determine rows whose row spacing is greater than or equal to the preset distance threshold as expandable rows that meet the preset expansion conditions.
[0066] In one embodiment, the apparatus further includes: a first extended value determination module;
[0067] The first extended value determination module includes:
[0068] An average expansion value determination unit is used to determine the average expansion value of the line spacing of the expandable rows based on the ratio of the first distance to the number of expandable rows;
[0069] The first expansion value determination unit is used to determine the target line spacing expansion value of the expandable line based on the average line spacing expansion value.
[0070] In one embodiment, the apparatus further includes: a second extended value determination module;
[0071] The second extended value determination module includes:
[0072] A product determination unit is used to determine the product of the row spacing of each of the expandable rows and the first distance;
[0073] A ratio determination unit is used to determine the ratio of the product to the sum of the line spacing of the expandable rows in the current page that meet the preset expansion conditions;
[0074] The second expansion value determination unit is used to determine the target line spacing expansion value for each of the expandable rows based on the ratio.
[0075] According to a third aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0076] processor;
[0077] Memory used to store computer programs;
[0078] The processor is configured to implement the following when executing the computer program:
[0079] In response to detecting that the bottom of the last line of content in the current page's layout exceeds the bottom of the layout, a first distance is obtained between the bottom of the last line of content and the bottom of the layout.
[0080] In response to determining that the first distance satisfies a first preset condition, a compressible line in the current page that satisfies a preset compression condition is determined;
[0081] Based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed.
[0082] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, the program being implemented when processed by a processor:
[0083] In response to detecting that the bottom of the last line of content in the current page's layout exceeds the bottom of the layout, a first distance is obtained between the bottom of the last line of content and the bottom of the layout.
[0084] In response to determining that the first distance satisfies a first preset condition, a compressible line in the current page that satisfies a preset compression condition is determined;
[0085] Based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed.
[0086] Compared with existing technologies, the present invention, in response to detecting that the bottom of the last line of content in the current page extends beyond the bottom of the page layout, obtains a first distance between the bottom of the last line of content extending beyond the bottom of the page layout, and in response to determining that the first distance satisfies a first preset condition, determines compressible lines in the current page that satisfy preset compression conditions. Then, based on a target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible lines is compressed. Since the target line spacing compression value is determined based on the first distance between the bottom of the last line of content in the page layout and the bottom of the compressible lines is compressed based on the target line spacing compression value, the bottom of the last line of content after compression is located at the bottom of the page layout. This ensures that the compressed page content fills the entire page layout. Furthermore, since there is no need to manually adjust the spacing of a line or paragraph, the overall layout effect of the page content is not affected, and the efficiency of line spacing adjustment is significantly improved. Attached Figure Description
[0087] Figure 1 A flowchart of a line spacing adjustment method according to an exemplary embodiment of the present invention is shown;
[0088] Figure 2 A flowchart illustrating how to determine compressible lines in the current page that satisfy preset compression conditions according to an exemplary embodiment of the present invention is shown;
[0089] Figure 3 A flowchart illustrating how to determine the target line spacing compression value according to an exemplary embodiment of the present invention is shown;
[0090] Figure 4 A flowchart illustrating how to determine the target line spacing compression value according to yet another exemplary embodiment of the present invention is shown;
[0091] Figure 5 A flowchart of a line spacing adjustment method according to yet another exemplary embodiment of the present invention is shown;
[0092] Figure 6 A flowchart illustrating how to determine expandable rows in the current page that satisfy preset expansion conditions according to an exemplary embodiment of the present invention is shown;
[0093] Figure 7 A flowchart illustrating how to determine the target line spacing expansion value according to an exemplary embodiment of the present invention is shown;
[0094] Figure 8 A flowchart illustrating how to determine the target line spacing expansion value according to yet another exemplary embodiment of the present invention is shown;
[0095] Figure 9A structural block diagram of a line spacing adjustment device according to an exemplary embodiment of the present invention is shown;
[0096] Figure 10 A structural block diagram of a line spacing adjustment device according to another exemplary embodiment of the present invention is shown;
[0097] Figure 11 A structural block diagram of an electronic device according to an exemplary embodiment of the present invention is shown. Detailed Implementation
[0098] The present invention will now be described in detail with reference to the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional modifications made by those skilled in the art based on these embodiments are included within the scope of protection of the present invention.
[0099] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The singular forms “a,” “the,” and “the” used in this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0100] It should be understood that although the terms first, second, etc. may be used in this invention to describe various structures, these structures should not be limited to these terms. These terms are only used to distinguish structures of the same type from each other.
[0101] Figure 1 A flowchart illustrating a line spacing adjustment method according to an exemplary embodiment of the present invention is shown. This method can be applied to electronic devices with text editing capabilities (e.g., smartphones, tablets, desktop computers, etc.) or servers (e.g., a single server or a server cluster). The following description uses an application to an electronic device as an example. Figure 1 As shown, the method includes the following steps S101-S103:
[0102] In step S101, in response to detecting that the bottom of the last line of content in the current page extends beyond the bottom of the page center, a first distance is obtained in which the bottom of the last line of content extends beyond the bottom of the page center.
[0103] In this embodiment, when the electronic device detects that the bottom of the last line of content in the current page extends beyond the bottom of the page layout, it obtains a first distance between the bottom of the last line of content in the current page extending beyond the bottom of the page layout.
[0104] For example, when an electronic device has a document open, it can format the document. During the formatting process, it can detect whether the bottom of the last line of content on the current page extends beyond the bottom of the text area. If it detects that the bottom of the last line of content on the current page extends beyond the bottom of the text area, it can obtain a first distance between the bottom of the last line of content on the current page and the bottom of the text area. Here, the current page can be the currently formatted page in the document. For instance, after the page formatting is complete, the page can be displayed on the screen of the electronic device through rendering or other methods.
[0105] In step S102, in response to determining that the first distance satisfies the first set condition, a compressible line in the current page that satisfies the preset compression condition is determined.
[0106] In this embodiment, when the electronic device obtains that the bottom of the last line of content in the current page exceeds the first distance between the bottoms of the page, it can determine the lines in the current page that meet the preset compression conditions in response to determining that the first distance satisfies the first set condition, and then compress the lines.
[0107] For example, when an electronic device detects a first distance between the bottom of the last line of content in the current page's layout and the bottom of the layout, it can detect whether the first distance meets a pre-set first condition. If the first distance meets the first condition, it determines that the current page contains compressible lines that meet preset compression conditions. The first condition for the first distance can be set based on actual needs, such as being less than a set distance threshold.
[0108] In one embodiment, the electronic device may determine that the first distance satisfies the first preset condition in response to detecting that the first distance is less than the sum of the maximum preset compression values, wherein the sum of the maximum preset compression values may be the sum of the maximum preset compression values of the compressible lines in the current page that satisfy the preset compression conditions.
[0109] It is worth noting that the above-mentioned preset compression conditions are not limited in this implementation. For example, any row that meets the following conditions can be regarded as a compressible row that meets the preset compression conditions: the line spacing between a row and the next row has sufficient compression space, and the compression space can ensure that there is still a distance between a row and the next row after compression.
[0110] For example, the maximum preset compression value of a compressible line can refer to the maximum value that the compressible line can be compressed to, and this maximum value can be set based on actual typesetting needs, such as setting it to 1.5 pixels; or it can be determined by studying a large number of sample images and combining multiple experiments, which is not limited in this embodiment. In addition, in order to avoid the line spacing of the current page being over-compressed due to an excessively large first distance, which would affect the final typesetting effect, the first distance can be further limited to be less than a first set distance threshold when implementing this embodiment. For example, the first set distance threshold can be 18.5 pixels.
[0111] In another embodiment, the adjustment conditions satisfied by the above-mentioned compressible lines may also be referred to the following: Figure 2 The embodiments shown will not be described in detail here.
[0112] In step S103, the line spacing of the compressible line is compressed based on the target line spacing compression value determined in advance according to the first distance.
[0113] In this embodiment, when the electronic device determines that the first distance satisfies the first preset condition and identifies a compressible line in the current page that satisfies the preset compression condition, it can compress the line spacing of the compressible line based on a target line spacing compression value determined in advance according to the first distance. It is worth noting that the compressed line spacing of the compressible line = the line spacing of the compressible line before compression - the target line spacing compression value.
[0114] For example, once the electronic device determines that a line on the current page meets the preset compression conditions, it can obtain a target line spacing compression value pre-determined based on the first distance. Then, it can adjust the line spacing of the adjustable lines based on this target line spacing compression value. It is understood that since the target line spacing compression value is determined based on a first distance where the bottom of the last line of content in the text area exceeds the bottom of the text area, compressing the line spacing of the compressible lines based on this target line spacing compression value can ensure that the bottom of the last line of content after compression is located at the bottom of the text area, meaning that the compressed page content can fill the entire text area.
[0115] As described above, the method of this embodiment, in response to detecting that the bottom of the last line of content in the current page exceeds the bottom of the page center, obtains a first distance between the bottom of the last line of content and the bottom of the page center, and in response to determining that the first distance satisfies a first set condition, determines the compressible lines in the current page that satisfy the preset compression conditions, and then compresses the line spacing of the compressible lines based on a target line spacing compression value determined in advance according to the first distance. Since the target line spacing compression value is determined based on the first distance between the bottom of the last line of content in the page center and the bottom of the compressible lines is compressed based on the target line spacing compression value, the bottom of the last line of content after compression is located at the bottom of the page center, so that the compressed page content fills the entire page center. Furthermore, since there is no need to manually adjust the spacing of a certain line or paragraph, the overall layout effect of the page content is not affected, and the efficiency of line spacing adjustment is significantly improved.
[0116] Figure 2 A flowchart illustrating how to determine compressible lines in the current page that satisfy preset compression conditions according to an exemplary embodiment of the present invention is shown; this embodiment provides an illustrative example of how to determine compressible lines in the current page that satisfy preset compression conditions, based on the above embodiment. Figure 2 As shown, the step S102 above, which involves determining the compressible lines in the current page that meet the preset compression conditions, may include the following steps S201-S202:
[0117] In step S201, the line spacing of each row in the current page is compared with a preset distance threshold.
[0118] In this embodiment, the electronic device can obtain the line spacing of each row in the current page and compare the line spacing of each row with a preset distance threshold.
[0119] The aforementioned preset distance threshold can be set based on actual needs. The preset distance threshold can be set to the maximum preset compression value, such as 1.5 pixels. This embodiment does not limit this.
[0120] In step S201, rows with a line spacing greater than or equal to the preset distance threshold are determined as compressible rows that meet the preset compression conditions.
[0121] In this embodiment, after comparing the line spacing of each row in the current page with a preset distance threshold, each row with a line spacing greater than or equal to the preset distance threshold can be determined as a compressible row that meets the preset compression conditions.
[0122] As described above, this embodiment compares the line spacing of each line in the current page with a preset distance threshold, and determines the lines with line spacing greater than or equal to the preset distance threshold as compressible lines that meet the preset compression conditions. This allows for the reasonable determination of compressible lines in the current page that meet the preset compression conditions. Subsequently, based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible lines can be compressed, so that the compressed page content fills the entire page area without affecting the overall layout effect of the page content.
[0123] Figure 3 A flowchart illustrating how to determine the target line spacing compression value according to an exemplary embodiment of the present invention is shown; this embodiment may further include determining the target line spacing compression value based on the following steps S301-S302, in addition to the above embodiment:
[0124] In step S301, the average compression value of the line spacing of the compressible lines is determined based on the ratio of the first distance to the number of compressible lines.
[0125] In this embodiment, to determine the target line spacing compression value for compressing the line spacing of compressible lines, the average line spacing compression value of the compressible lines can be determined by calculating the ratio of the aforementioned first distance to the number of compressible lines. It is understood that since the bottom of the last line of content in the current page's layout extends beyond the bottom of the layout by the aforementioned first distance, by compressing the line spacing of the compressible lines so that the sum of the line spacing compression values of all compressible lines equals the aforementioned first distance, the bottom of the last line of content after compression will be exactly at the bottom of the layout. Therefore, the average line spacing compression value of the compressible lines can be determined by calculating the ratio of the first distance to the number of compressible lines.
[0126] In step S302, the target line spacing compression value of the compressible line is determined based on the average line spacing compression value.
[0127] In this embodiment, after determining the average line spacing compression value of the compressible rows based on the ratio of the first distance to the number of compressible rows, the target line spacing compression value of the compressible rows can be determined based on the average line spacing compression value. That is, the above-mentioned average line spacing compression value can be determined as the target line spacing compression value of the compressible rows, so that the line spacing of each compressible row can be compressed based on the target line spacing compression value.
[0128] As described above, this embodiment determines the average line spacing compression value of the compressible rows based on the ratio of the first distance to the number of compressible rows, and then determines the target line spacing compression value of the compressible rows based on the average line spacing compression value. This allows for the reasonable determination of the target line spacing compression value of the compressible rows based on the average line spacing compression value, and enables subsequent compression of the line spacing of the compressible rows based on the currently determined target line spacing compression value.
[0129] Figure 4 A flowchart illustrating how to determine the target line spacing compression value according to another exemplary embodiment of the present invention is shown; this embodiment may further include determining the target line spacing compression value based on the following steps S401-S403, in addition to the above embodiments:
[0130] In step S401, the product of the line spacing of each of the compressible lines and the first distance is determined.
[0131] In step S402, the ratio of the product to the sum of the line spacing of the compressible lines in the current page that meet the preset compression conditions is determined.
[0132] In step S403, the target line spacing compression value for each of the compressible lines is determined based on the ratio.
[0133] In this embodiment, to determine the target line spacing compression value for compressing the line spacing of compressible lines, the product of the line spacing of each compressible line and the first distance can be determined, then the ratio of the product to the sum of the line spacings of compressible lines in the current page that meet the preset compression conditions can be determined, and then the target line spacing compression value of each compressible line can be determined based on the ratio. Specifically, the target line spacing compression value of a compressible line can be calculated based on the following formula (1):
[0134]
[0135] Where space represents the first distance mentioned above, and linespace represents the second distance. i Let be the line spacing of the i-th compressible line, and n be the number of compressible lines in the current page.
[0136] As can be seen from the above formula (1), the target line spacing compression value of each compressible line is related to its own line spacing size. That is, the target line spacing compression value of the compressible line with a large line spacing is larger, and the target line spacing compression value of the compressible line with a small line spacing is smaller. This ensures that when the line spacing of each compressible line is compressed based on the currently determined target line spacing compression value, the layout effect of the current page can be maintained.
[0137] As described above, this embodiment determines the product of the line spacing of each compressible line and the first distance, and determines the ratio of the product to the sum of the line spacings of the compressible lines that meet the preset compression conditions in the current page. Then, based on the ratio, it determines the target line spacing compression value of each compressible line. This allows for the reasonable determination of the target line spacing compression value of each compressible line based on its line spacing size. Consequently, it enables the subsequent compression of the line spacing of the corresponding compressible lines based on the currently determined target line spacing compression value.
[0138] Figure 5 A flowchart of a line spacing adjustment method according to another exemplary embodiment of the present invention is shown. The method of this embodiment can be applied to electronic devices with text editing functions (e.g., smartphones, tablets, desktop computers, etc.) or servers (e.g., a server or a server cluster consisting of one or more servers). The following description uses an application to an electronic device as an example. Figure 5 As shown, the method includes the following steps S501-S508:
[0139] In step S501, in response to detecting that the bottom of the last line of content in the current page extends beyond the bottom of the page center, a first distance is obtained in which the bottom of the last line of content extends beyond the bottom of the page center.
[0140] In step S502, it is determined whether the first distance meets the first set condition: if yes, then step S503 is executed; if no, then step S505 is executed.
[0141] In step S503, compressible lines in the current page that meet preset compression conditions are determined.
[0142] In step S504, the line spacing of the compressible line is compressed based on the target line spacing compression value determined in advance according to the first distance.
[0143] The explanations and descriptions of steps S501 and S503-S504 can be found above. Figure 1 Steps S101-S103 in the illustrated embodiment will not be described in detail here.
[0144] In step S505, the last line of content in the layout of the current page is moved to the next page after the current page.
[0145] For example, when the detected first distance is greater than or equal to the sum of the maximum preset compression values, it can be determined that the first distance does not meet the first set condition, and thus the last line of content in the current page's layout can be moved to the next page after the current page. This next page can be the page immediately following the current page.
[0146] Understandably, after the above adjustments, the original last line of the current page becomes the first line of the next page, and the original second-to-last line becomes the last line of the current page.
[0147] In one embodiment, after adjusting the last line of content in the current page's text area to the next page, if it is detected that the bottom of the last line of content in the adjusted current page's text area exceeds the bottom of the text area, the process can return to step S501; if it is detected that the bottom of the last line of content in the adjusted current page's text area is exactly at the bottom of the text area, the line spacing adjustment process for the current page can end. Further, if there is a next page after the current page, the line spacing adjustment process for the next page can continue, treating the next page as the new current page and continuing to execute step S501. If it is detected that the bottom of the text area exceeds the bottom of the last line of content in the adjusted current page's text area, the process can continue to execute step S506.
[0148] In step S506, in response to detecting that the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area, a second distance is obtained between the bottom of the adjusted current page's text area and the bottom of the last line of content in the text area.
[0149] In this embodiment, after the last line of content in the current page's text area is adjusted to the next page, it can be detected whether the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area. Then, when it is detected that the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area, a second distance between the bottom of the adjusted current page's text area and the bottom of the last line of content in the text area can be obtained.
[0150] In step S507, in response to determining that the second distance satisfies the second set condition, expandable rows in the current page that satisfy the preset expansion condition are determined.
[0151] In this embodiment, when the electronic device obtains a second distance where the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area, it can determine, in response to determining that the second distance satisfies a second preset condition, an expandable line in the current page that satisfies a preset expansion condition.
[0152] For example, when an electronic device obtains a second distance where the bottom of the current page's text area exceeds the bottom of the last line of content within the text area, it can detect whether the second distance meets a pre-set second condition. If the second distance meets the second condition, it determines an expandable line in the current page that satisfies a preset expansion condition. The second condition for the second distance can be set based on actual needs, such as being less than a set distance threshold.
[0153] In one embodiment, the electronic device may determine that the second distance satisfies the second preset condition in response to detecting that the second distance is less than the sum of the maximum preset expansion values, wherein the sum of the maximum preset expansion values may be the sum of the maximum preset expansion values of the expandable rows in the current page that satisfy the preset expansion conditions.
[0154] It is worth noting that the above-mentioned preset expansion conditions are not limited in this implementation. For example, any line that meets the following conditions can be regarded as an expandable line that meets the preset expansion conditions: the line spacing between a certain line and the next line is limited to a certain numerical range to ensure that the layout is not too loose.
[0155] For example, the maximum preset expansion value of the expandable line can refer to the maximum value that the expandable line can be expanded to, and this maximum value can be set based on actual typesetting needs, such as setting it to 4 pixels; or it can be determined by studying a large number of sample images and combining multiple experiments, which is not limited in this embodiment. In addition, in order to avoid the line spacing between each line being too large after the line spacing of the current page is expanded due to the second distance being too large, making the typesetting too loose and affecting the final typesetting effect, in implementing this embodiment, the above-mentioned second distance can be further limited to be less than a second preset distance threshold. For example, the second preset distance threshold can be 38 pixels.
[0156] In another embodiment, the adjustment conditions satisfied by the aforementioned expandable rows may also be found in the following: Figure 6 The embodiments shown will not be described in detail here.
[0157] In step S508, the line spacing of the expandable line is expanded based on the target line spacing expansion value determined in advance according to the second distance.
[0158] In this embodiment, when the electronic device determines that the second distance satisfies the second preset condition and identifies expandable rows in the current page that satisfy the preset expansion condition, it can expand the line spacing of the expandable rows based on a target line spacing expansion value determined in advance according to the second distance. It is worth noting that the expanded line spacing of the expandable rows = the original line spacing of the expandable rows + the target line spacing expansion value.
[0159] For example, when an electronic device determines that an expandable row in the current page meets the preset expansion conditions, it can obtain the target line spacing expansion value determined in advance based on the second distance, and then adjust the line spacing of the adjustable row based on the target line spacing expansion value.
[0160] It is understandable that since the target line spacing expansion value is determined based on the second distance that the bottom of the page area exceeds the bottom of the last line of content in the page area, expanding the line spacing of expandable lines based on this target line spacing expansion value can make the bottom of the last line of content after expansion located at the bottom of the page area, that is, it can make the expanded page content fill the entire page area.
[0161] Figure 6 A flowchart illustrating how to determine expandable rows in the current page that satisfy preset expansion conditions according to an exemplary embodiment of the present invention is shown; this embodiment provides an illustrative example of how to determine expandable rows in the current page that satisfy preset expansion conditions, based on the above embodiment. Figure 6 As shown, the step S507 above, which involves determining the expandable rows in the current page that meet the preset expansion conditions, may include the following steps S601-S602:
[0162] In step S601, the line spacing of each row in the current page is compared with a preset distance threshold.
[0163] In this embodiment, the electronic device can obtain the line spacing of each row in the current page and compare the line spacing of each row with a preset distance threshold.
[0164] The aforementioned preset distance threshold can be set based on actual needs. For example, the preset distance threshold can be set to a maximum preset extension value, such as 1.5 pixels; this embodiment does not limit this setting.
[0165] In step S601, rows with a line spacing greater than or equal to the preset distance threshold are determined as expandable rows that meet the preset expansion conditions.
[0166] In this embodiment, after comparing the line spacing of each row in the current page with a preset distance threshold, each row with a line spacing greater than or equal to the preset distance threshold can be determined as an expandable row that meets the preset expansion conditions.
[0167] As described above, this embodiment compares the line spacing of each line in the current page with a preset distance threshold, and determines the lines with line spacing greater than or equal to the preset distance threshold as expandable lines that meet the preset expansion conditions. This allows for the reasonable determination of expandable lines in the current page that meet the preset expansion conditions. Subsequently, based on the target line spacing expansion value determined in advance according to the second distance, the line spacing of the expandable lines can be expanded so that the expanded page content fills the entire page area without affecting the overall layout effect of the page content.
[0168] Figure 7 A flowchart illustrating how to determine the target line spacing expansion value according to an exemplary embodiment of the present invention is shown; this embodiment may further include determining the target line spacing expansion value based on the following steps S701-S702, in addition to the above embodiment:
[0169] In step S701, the average row spacing expansion value of the expandable rows is determined based on the ratio of the second distance to the number of expandable rows.
[0170] In this embodiment, to determine the target line spacing expansion value for expanding the line spacing of expandable lines, the average line spacing expansion value of expandable lines can be determined by calculating the ratio of the aforementioned second distance to the number of expandable lines. It is understood that since the distance by which the bottom of the current page's text area exceeds the bottom of the last line of content within the text area is the aforementioned second distance, as long as the line spacing of the expandable lines is expanded so that the sum of the line spacing expansion values of all expandable lines equals the aforementioned second distance, the bottom of the expanded last line of content will be exactly at the bottom of the text area. Therefore, the average line spacing expansion value of expandable lines can be determined by calculating the ratio of the second distance to the number of expandable lines.
[0171] In step S702, the target line spacing expansion value of the expandable line is determined based on the average line spacing expansion value.
[0172] In this embodiment, after determining the average line spacing expansion value of the expandable row based on the ratio of the second distance to the number of expandable rows, the target line spacing expansion value of the expandable row can be determined based on the average line spacing expansion value. That is, the above-mentioned average line spacing expansion value can be determined as the target line spacing expansion value of the expandable row, so that the line spacing of each expandable row can be expanded based on the target line spacing expansion value.
[0173] As described above, this embodiment determines the average line spacing expansion value of the expandable row based on the ratio of the second distance to the number of expandable rows, and then determines the target line spacing expansion value of the expandable row based on the average line spacing expansion value. This allows for the reasonable determination of the target line spacing expansion value of the expandable row based on the average line spacing expansion value, and enables subsequent expansion of the line spacing of the expandable row based on the currently determined target line spacing expansion value.
[0174] Figure 8 A flowchart illustrating how to determine the target line spacing expansion value according to another exemplary embodiment of the present invention is shown; this embodiment may further include determining the target line spacing expansion value based on the following steps S801-S803, in addition to the above embodiments:
[0175] In step S801, the product of the row spacing of each of the expandable rows and the second distance is determined.
[0176] In step S802, the ratio of the product to the sum of the line spacing of the expandable rows in the current page that satisfy the preset expansion conditions is determined.
[0177] In step S803, the target line spacing expansion value for each of the expandable rows is determined based on the ratio.
[0178] In this embodiment, to determine the target line spacing expansion value for expanding the line spacing of expandable rows, the product of the line spacing of each expandable row and the second distance can be determined, and then the ratio of the product to the sum of the line spacings of expandable rows that meet the preset expansion conditions in the current page can be determined. The target line spacing expansion value for each expandable row can then be determined based on this ratio. Specifically, the target line spacing expansion value for expandable rows can be calculated based on the following formula (1):
[0179]
[0180] Where space refers to the second distance mentioned above, and linespace refers to the second distance mentioned above. i Let n be the line spacing of the i-th expandable line, and n be the number of expandable lines in the current page.
[0181] As can be seen from equation (2) above, the target line spacing expansion value of each expandable row is related to its own line spacing size. That is, the target line spacing expansion value of expandable rows with larger line spacing is larger, and the target line spacing expansion value of expandable rows with smaller line spacing is smaller. This ensures that when the line spacing of each expandable row is expanded based on the currently determined target line spacing expansion value, the layout effect of the current page can be maintained. That is, paragraphs that were originally "loose" (i.e., with larger line spacing) will still be "loose" after the line spacing expansion, while paragraphs that were originally "compact" (i.e., with smaller line spacing) will not become very "loose" after the line spacing expansion.
[0182] As described above, this embodiment determines the product of the line spacing of each expandable row and the second distance, and determines the ratio of the product to the sum of the line spacings of the expandable rows that meet the preset expansion conditions in the current page. Then, based on the ratio, it determines the target line spacing expansion value of each expandable row. This allows for the reasonable determination of the target line spacing expansion value of each expandable row based on the line spacing size of each expandable row. Consequently, it enables the subsequent expansion of the line spacing of the corresponding expandable rows based on the currently determined target line spacing expansion value.
[0183] Figure 9 A structural block diagram of a line spacing adjustment device according to an exemplary embodiment of the present invention is shown; the device of this embodiment can be applied to electronic devices (e.g., smartphones, tablets, desktop computers, etc.) or servers (e.g., a server or a server cluster consisting of multiple servers) with text editing functions. Figure 9 As shown, the device includes: a first distance acquisition module 110, a compressible line determination module 120, and a line spacing compression module 130, wherein:
[0184] The first distance acquisition module 110 is used to acquire a first distance between the bottom of the last line of content and the bottom of the page center when the bottom of the last line of content in the current page center is detected to exceed the bottom of the page center.
[0185] The compressible line determination module 120 is configured to determine compressible lines in the current page that satisfy preset compression conditions in response to determining that the first distance satisfies a first preset condition;
[0186] The line spacing compression module 130 is used to compress the line spacing of the compressible line based on a target line spacing compression value determined in advance according to the first distance.
[0187] As described above, the device in this embodiment, in response to detecting that the bottom of the last line of content in the current page extends beyond the bottom of the page center, obtains a first distance between the bottom of the last line of content and the bottom of the page center, and in response to determining that the first distance satisfies a first preset condition, determines compressible lines in the current page that satisfy preset compression conditions. Then, based on a target line spacing compression value determined in advance according to the first distance, it compresses the line spacing of the compressible lines. Since the target line spacing compression value is determined based on the first distance between the bottom of the last line of content in the page center and the bottom of the compressible lines is compressed based on the target line spacing compression value, the bottom of the last line of content after compression is located at the bottom of the page center, so that the compressed page content fills the entire page center. Furthermore, since there is no need to manually adjust the spacing of a certain line or segment, the overall layout effect of the page content is not affected, and the efficiency of line spacing adjustment is significantly improved.
[0188] Figure 10 A structural block diagram of a line spacing adjustment device according to another exemplary embodiment of the present invention is shown; the device of this embodiment can be applied to electronic devices (e.g., smartphones, tablets, desktop computers, etc.) or servers (e.g., a server or a server cluster consisting of multiple servers, etc.) with text editing functions. Figure 10 As shown, the first distance acquisition module 210, the compressible line determination module 220, and the line spacing compression module 230 are the same as those mentioned above. Figure 9 The first distance acquisition module 110, the compressible line determination module 120, and the line spacing compression module 130 in the illustrated embodiment have the same functions, which will not be described in detail here.
[0189] like Figure 10 As shown, the device may further include:
[0190] The first condition judgment module 240 is used to determine that the first distance satisfies the first preset condition in response to detecting that the first distance is less than the sum of the maximum preset compression values, wherein the sum of the maximum preset compression values is the sum of the maximum preset compression values of the compressible rows in the current page that satisfy the preset compression conditions.
[0191] In one embodiment, the compressible line determination module 220 may include:
[0192] The first comparison unit 221 is used to compare the line spacing of each row in the current page with a preset distance threshold.
[0193] The compressible row determination unit 222 is used to determine rows whose row spacing is greater than or equal to the preset distance threshold as compressible rows that meet the preset compression conditions.
[0194] In one embodiment, the above-described apparatus may further include: a first compression value determination module 250;
[0195] The first compression value determination module 250 may include:
[0196] The average compression value determination unit 251 is used to determine the average compression value of the line spacing of the compressible lines based on the ratio of the first distance to the number of compressible lines.
[0197] The first compression value determination unit 252 is used to determine the target line spacing compression value of the compressible line based on the average line spacing compression value.
[0198] In one embodiment, the above-described apparatus may further include: a second compression value determination module 260;
[0199] The second compression value determination module 260 may include:
[0200] The product determination unit 261 is used to determine the product of the line spacing of each of the compressible lines and the first distance;
[0201] The ratio determination unit 262 is used to determine the ratio of the product to the sum of the line spacing of the compressible lines in the current page that meet the preset compression conditions;
[0202] The second compression value determination unit 263 is used to determine the target line spacing compression value for each of the compressible lines based on the ratio.
[0203] In one embodiment, the above-described apparatus may further include:
[0204] The line content adjustment module 270 is used to adjust the last line of content in the current page to the next page in response to determining that the first distance does not meet the first set condition;
[0205] The second distance acquisition module 280 is used to acquire a second distance in response to detecting that the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area.
[0206] The expandable row determination module 290 is configured to determine expandable rows in the current page that satisfy preset expansion conditions in response to determining that the second distance satisfies the second preset condition;
[0207] The line spacing expansion module 300 is used to expand the line spacing of the expandable line based on a target line spacing expansion value determined in advance according to the second distance.
[0208] In one embodiment, the above-described apparatus may further include:
[0209] The second condition judgment module 310 is used to determine that the second distance satisfies the second setting condition in response to detecting that the second distance is less than the sum of the maximum preset expansion values, wherein the sum of the maximum preset expansion values is the sum of the maximum preset expansion values of the expandable rows in the current page that satisfy the preset expansion conditions.
[0210] In one embodiment, the aforementioned expandable row determination module 290 may include:
[0211] The second comparison unit 291 is used to compare the line spacing of each row in the current page with a preset distance threshold.
[0212] The expandable row determination unit 292 is used to determine rows whose row spacing is greater than or equal to the preset distance threshold as expandable rows that meet the preset expansion conditions.
[0213] In one embodiment, the above-described apparatus further includes: a first extended value determination module 320;
[0214] The first extended value determination module 320 may include:
[0215] The average expansion value determination unit 321 is used to determine the average expansion value of the line spacing of the expandable lines based on the ratio of the first distance to the number of expandable lines;
[0216] The first expansion value determination unit 322 is used to determine the target line spacing expansion value of the expandable line based on the average line spacing expansion value.
[0217] In one embodiment, the above-described apparatus may further include: a second extended value determination module 330;
[0218] The second extended value determination module 330 may include:
[0219] The product determination unit 331 is used to determine the product of the row spacing of each of the expandable rows and the first distance;
[0220] The ratio determination unit 332 is used to determine the ratio of the product to the sum of the line spacing of the expandable lines in the current page that meet the preset expansion conditions;
[0221] The second expansion value determination unit 333 is used to determine the target line spacing expansion value for each of the expandable rows based on the ratio.
[0222] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the present invention according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0223] The embodiments of the line spacing adjustment device of the present invention can be applied to network devices. The device embodiments can be implemented through software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of the device loading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 11 The diagram shown is a hardware structure diagram of an electronic device containing the line spacing adjustment device of the present invention, except... Figure 11 In addition to the processor, network interface, memory, and non-volatile memory shown, the device in the embodiment may also include other hardware, such as a forwarding chip responsible for processing packets; from a hardware structure perspective, the device may also be a distributed device, which may include multiple interface cards to extend packet processing at the hardware level.
[0224] This invention also provides a computer-readable storage medium having a computer program stored thereon, which is implemented when processed by a processor:
[0225] In response to detecting that the bottom of the last line of content in the current page's layout exceeds the bottom of the layout, a first distance is obtained between the bottom of the last line of content and the bottom of the layout.
[0226] In response to determining that the first distance satisfies a first preset condition, a compressible line in the current page that satisfies a preset compression condition is determined;
[0227] Based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed.
[0228] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
[0229] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for adjusting line spacing, characterized in that, include: In response to detecting that the bottom of the last line of content in the current page's layout exceeds the bottom of the layout, a first distance is obtained between the bottom of the last line of content and the bottom of the layout. In response to determining that the first distance satisfies a first preset condition, a compressible line in the current page that satisfies a preset compression condition is determined; Based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed; The method further includes: In response to determining that the first distance does not meet the first set condition, the last line of content in the layout of the current page is adjusted to the next page after the current page; In response to detecting that the bottom of the adjusted current page margin exceeds the bottom of the last line of content in the margin, a second distance is obtained between the bottom of the adjusted current page margin and the bottom of the last line of content in the margin. In response to determining that the second distance satisfies the second set condition, determine the expandable rows in the current page that satisfy the preset expansion condition; The line spacing of the expandable line is expanded based on the target line spacing expansion value determined in advance according to the second distance.
2. The method according to claim 1, characterized in that, The method further includes: In response to detecting that the first distance is less than the sum of the maximum preset compression values, it is determined that the first distance satisfies the first preset condition, wherein the sum of the maximum preset compression values is the sum of the maximum preset compression values of the compressible rows in the current page that satisfy the preset compression conditions.
3. The method according to claim 1, characterized in that, The step of determining the compressible lines in the current page that meet the preset compression conditions includes: The line spacing of each row in the current page is compared with a preset distance threshold; Lines with a line spacing greater than or equal to the preset distance threshold are identified as compressible lines that meet the preset compression conditions.
4. The method according to claim 1, characterized in that, The method further includes pre-determining the target line spacing compression value based on the following: The average compression value of the line spacing of the compressible lines is determined based on the ratio of the first distance to the number of compressible lines. The target line spacing compression value for the compressible line is determined based on the average line spacing compression value.
5. The method according to claim 1, characterized in that, The method further includes pre-determining the target line spacing compression value based on the following: Determine the product of the line spacing of each of the compressible lines and the first distance; Determine the ratio of the product to the sum of the line spacing of the compressible lines in the current page that meet the preset compression conditions; The target line spacing compression value for each of the compressible lines is determined based on the ratio.
6. The method according to claim 1, characterized in that, The method further includes: In response to detecting that the second distance is less than the sum of the maximum preset expansion values, it is determined that the second distance satisfies the second preset condition, wherein the sum of the maximum preset expansion values is the sum of the maximum preset expansion values of the expandable rows in the current page that satisfy the preset expansion condition.
7. The method according to claim 1, characterized in that, Determining the expandable rows in the current page that meet the preset expansion conditions includes: The line spacing of each row in the current page is compared with a preset distance threshold; Rows with a line spacing greater than or equal to the preset distance threshold are identified as expandable rows that meet the preset expansion conditions.
8. The method according to claim 1, characterized in that, The method further includes pre-determining the target line spacing expansion value based on the following: The average row spacing expansion value of the expandable rows is determined based on the ratio of the first distance to the number of expandable rows. The target line spacing expansion value of the expandable row is determined based on the average line spacing expansion value.
9. The method according to claim 1, characterized in that, The method further includes pre-determining the target line spacing expansion value based on the following: Determine the product of the row spacing of each of the expandable rows and the first distance; Determine the ratio of the product to the sum of the line spacing of the expandable rows in the current page that satisfy the preset expansion conditions; The target line spacing expansion value for each of the expandable rows is determined based on the ratio.
10. A line spacing adjustment device, characterized in that, include: The first distance acquisition module is used to acquire a first distance in response to detecting that the bottom of the last line of content in the current page exceeds the bottom of the page center; A compressible line determination module is used to determine compressible lines in the current page that satisfy preset compression conditions in response to determining that the first distance satisfies a first preset condition; A line spacing compression module is used to compress the line spacing of the compressible line based on a target line spacing compression value determined in advance according to the first distance; The line content adjustment module is used to adjust the last line of content in the current page layout to the next page in response to determining that the first distance does not meet the first set condition; The second distance acquisition module is used to acquire a second distance in response to detecting that the bottom of the adjusted current page's text area exceeds the bottom of the last line of content in the text area. An expandable row determination module is used to determine expandable rows in the current page that satisfy preset expansion conditions in response to determining that the second distance satisfies the second preset condition; A line spacing expansion module is used to expand the line spacing of the expandable line based on a target line spacing expansion value determined in advance according to the second distance.
11. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store computer programs; The processor is configured to implement the following when executing the computer program: In response to detecting that the bottom of the last line of content in the current page's layout exceeds the bottom of the layout, a first distance is obtained between the bottom of the last line of content and the bottom of the layout. In response to determining that the first distance satisfies a first preset condition, a compressible line in the current page that satisfies a preset compression condition is determined; Based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed; In response to determining that the first distance does not meet the first set condition, the last line of content in the layout of the current page is adjusted to the next page after the current page; In response to detecting that the bottom of the adjusted current page margin exceeds the bottom of the last line of content in the margin, a second distance is obtained between the bottom of the adjusted current page margin and the bottom of the last line of content in the margin. In response to determining that the second distance satisfies the second set condition, determine the expandable rows in the current page that satisfy the preset expansion condition; The line spacing of the expandable line is expanded based on the target line spacing expansion value determined in advance according to the second distance.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is implemented when it is processed by the processor: In response to detecting that the bottom of the last line of content in the current page's layout exceeds the bottom of the layout, a first distance is obtained between the bottom of the last line of content and the bottom of the layout. In response to determining that the first distance satisfies a first preset condition, a compressible line in the current page that satisfies a preset compression condition is determined; Based on the target line spacing compression value determined in advance according to the first distance, the line spacing of the compressible line is compressed; In response to determining that the first distance does not meet the first set condition, the last line of content in the layout of the current page is adjusted to the next page after the current page; In response to detecting that the bottom of the adjusted current page margin exceeds the bottom of the last line of content in the margin, a second distance is obtained between the bottom of the adjusted current page margin and the bottom of the last line of content in the margin. In response to determining that the second distance satisfies the second set condition, determine the expandable rows in the current page that satisfy the preset expansion condition; The line spacing of the expandable line is expanded based on the target line spacing expansion value determined in advance according to the second distance.
Citation Information
Patent Citations
Auto-adaptive typesetting method for word in textbox
CN101013418A