CN108153718B - Typesetting method and device for footnote-containing document - Google Patents
Typesetting method and device for footnote-containing document Download PDFInfo
- Publication number
- CN108153718B CN108153718B CN201611110733.6A CN201611110733A CN108153718B CN 108153718 B CN108153718 B CN 108153718B CN 201611110733 A CN201611110733 A CN 201611110733A CN 108153718 B CN108153718 B CN 108153718B
- Authority
- CN
- China
- Prior art keywords
- footnote
- block
- text
- identifier
- ith
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/186—Templates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/169—Annotation, e.g. comment data or footnotes
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Document Processing Apparatus (AREA)
Abstract
The embodiment of the invention relates to the technical field of typesetting, in particular to a typesetting method and a typesetting device for a document containing footnotes, which comprises the following steps: when the text block and the footnote block are overlapped after being typeset, determining the overlapping area S0 of the text block and the footnote block; determining a first area S1 to be deleted occupied by text content behind the ith-to-last footnote identifier in the text block; and if S0 is less than or equal to S1, deleting part or all of the text content behind the ith last footnote mark in the text block so as to ensure that the text block is not overlapped with the footnote block. When the overlapping area is smaller than or equal to the area behind the ith footnote mark, the text blocks and the footnote blocks need to be typeset independently at most once, and when the overlapping area is larger than the area behind the ith footnote mark, the height of the text blocks and the height of the footnote blocks are reduced by calculating, so that the text blocks and the footnote blocks are typeset independently once, a large amount of time cannot be consumed, the typesetting speed can be increased, and the typesetting efficiency can be improved.
Description
Technical Field
The embodiment of the invention relates to the technical field of typesetting, in particular to a typesetting method and a typesetting device for a document containing footnotes.
Background
The typesetting is divided into two parts: in the prior art, in the process of text typesetting, each line is arranged, whether the line has a footnote mark is judged, if yes, the typesetting of the footnote content is triggered, whether the position of the footnote block overlaps with the position of a text block at the moment is judged, if the line overlaps with the position of the footnote block, the line overlapping with the footnote block in the first column of the text block is deleted, the height of the text block is reduced, the position of the footnote block is not overlapped, the previous typesetting process is circulated, and the circulation is stopped until the typesetted text block does not overlap with the footnote block.
It can be seen that in the conventional typesetting method, since whether the line has the footnote mark or not needs to be judged every time the line is typeset, a large amount of cycles exist, which undoubtedly results in that typesetting consumes a large amount of time, thereby reducing the typesetting speed and the typesetting efficiency.
Disclosure of Invention
The embodiment of the invention provides a typesetting method and a typesetting device for a footnote-containing document, which are used for improving the typesetting speed and improving the typesetting efficiency.
The embodiment of the invention provides a typesetting method for a document with footnotes, which comprises text typesetting and footnote typesetting and comprises the following steps:
after the text content typesetting is written into the text block, searching a footnote identifier in the text block, and writing the footnote content typesetting corresponding to the footnote identifier into the footnote block;
if the text block and the footnote block are overlapped after typesetting, determining the overlapping area S0 of the text block and the footnote block;
determining the ith last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier;
and if S0 is less than or equal to S1, deleting part or all of the text content behind the ith last footnote mark in the text block so as to ensure that the text block is not overlapped with the footnote block.
Preferably, the method further comprises the following steps:
if S0 is greater than S1, determining a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier in the footnote block;
if S0 is larger than S1+ S2, determining the i = i +1 foot note identifier from the last time, and returning to the step of determining the first area to be deleted occupied by the text content behind the i-th foot note identifier until S0 is less than or equal to S1+ S2.
Preferably, the determining, in the footnote block, a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier includes:
determining the area M1 of the j-th row of the footnote content corresponding to the ith footnote identifier in the footnote block;
reducing the height of the footnotes and the reduced height of the footnotes is the same as the height of the jth row;
if S0 is larger than S1+ M1, judging whether the jth line is a positive number first line of the footnote content corresponding to the ith footnote identifier, if so, taking the area M1 of the jth line as a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier determined in the footnote block.
Preferably, the method further comprises the following steps:
if the jth line is not the positive first line of the footnote content corresponding to the ith footnote identifier, determining the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier, and determining the area of the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier in the footnote block until the jth line is the positive first line of the footnote content corresponding to the ith footnote identifier.
Preferably, the deleting part or all of the text content after the i-th footer identifier in the text block so that the text block and the footer block do not overlap includes:
and reducing the height of the text block, wherein the reduced height of the text block is the height of the overlapping area S0, so that the text block and the footnotes block are not overlapped.
The embodiment of the invention provides a typesetting device for a document containing footnotes, which comprises a text typesetting device and a footnote typesetting device, wherein the device comprises:
the search module is used for searching the footnote identification in the text block after the text content is typeset and written into the text block, and the footnote content corresponding to the footnote identification is typeset and written into the footnote block;
the overlapping module is used for determining the overlapping area S0 of the text block and the footnotes block when the text block and the footnotes block are overlapped after being typeset;
the determining module is used for determining the ith last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier;
and the typesetting module is used for deleting part or all of the text content behind the ith last footnote mark in the text block when S0 is less than or equal to S1 so as to ensure that the text block and the footnote block are not overlapped.
Preferably, the typesetting module is further configured to:
when S0> S1, determining a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier in the footnote block;
and when S0> S1+ S2, determining the i = i +1 last footer identifier, and returning to the step of determining the first area to be deleted occupied by the text content behind the i-th footer identifier until S0 is less than or equal to S1+ S2.
Preferably, the layout module is specifically configured to:
determining the area M1 of the jth row of the footnote content corresponding to the ith footnote identifier in the footnote block;
decreasing the height of the footer, the decreased height of the footer being the same as the height of the jth row;
and when S0 is larger than S1+ M1, judging whether the jth line is a positive first line of the footnote content corresponding to the ith footnote identifier, if so, taking the area M1 of the jth line as a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier determined in the footnote block.
Preferably, the typesetting module is further configured to:
if the jth line is not the positive first line of the footnote content corresponding to the ith footnote identifier, determining the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier, and determining the area of the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier in the footnote block until the jth line is the positive first line of the footnote content corresponding to the ith footnote identifier.
Preferably, the layout module is specifically configured to:
and reducing the height of the text block, wherein the reduced height of the text block is the height of the overlapping area S0, so that the text block and the footnotes block are not overlapped.
The method and the device for typesetting the document with the footnotes provided by the embodiment comprise text typesetting and footnotes typesetting, and comprise the following steps: after the text content is typeset and written into the text block, searching the footnote identification in the text block, and typesetting and writing the footnote content corresponding to the footnote identification into the footnote block; if the text block and the footnote block are overlapped after being typeset, determining the overlapping area S0 of the text block and the footnote block; determining the ith last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier; and if S0 is less than or equal to S1, deleting part or all of the text content behind the ith last footnote mark in the text block so as to ensure that the text block is not overlapped with the footnote block. It can be seen that when the text block and the footnote block are overlapped, when the overlapping area is less than or equal to the area behind the ith footnote mark in the text, the text block and the footnote block need to be typeset separately at most once, so that the typesetting effect can be achieved, and the text block and the footnote block can be ensured not to be overlapped; when the overlapping area is larger than the area behind the ith footnote mark in the text, the height of the text block and the height of the footnote block are reduced by calculating, so that the text block and the footnote block are typeset independently once, the typesetting effect can be achieved, a large amount of time can not be consumed, the typesetting speed can be increased, and the typesetting efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that are required to be used in the description of the embodiments will be briefly described below.
FIG. 1 is a schematic flow chart of a method for typesetting a document with footnotes according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for determining an area occupied by content of a part of a footnote corresponding to an ith footnote identifier according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another method for typesetting a document with footnotes according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a text block and a footnote block overlapping according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of the re-typeset text block and footnote block provided in the embodiment of the present invention;
fig. 6 is a schematic structural diagram of a typesetting apparatus for a document with footnotes according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more clearly apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 exemplarily illustrates a flow chart of a method for typesetting a document with footnotes according to an embodiment of the present invention, and as shown in fig. 1, the method includes text typesetting and footnotes typesetting.
S101, after the text content typesetting is written into the text block, the footnote identification is searched in the text block, and the footnote content typesetting corresponding to the footnote identification is written into the footnote block.
And S102, judging whether the text block and the footnote block are overlapped after typesetting, if so, turning to the step S103, otherwise, ending the process.
S103, determining the overlapping area S0 of the text block and the footnotes block.
S104, determining the ith foot note identifier from the text block, and determining a first area to be deleted S1 occupied by the content behind the ith foot note identifier.
And S105, if the S0 is less than or equal to the S1, deleting part or all of the text content behind the ith last footnote mark in the text block so that the text block and the footnote block are not overlapped.
In step S101, when the text content is typeset and written into the text block, the text content may be typeset according to the maximum capacity, and then the footer identifier is searched for in the text block, and the footer content corresponding to the footer identifier is also typeset according to the maximum capacity.
In the step S102, when it is determined whether the text block and the footnote block overlap after the composition, whether the text block and the footnote block overlap may be determined by analyzing a positional relationship between an upper edge of the footnote block and a lower edge of the text block; if the upper edge of the footnote block is equal to or lower than the lower edge of the text block, judging that the text block and the footnote block are not overlapped; and if the upper edge of the footnote block is higher than the lower edge of the text block, judging that the text block and the footnote block are overlapped.
In step S103, when determining the overlapping area S0 of the text block and the footer block, the overlapping area of the text block and the footer block may be determined first, and after the overlapping area is determined, the length and the height of the overlapping area may be obtained, so that the area of the overlapping area may be calculated, i.e., the overlapping area S0 of the text block and the footer block may be calculated.
In the step S104, when the first area to be deleted S1 occupied by the content behind the ith footer identifier is determined, if the ith footer identifier is the last-to-last footer identifier in the text block, the area occupied by the text content from the line next to the line where the ith footer identifier is located to the end of the document in the text block may be used as the first area to be deleted S1 occupied by the content behind the ith footer identifier; if the ith footer mark is not the last-but-last footer mark in the text block, the area occupied by the text content from the beginning of the line next to the line where the ith footer mark is located to the end of the line where the (i-1) th footer mark is located may be used. In the step S105, when deleting part or all of the text content following the i-th last footer identifier in the text block so that the text block and the footer block do not overlap, the height of the text block may be first reduced, and the reduced height of the text block is equal to the height of the overlap area, and then the text block may be rearranged so as to delete part or all of the text content following the i-th last footer identifier in the text block so that the text block and the footer block do not overlap.
Optionally, if S0 is greater than S1, a second area to be deleted S2 occupied by the content of the footnote corresponding to the ith footnote identifier needs to be determined in the footnote block.
Specifically, the area occupied by the whole footer content corresponding to the ith footer identifier may be determined in the footer block as the second area S2 to be deleted. The area occupied by the content of the part of the footnote corresponding to the ith footnote identifier can also be determined in the footnote block as the second area to be deleted S2.
When the area occupied by the content of the part of the footnote corresponding to the ith footnote identifier is determined as the second area to be deleted S2 in the footnote block, the method flow shown in fig. 2 may be adopted.
S201, determining the area M1 of the jth row of the footnote content corresponding to the ith footnote identifier in the footnote block.
S202, the height of the footnotes is reduced, and the height of the reduced footnotes is the same as that of the jth row.
And S203, if S0 is more than S1+ M1, judging whether the jth line is the positive first line of the footnote content corresponding to the ith footnote identifier, if so, turning to the step S204, otherwise, turning to the step S205.
And S204, taking the area of the jth row of the footnote content corresponding to the ith footnote identifier in the footnote block as a second area S2 to be deleted.
And S205, determining the j = j +1 line of the penultimate of the footnote content corresponding to the ith footnote identifier.
S206, determining the area of the line with the j = j +1 from the last to the j of the footnote content corresponding to the ith footnote identifier in the footnote block until the line with the j is the first positive number of the footnote content corresponding to the ith footnote identifier.
The flow shown in fig. 1 and 2 is described in detail by a specific flow chart.
Fig. 3 exemplarily illustrates a flowchart of a typesetting method for a document with footnotes according to an embodiment of the present invention, and as shown in fig. 3, the method includes:
s301, typesetting and writing the text content into the text block within the maximum capacity.
S302, judging whether the text block has a footnote mark, if so, turning to the step S303, otherwise, ending the process.
And S303, typesetting and writing the contents of the footnotes corresponding to all the footnote identifications into the footnote block.
S304, judging whether the footnote block and the text block are overlapped, if so, turning to the step S305, otherwise, ending the process.
S305, calculating the overlapping area C0 of the footnote block and the text block.
S306, calculating a first area C1 to be deleted behind the ith last footnote identifier in the text block.
When calculating a first area to be deleted C1 occupied by the content behind the ith foot note identifier from the last time in the text block, if the ith foot note identifier is the first foot note identifier from the last time in the text block, the area occupied by the text content from the line next to the line where the ith foot note identifier is located to the end of the document in the text block can be used as the first area to be deleted C1 occupied by the content behind the ith foot note identifier; if the ith footnote identifier is not the last-but-last footnote identifier in the text block, the area occupied by the text content from the line next to the line where the ith footnote identifier is located to the end of the line where the (i-1) th footnote identifier is located may be used.
S307, judging whether the overlapping area C0 is larger than a first area C1 to be deleted behind the ith-last footnote mark in the text block, if so, turning to the step S308, otherwise, turning to the step S312.
S308, reducing the height of the text block, wherein the reduced height is the height of the area behind the ith footnote mark, and calculating a first residual overlapping area C2, C2= C0-C1.
S309, calculating the area H1 of the jth line in the footnote content corresponding to the ith footnote identifier in the footnote block.
And S310, reducing the height of the footnote block, wherein the reduced height is the height of the jth line in the last-but-last footnote content corresponding to the ith footnote identifier, calculating a second residual overlapping area C3, wherein C3= C2-H1, and judging whether the second residual overlapping area C3 is larger than zero, if so, turning to the step S311, otherwise, turning to the step S316.
S311, determining whether the jth line is a positive first line of the ith footer identifier, if so, i = i +1, returning to step S305, otherwise, j = j +1, and returning to step S309.
And S312, reducing the height of the text block, wherein the reduced height is the height of the overlapping area C0.
And S313, typesetting the text blocks again.
And S314, judging whether the ith footnote identifier is the last footnote identifier, if so, ending the process, otherwise, turning to the step S315.
And S315, typesetting the footnotes again.
And S316, typesetting the text block and the footnote block again.
The method flow shown in fig. 3 is explained in detail below by way of a specific example.
Firstly, writing the typesetting with the maximum text content into a text block 1, searching a footnote identifier (1), a footnote identifier (2) and a footnote identifier (3) in the text block 1 after supposing that the typesetting with the maximum text content is written into the text block 1, and then, having higher requirements on monitoring and positioning of the mobile terminal for safety and investigation of the footnote content corresponding to the footnote identifier (1). With the rapid development of the mobile internet, the service transmission of the mobile terminal adopts a channel sharing mode, the footnote content corresponding to the footnote identifier (2) is measured through data to establish a compensation data table, and the steps of inserting footnotes and endnotes into the footnote content corresponding to the footnote identifier (3) according to the established compensation data table are as follows: the insertion is moved to the position where the footnote and the endnote are to be inserted. Click the footnote and endnote menu items inserted into the menu. The footnote options are selected, the footnotes can be inserted, the same typeset is written into the footnote block 2, and the structural schematic diagrams of the text block 1 and the footnote block 2 are shown in fig. 4 after the text typesetting and the footnote typesetting.
The method comprises the steps of supposing that the text content arranged in a text block 1 overlaps with the footnote contents corresponding to the footnote identifiers (1), (2) and (3) arranged in the footnote block 2, recording the overlapping area of the text content arranged in the text block 1 and the footnote contents corresponding to the footnote identifiers (1), (2) and (3) arranged in the footnote block 2 as R0, and recording the text area behind the footnote identifiers (3) in the text block 3 as R3.
Further assuming that R0 > R3, the height of the text block 1 is reduced, and the reduced height of the text block 1 is the height of the area behind the footer identifier (3) in the text block 1, i.e. the reduced height of the text block 1 is the height of the area occupied by the text content starting from the line next to the footer identifier (3) in the text block 1.
Then, the difference between the overlap area R0 and the text area R3 behind the footnote mark (3) is taken as the first remaining overlap area P1, i.e., P1= R0-R1. And calculating the area of the 1 st row from the last of the footnote content corresponding to the footnote identifier (3) in the footnote block 2, namely calculating the item of the footnote and the tail note menu inserted in the menu by clicking in the footnote content corresponding to the footnote identifier (3) in the footnote block 2. And selecting a footnote option, inserting the area of the footnote, and recording the area of the last 1 st row of the footnote content corresponding to the footnote identifier (3) in the footnote block 2 as J1.
Then, the height of the footnote block 2 is reduced, and the height of the reduced footnote block 2 is the height of the area of the footnote mark (3) corresponding to the 1 st row of the footnote content, and a second remaining overlap area P2 remaining at this time is calculated, which is the difference between the first remaining overlap area P1 and the area mark J1 of the footnote mark (3) corresponding to the 1 st row of the footnote content in the footnote block 4, that is, P2= P1-J1.
Further assuming that the second remaining overlap area P2 is still greater than zero, that is, P2 > 0, then it is determined whether the area J1 in the footnote block 2 calculated at this time is the area of the positive first line in the footnote identifier (3), because the area J1 is the area of the last 1 line of the footnote content corresponding to the footnote identifier (3) in the footnote block 2, that is, the area J1 is the area of the positive second line of the footnote content corresponding to the footnote identifier (3) in the footnote block 2, the area of the last second line of the footnote content corresponding to the footnote identifier (3) in the footnote block 2 is continuously calculated, that is, the step of "inserting footnotes and endnotes" in the footnote content corresponding to the footnote identifier (3) in the footnote block 2 is calculated as follows: the area of the position where the insertion is moved to the footnote and the endnote to be inserted is recorded, and the area of the footnote mark (3) in the footnote block 2 corresponding to the 2 nd line (the 1 st line) from the last of the footnote contents is recorded as J2.
Then, the height of the footnote block 2 is continuously reduced, and the height of the reduced footnote block 2 is the height of the area of the last but one row of the footnote content corresponding to the footnote identifier (3), and a third remaining overlap area P3 remaining at this time is calculated, where the third remaining overlap area is the difference between the second remaining overlap area P1 and the area mark J2 of the last but one row of the footnote content corresponding to the footnote identifier (3) in the footnote block 2, that is, P3= P2-J2.
Further assuming that the third remaining overlap area P3 is still greater than zero, that is, P3 is greater than 0, it is determined whether the area J2 in the footnote block 2 calculated at this time is the area of the positive first line in the footnote identifier (3), because the area J2 is the area of the positive first line in the footnote content corresponding to the footnote identifier (3) in the footnote block 2, that is, the area J2 is the area of the positive first line in the footnote content corresponding to the footnote identifier (3) in the footnote block 2, the text area behind the footnote identifier (2) in the text block 1 at this time is calculated, and the text area behind the footnote identifier (2) in the text block 1 at this time is recorded as R2.
And (3) subtracting the text area mark R2 behind the footnote mark (2) in the text block 1 from the third residual overlapping area P3 to obtain a fourth residual area P4, namely P4= R2-P3.
And further judging whether the fourth residual area P4 is larger than zero, if the fourth residual area P4 is still larger than zero, calculating the residual overlapping area in a manner of calculating the content of the footnotes corresponding to the footnote marks (3) in the footnote block 2 until the residual area is smaller than or equal to zero, namely, circulating the above manner until the residual area is smaller than or equal to zero. And if the fourth residual overlapping area P4 is less than or equal to zero, rearranging the text block and the footnote block. And when the P4 is less than or equal to 0, the structural schematic diagram after typesetting the text block and the footnote block again can be seen in fig. 5.
It should be noted that, for clarity of description, the typesetting method for the footnote-containing document according to the embodiment of the present invention is explained based on the content of the through type typesetting in the foregoing example, however, in a specific implementation, the typesetting method for the footnote-containing document according to the embodiment of the present invention is not only applicable to the through type typesetting, but also applicable to the non-through type typesetting, that is, the content of the through type typesetting in the foregoing example is not limited in any way in the foregoing example.
According to the above contents, when the text block and the footnote block are overlapped, and when the overlapping area is smaller than or equal to the area behind the ith footnote mark in the text, the text block and the footnote block need to be typeset separately at most once, so that the typesetting effect can be achieved, and the text block and the footnote block can be ensured not to be overlapped; when the overlapping area is larger than the area behind the ith footnote mark in the text, the height of the text block and the height of the footnote block are reduced by calculating, so that the text block and the footnote block are typeset independently once, the typesetting effect can be achieved, a large amount of time can not be consumed, the typesetting speed can be increased, and the typesetting efficiency can be improved.
Based on the same technical concept, an embodiment of the present invention further provides a typesetting apparatus for a document with footnotes, including text typesetting and footnote typesetting, as shown in fig. 6, the apparatus may include:
the searching module 601 is configured to search a footnote identifier in a text block after the text content is typeset and written into the text block, and write the footnote content corresponding to the footnote identifier into the footnote block;
an overlapping module 602, configured to determine an overlapping area S0 of the text block and the footnote block when the text block and the footnote block are overlapped after being typeset;
a determining module 603, configured to determine an i-th last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier;
and the typesetting module 604 is configured to delete part or all of the text content behind the ith-last footnote identifier in the text block when S0 is less than or equal to S1, so that the text block and the footnote block do not overlap.
Preferably, the typesetting module 604 is further configured to:
when S0> S1, determining a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier in the footnote block;
and when S0> S1+ S2, determining the i = i +1 last footer identifier, and returning to the step of determining the first area to be deleted occupied by the text content behind the i-th footer identifier until S0 is less than or equal to S1+ S2.
Preferably, the layout module 604 is specifically configured to:
determining the area M1 of the j-th row of the footnote content corresponding to the ith footnote identifier in the footnote block;
reducing the height of the footnotes and the reduced height of the footnotes is the same as the height of the jth row;
and when S0 is larger than S1+ M1, judging whether the jth line is a positive first line of the footnote content corresponding to the ith footnote identifier, if so, taking the area M1 of the jth line as a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier determined in the footnote block.
Preferably, the typesetting module 604 is further configured to:
if the jth line is not the positive first line of the footnote content corresponding to the ith footnote identifier, determining the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier, and determining the area of the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier in the footnote block until the jth line is the positive first line of the footnote content corresponding to the ith footnote identifier.
Preferably, the layout module 604 is specifically configured to:
and reducing the height of the text block, wherein the reduced height of the text block is the height of the overlapping area S0, so that the text block and the footnotes block are not overlapped.
The method and the device for typesetting the document with the footnotes provided by the embodiment comprise text typesetting and footnotes typesetting, and comprise the following steps: after the text content is typeset and written into the text block, searching the footnote identification in the text block, and typesetting and writing the footnote content corresponding to the footnote identification into the footnote block; if the text block and the footnote block are overlapped after being typeset, determining the overlapping area S0 of the text block and the footnote block; determining the ith last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier; and if S0 is less than or equal to S1, deleting part or all of the text content behind the ith last footnote mark in the text block so as to ensure that the text block is not overlapped with the footnote block. It can be seen that when the text block and the footnote block are overlapped, when the overlapping area is less than or equal to the area behind the ith footnote mark in the text, the text block and the footnote block need to be typeset separately at most once, so that the typesetting effect can be achieved, and the text block and the footnote block can be ensured not to be overlapped; when the overlapping area is larger than the area behind the ith footnote mark in the text, the height of the text block and the height of the footnote block are reduced through calculation, so that the effect of typesetting can be achieved by typesetting the text block and the footnote block once independently, a large amount of time cannot be consumed, the typesetting speed can be increased, and the typesetting efficiency can be improved.
It should be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (10)
1. A typesetting method of a document containing footnotes comprises text typesetting and footnotes typesetting, and is characterized by comprising the following steps:
after the text content typesetting is written into the text block, searching a footnote identifier in the text block, and writing the footnote content typesetting corresponding to the footnote identifier into the footnote block;
if the text block and the footnote block are overlapped after typesetting, determining the overlapping area S0 of the text block and the footnote block;
determining the ith last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier;
and if S0 is less than or equal to S1, deleting part or all of the text content behind the ith last footnote mark in the text block so as to ensure that the text block is not overlapped with the footnote block.
2. The method of claim 1, further comprising:
if S0 is greater than S1, determining a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier in the footnote block;
if S0> S1+ S2, determining the i = i +1 last footer identifier, and returning to the step of determining the first area to be deleted occupied by the text content behind the i-th footer identifier until S0 is less than or equal to S1+ S2.
3. The method according to claim 2, wherein the determining, in the footnote block, a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier includes:
determining the area M1 of the j-th row of the footnote content corresponding to the ith footnote identifier in the footnote block;
reducing the height of the footnotes and the reduced height of the footnotes is the same as the height of the jth row;
if S0 is larger than S1+ M1, judging whether the jth line is a positive number first line of the footnote content corresponding to the ith footnote identifier, if so, taking the area M1 of the jth line as a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier determined in the footnote block.
4. The method of claim 3, further comprising:
if the jth line is not the positive first line of the footnote content corresponding to the ith footnote identifier, determining the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier, and determining the area of the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier in the footnote block until the jth line is the positive first line of the footnote content corresponding to the ith footnote identifier.
5. The method of claim 1, wherein said deleting some or all of the text content following the ith-last footer identification in the text block so that the text block does not overlap the footer block comprises:
and reducing the height of the text block, wherein the reduced height of the text block is the height of the overlapping area S0, so that the text block and the footnotes block are not overlapped.
6. A typesetting device for a document containing footnotes, which comprises a text typesetting device and a footnote typesetting device, and is characterized in that the device comprises:
the search module is used for searching the footnote identification in the text block after the text content typeset is written into the text block, and writing the footnote content typeset corresponding to the footnote identification into the footnote block;
the overlapping module is used for determining the overlapping area S0 of the text block and the footnotes block when the text block and the footnotes block are overlapped after being typeset;
the determining module is used for determining the ith-to-last footnote identifier in the text block; determining a first area S1 to be deleted occupied by the text content behind the ith footnote identifier;
and the typesetting module is used for deleting part or all of the text content behind the ith last footnote mark in the text block when the S0 is less than or equal to the S1 so as to ensure that the text block and the footnote block are not overlapped.
7. The apparatus of claim 6, wherein the composition module is further configured to:
when S0> S1, determining a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier in the footnote block;
and when S0> S1+ S2, determining the i = i +1 last footer identifier, and returning to the step of determining the first area to be deleted occupied by the text content behind the i-th footer identifier until S0 is less than or equal to S1+ S2.
8. The apparatus of claim 7, wherein the composition module is specifically configured to:
determining the area M1 of the j-th row of the footnote content corresponding to the ith footnote identifier in the footnote block;
decreasing the height of the footer, the decreased height of the footer being the same as the height of the jth row;
and when S0 is larger than S1+ M1, judging whether the jth line is a positive first line of the footnote content corresponding to the ith footnote identifier, if so, taking the area M1 of the jth line as a second area to be deleted S2 occupied by the footnote content corresponding to the ith footnote identifier determined in the footnote block.
9. The apparatus of claim 8, wherein the composition module is further configured to:
if the jth line is not the positive first line of the footnote content corresponding to the ith footnote identifier, determining the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier, and determining the area of the jth line = j +1 of the reciprocal of the footnote content corresponding to the ith footnote identifier in the footnote block until the jth line is the positive first line of the footnote content corresponding to the ith footnote identifier.
10. The apparatus of claim 6, wherein the composition module is specifically configured to:
and reducing the height of the text block, wherein the reduced height of the text block is the height of the overlapping area S0, so that the text block and the footnotes block are not overlapped.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611110733.6A CN108153718B (en) | 2016-12-06 | 2016-12-06 | Typesetting method and device for footnote-containing document |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611110733.6A CN108153718B (en) | 2016-12-06 | 2016-12-06 | Typesetting method and device for footnote-containing document |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108153718A CN108153718A (en) | 2018-06-12 |
CN108153718B true CN108153718B (en) | 2022-11-15 |
Family
ID=62468318
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611110733.6A Active CN108153718B (en) | 2016-12-06 | 2016-12-06 | Typesetting method and device for footnote-containing document |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108153718B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0094517A2 (en) * | 1982-05-17 | 1983-11-23 | International Business Machines Corporation | Footnote assembly management |
JP2007095102A (en) * | 2006-12-25 | 2007-04-12 | Toshiba Corp | Document processor and document processing method |
CN103186518A (en) * | 2011-12-31 | 2013-07-03 | 北大方正集团有限公司 | Method and system for typesetting of footmark contained documents |
CN104572605A (en) * | 2013-10-16 | 2015-04-29 | 北大方正集团有限公司 | Footnote typesetting implementation method and device |
-
2016
- 2016-12-06 CN CN201611110733.6A patent/CN108153718B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0094517A2 (en) * | 1982-05-17 | 1983-11-23 | International Business Machines Corporation | Footnote assembly management |
JP2007095102A (en) * | 2006-12-25 | 2007-04-12 | Toshiba Corp | Document processor and document processing method |
CN103186518A (en) * | 2011-12-31 | 2013-07-03 | 北大方正集团有限公司 | Method and system for typesetting of footmark contained documents |
CN104572605A (en) * | 2013-10-16 | 2015-04-29 | 北大方正集团有限公司 | Footnote typesetting implementation method and device |
Also Published As
Publication number | Publication date |
---|---|
CN108153718A (en) | 2018-06-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR20170063645A (en) | Intent based feedback | |
CN106610931B (en) | Topic name extraction method and device | |
US20130262090A1 (en) | System and method for reducing semantic ambiguity | |
CN102200968A (en) | Method and device for removing duplications of EXCEL form data | |
CN103914483A (en) | File storage method and device and file reading method and device | |
CN108664471A (en) | Text region error correction method, device, equipment and computer readable storage medium | |
CN102135943B (en) | Storing and accessing method of flash memory data and device thereof | |
CN111309215A (en) | Processing method, device, equipment and storage medium of sliding list in Unity | |
US9658988B2 (en) | Systems and methods to segment text for layout and rendering | |
CN102959548A (en) | Data storage method, search method and device | |
CN105069175A (en) | Information retrieval method and server based on version control system | |
CN116662327B (en) | Data fusion cleaning method for database | |
CN108153718B (en) | Typesetting method and device for footnote-containing document | |
CN106649210A (en) | Data conversion method and device | |
WO2018208412A1 (en) | Detection of caption elements in documents | |
CN112698866A (en) | Code line life cycle tracing method based on Git and electronic device | |
CN106095411A (en) | Display packing and terminal | |
CN105653549A (en) | Method and device for extracting document information | |
CN107169313A (en) | The read method and computer-readable recording medium of DNA data files | |
CN110955813A (en) | Data crawling method and device | |
CN116954704A (en) | Code branch merging method, device, computer equipment and storage medium | |
CN109426702A (en) | IOS platform file reads guard method, storage medium, electronic equipment and system | |
CN103116597A (en) | Image-based information access device and method | |
US11429560B2 (en) | Systems and methods for detection of automatable sheet modification actions | |
CN107239395B (en) | Method and equipment for searching invalid function in source code |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |