Document text display method and device, electronic equipment and storage medium

By determining the text type of the target text in the document and selecting the appropriate text line for display, the problem of character typesetting in the prior art affects the reading experience, and the effect of improving user reading speed and comprehension is achieved.

CN119167884APending Publication Date: 2024-12-20ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310731207.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-19
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

The prior art may affect the user's reading experience in character typesetting, resulting in a low reading speed and the inability to accurately understand the meaning of the text.

Method used

By obtaining the text line sequence in the target document, determining the text type of the target text, and determining the single text line for display from the text line sequence based on that type, ensuring that the target text is displayed in the appropriate text line, thereby improving reading continuity Sex and speed.

Benefits of technology

The target text can be displayed in a single text line without user editing, ensuring that the user understands the meaning of the text, improves reading speed, and reduces reading blockages caused by the distribution of the target text on different lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167884A_ABST
    Figure CN119167884A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a document text display method and device, electronic equipment and a storage medium, and the method comprises the steps that a target document is acquired, the target document comprises a text line sequence, and the target document comprises a target text; determining a text type of the target text; based on the text type, determining a single text line used for displaying the target text from the text line sequence; and displaying the target text in the single text line. Therefore, the single text line used for displaying the target text is determined according to the text type of the target text, and then the target text is displayed in the determined single text line, so that the target text can be displayed in the single text line without editing of a user for the target texts of different text types, and the user experience is improved. Therefore, the reading continuity of the user on the target text is ensured, the user can conveniently understand the meaning of the target text, and the reading speed of the user is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for displaying document text. Background Art

[0002] In the prior art, the layout position of characters in a document usually depends on document data determined by the user, such as the character font, font size, character spacing, and the number of characters in a text line.

[0003] However, using the above-mentioned prior art solutions for character typesetting may affect the user's reading experience in some cases, causing the user to take a long time to understand the meaning of the text, or misleading the user to be unable to understand the meaning of the text, thereby causing the user to have a lower reading speed.

[0004] It can be seen that how to improve users' reading speed is a technical issue worthy of attention. Summary of the invention

[0005] In view of this, in order to solve some or all of the above-mentioned technical problems, the embodiments of the present application provide a method, device, electronic device and storage medium for displaying document text.

[0006] In a first aspect, an embodiment of the present application provides a method for displaying document text, the method comprising:

[0007] Acquire a target document, wherein the target document includes a sequence of text lines, and the target document includes a target text, and the target text includes at least one character;

[0008] Determining the text type of the target text;

[0009] Based on the text type, determining a single text line from the text line sequence for displaying the target text;

[0010] The target text is displayed in the single text line.

[0011] In a possible implementation, determining a single text line for displaying the target text from the text line sequence based on the text type includes:

[0012] Determine, from the text line sequence, the text line where the first character of the target text is located, to obtain a first text line;

[0013] Based on the text type, determining an adjacent text line of the first text line from the text line sequence to obtain a second text line;

[0014] A single text line for displaying the target text is determined from the first text line and the second text line.

[0015] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line includes:

[0016] Determining whether the first text line includes a preceding text of the target text, wherein the preceding text is text located before the target text in the first text line;

[0017] Based on whether the first text line includes the preceding text, a single text line for displaying the target text is determined from the first text line and the second text line.

[0018] In a possible implementation, the determining, based on the text type, from the text line sequence, an adjacent text line of the first text line to obtain a second text line includes:

[0019] In the case where the text type is the first type, determining a previous text line of the first text line from the text line sequence to obtain a second text line;

[0020] The first type indicates that the number of characters included in the target text is less than or equal to a preset number, and the first text line does not include subsequent text of the target text, and the subsequent text is text located after the target text in the first text line.

[0021] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text includes:

[0022] In a case where the first text line includes the preceding text, determining the first text line as a single text line for displaying the target text; or

[0023] In a case where the first text line does not include the preceding text, the second text line is determined as a single text line for displaying the target text.

[0024] In a possible implementation manner, when the first text line does not include the preceding text, before the single text line displays the target text, the method further includes:

[0025] determining a first set of characters for display in the second text line;

[0026] Determine a union of each character included in the target text and the first character set as a second character set; and

[0027] Displaying the target text in the single text line includes:

[0028] The second set of characters is displayed on the single text line.

[0029] In a possible implementation, the determining, based on the text type, from the text line sequence, an adjacent text line of the first text line to obtain a second text line includes:

[0030] In the case where the text type is the second type, determining the next text line of the first text line from the text line sequence to obtain a second text line;

[0031] The second type indicates that the target text is a text in a preset text set.

[0032] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text includes:

[0033] In a case where the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text; or

[0034] In a case where the first text line does not include the preceding text, the first text line is determined as a single text line for displaying the target text.

[0035] In a possible implementation, when the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text includes:

[0036] Determine a first character spacing between two adjacent characters in a first character sequence;

[0037] Determining whether the first character spacing belongs to a preset spacing interval;

[0038] In a case where the first character spacing belongs to the preset spacing interval, determining the first text line as a single text line for displaying the target text;

[0039] When the first character spacing does not belong to the preset spacing interval, the second text line is determined as a single text line for displaying the target text.

[0040] In a possible implementation, when the text type is the second type, the method further includes:

[0041] Determining a previous text line of the single text line from the text line sequence;

[0042] Determine a second character sequence for display on the previous text line, wherein the last character in the second character sequence is the character preceding the first character in the target document;

[0043] Determine a second character spacing between two adjacent characters in the second character sequence;

[0044] The second character spacing is written to a disk for storing, so as to display the second character sequence on the previous text line according to the determined second character spacing.

[0045] In a possible implementation manner, after writing the second word spacing to the disk, the method further includes:

[0046] A preset document tag is added to the document data of the target document.

[0047] In a possible implementation manner, after writing the second word spacing to the disk, the method further includes:

[0048] When the target document is in a non-official document mode, obtaining typesetting data of the target document, wherein the typesetting data includes the second character spacing stored in a disk;

[0049] The target document is typeset based on the typeset data to display the typeset target document.

[0050] In a possible implementation, when the target document is in an official document mode, the document text display method is executed.

[0051] In a second aspect, an embodiment of the present application provides a device for displaying document text, the device comprising:

[0052] A first acquisition unit is used to acquire a target document, wherein the target document includes a text line sequence, and the target document includes a target text, and the target text includes at least one character;

[0053] A first determining unit, used to determine the text type of the target text;

[0054] A second determination unit, configured to determine, based on the text type, a single text line from the text line sequence for displaying the target text;

[0055] The first display unit is configured to display the target text in the single text line.

[0056] In a possible implementation, determining a single text line for displaying the target text from the text line sequence based on the text type includes:

[0057] Determine, from the text line sequence, the text line where the first character of the target text is located, to obtain a first text line;

[0058] Based on the text type, determining an adjacent text line of the first text line from the text line sequence to obtain a second text line;

[0059] A single text line for displaying the target text is determined from the first text line and the second text line.

[0060] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line includes:

[0061] Determining whether the first text line includes a preceding text of the target text, wherein the preceding text is text located before the target text in the first text line;

[0062] Based on whether the first text line includes the preceding text, a single text line for displaying the target text is determined from the first text line and the second text line.

[0063] In a possible implementation, the determining, based on the text type, from the text line sequence, an adjacent text line of the first text line to obtain a second text line includes:

[0064] In the case where the text type is the first type, determining a previous text line of the first text line from the text line sequence to obtain a second text line;

[0065] The first type indicates that the number of characters included in the target text is less than or equal to a preset number, and the first text line does not include subsequent text of the target text, and the subsequent text is text located after the target text in the first text line.

[0066] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text includes:

[0067] In a case where the first text line includes the preceding text, determining the first text line as a single text line for displaying the target text; or

[0068] In a case where the first text line does not include the preceding text, the second text line is determined as a single text line for displaying the target text.

[0069] In a possible implementation manner, when the first text line does not include the preceding text, before the single text line displays the target text, the device further includes:

[0070] A third determining unit, configured to determine a first character set to be displayed on the second text line;

[0071] a fourth determining unit, configured to determine a union of each character included in the target text and the first character set as a second character set; and

[0072] Displaying the target text in the single text line includes:

[0073] The second set of characters is displayed on the single text line.

[0074] In a possible implementation, the determining, based on the text type, from the text line sequence, an adjacent text line of the first text line to obtain a second text line includes:

[0075] In the case where the text type is the second type, determining the next text line of the first text line from the text line sequence to obtain a second text line;

[0076] The second type indicates that the target text is a text in a preset text set.

[0077] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text includes:

[0078] In a case where the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text; or

[0079] In a case where the first text line does not include the preceding text, the first text line is determined as a single text line for displaying the target text.

[0080] In a possible implementation, when the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text includes:

[0081] Determine a first character spacing between two adjacent characters in a first character sequence;

[0082] Determining whether the first character spacing belongs to a preset spacing interval;

[0083] In a case where the first character spacing belongs to the preset spacing interval, determining the first text line as a single text line for displaying the target text;

[0084] When the first character spacing does not belong to the preset spacing interval, the second text line is determined as a single text line for displaying the target text.

[0085] In a possible implementation manner, when the text type is the second type, the device further includes:

[0086] a fifth determining unit, configured to determine a previous text line of the single text line from the text line sequence;

[0087] A sixth determining unit, configured to determine a second character sequence for display in the previous text line, wherein the last character in the second character sequence is a character preceding the first character in the target document;

[0088] a seventh determining unit, configured to determine a second character spacing between two adjacent characters in the second character sequence;

[0089] The storage unit is used for writing the second character spacing to a disk to store the second character spacing, so as to display the second character sequence in the previous text line according to the determined second character spacing.

[0090] In a possible implementation manner, after the writing disk stores the second word spacing, the device further includes:

[0091] The adding unit is used to add a preset document tag to the document data of the target document.

[0092] In a possible implementation manner, after the writing disk stores the second word spacing, the device further includes:

[0093] A second acquisition unit, configured to acquire layout data of the target document when the target document is in a non-official document mode, wherein the layout data includes the second word spacing stored in a disk;

[0094] The second display unit is used to typeset the target document based on the typeset data to display the typeset target document.

[0095] In a possible implementation manner, when the target document is in an official document mode, a device for displaying the document text is operated.

[0096] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0097] Memory for storing computer programs;

[0098] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the method for displaying document text in the first aspect of the present application is implemented.

[0099] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method of any embodiment of the method for displaying document text of the first aspect described above is implemented.

[0100] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer-readable code. When the computer-readable code is executed on a device, the processor in the device implements a method as in any embodiment of the method for displaying document text in the first aspect described above.

[0101] The document text display method provided by the embodiment of the present application can obtain a target document, wherein the target document includes a text line sequence, and the target document includes a target text, and the target text includes at least one character, and then the text type of the target text is determined, and then, based on the text type, a single text line for displaying the target text is determined from the text line sequence, and then the target text is displayed in the single text line. Thus, the single text line for displaying the target text is determined by the text type of the target text, and then the target text is displayed in the determined single text line. In this way, for target texts of different text types, the target text can be displayed in a single text line without user editing, thereby ensuring the continuity of the user's reading of the target text, facilitating the user's understanding of the meaning of the target text, and improving the user's reading speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0102] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0103] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0104] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0105] Figure 1 A flowchart of a method for displaying document text provided in an embodiment of the present application;

[0106] Figure 2 A schematic diagram of a flow chart of another method for displaying document text provided in an embodiment of the present application;

[0107] Figure 3 A flowchart of another method for displaying document text provided in an embodiment of the present application;

[0108] Figure 4 A schematic diagram of the structure of a document text display device provided in an embodiment of the present application;

[0109] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0110] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values ​​described in these embodiments do not limit the scope of the present application.

[0111] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.

[0112] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.

[0113] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0114] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0115] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0116] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.

[0117] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, methods, and equipment should be considered as part of the specification.

[0118] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0119] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0120] In order to solve the technical problem of how to improve the reading speed of users in the prior art, the present application provides a method for displaying document text, which can improve the reading speed of users.

[0121] Figure 1 A flow chart of a method for displaying document text provided for an embodiment of the present application. The method can be applied to one or more electronic devices such as smart phones, laptops, desktop computers, portable computers, servers, etc. In addition, the execution subject of the method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute the method, or a plurality of electronic devices can cooperate with each other to execute the method. When the above-mentioned execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.

[0122] like Figure 1 As shown, the method specifically includes:

[0123] Step 101: Acquire a target document, wherein the target document includes a sequence of text lines, and the target document includes a target text, and the target text includes at least one character.

[0124] In this embodiment, the target document may be any document. As an example, the target document may include but is not limited to documents in the following formats: doc format, docx format, ppt format, pptx format, rtf (Rich Text Format) and html (Hyper Text Markup Language) format, etc. In addition, the target document may also be an offline document stored locally, or an online document stored in the cloud.

[0125] The text line sequence may include one or more text lines. The text content included in each text line constitutes the document content of the target document.

[0126] Here, the coordinate information of the text lines in the text line sequence can be determined during the typesetting process of the target document. Normally, the division information of the text lines in the above text line sequence (that is, the text content contained in the text line) is not included in the document data of the target document. In other words, the document data itself may not include the division information of the text lines. Generally, the document data contains the division of paragraphs. For example, if there is a carriage return after the text in the document data, a new line will be started when the document data is typeset. The text line sequence needs to be determined during the typesetting process.

[0127] In a specific embodiment, a target document is acquired; document data of the target document is read, wherein the document data includes content data and layout data; and the content data is layouted according to the layout data.

[0128] The content data at least includes: document objects such as text, charts, and pictures. The layout data is data indicating the format of the content data, such as the font, font size, color, underline, strikethrough, alignment, line spacing, character spacing, etc. of the text; another example is the automatic adjustment method, alignment, area size, layout, color lines, etc. of the chart; another example is the alignment, area size, layout, color lines, etc. of the picture.

[0129] There are two mainstream types of typesetting: flow documents and layout documents. For example, documents in doc, doxc, html and other formats are all flow documents; documents in pdf, odf and other formats are all layout documents.

[0130] Streaming typesetting refers to the specific typesetting of the text, numbers, tables, and graphic images contained in the document. The saved content is the original editing element. Users can view the edited typesetting style through reading software, and the layout size can be adaptively displayed at different zoom ratios. In other words, streaming typesetting is dynamic typesetting, which will be adaptively adjusted according to different zoom ratios. When browsing streaming files, the layout is calculated and drawn in a streaming typesetting manner.

[0131] Layout documents are files that are not editable, that is, files with fixed layouts. Layout documents will not "run out of layout", and the display and printing effects on any device are highly accurate and consistent. The content, position, style, etc. of the text elements in the file are fixed when the file is generated, and it is difficult for others to modify and edit them. They can only add some comments, signatures, and other information on them, and they can maintain a high degree of consistency in different software, operating systems, and other environments.

[0132] The document text display method provided in this embodiment is applicable to documents with different typeset modes such as streaming documents and layout documents, and is applicable to the document editing process and the document browsing process.

[0133] For streaming documents, during editing or browsing, the text line sequence can be determined in the process of real-time typesetting. In the process of typesetting the content data according to the typesetting data, it includes: performing layout calculation and drawing in a streaming typesetting manner, wherein the layout calculation includes: when the content data is text, determining the format of the text according to the typesetting data, and calculating the space occupied by the text corresponding to the format, and dividing the text in the target document into different text line sequences according to the space; specifically, when the remaining space of the current text line is less than the space occupied by the current character, typeset the current character to the next text line; when encountering a line break, complete the typesetting of the current text line and start the typesetting of the next text line. Drawing includes: reading the text line in the text line sequence; drawing the text in the text line according to the typesetting data.

[0134] For a layout document, the text line sequence may be determined in the process of generating and editing the target document. In the process of editing the target document, if the content data is text, the format of the text is determined according to the typesetting data, and the space occupied by the text corresponding to the format is calculated, and the text in the target document is divided into different text line sequences according to the space; the text line sequence is written into the document data of the target document to fix the typesetting of the content data in the target document.

[0135] The characters contained in the target text may be distributed in one, two or more text lines in the text line sequence.

[0136] The target text may be text including at least one character in the target document.

[0137] As an example, the target text may be any one or more consecutive characters in the target document. For example, if the target text includes the following content "X document is an online document that can be edited by multiple people in real time", then the target text may be "file", "document", or "online document".

[0138] As another example, the target text may also be the last word at the end of a paragraph determined through semantic recognition.

[0139] As another example, the target text may also be text in a preset text set.

[0140] The text in the preset text set may include at least one character.

[0141] In addition, in some cases, the target text may not contain punctuation marks.

[0142] Step 102: determine the text type of the target text.

[0143] In this embodiment, the text type of the target text may be determined according to actual needs.

[0144] As a first example, the text type of the target text may be determined according to the number of characters included in the target text.

[0145] As a second example, the text type of the target text may also be determined according to the number of text lines in which the characters in the target text are distributed.

[0146] As a third example, the text type of the target text may also be determined based on whether the target text is text in a predetermined text set.

[0147] Step 103: Determine a single text line for displaying the target text from the text line sequence based on the text type.

[0148] In this embodiment, the determined single text line can be used to display the target text, that is, the target text is typeset into the single text line.

[0149] As a first example, if the first example is used to determine the text type of the target text, then the step 103 may be performed in the manner described below, which will not be described in detail here.

[0150] As a second example, if the second example is used to determine the text type of the target text, the step 103 may be performed in the following manner:

[0151] If the characters in the target text are distributed in one text line, then the current text line in the text line sequence for displaying the target text may be determined as a single text line for displaying the target text.

[0152] If the characters in the target text are distributed in two or more text lines, then the text line following the current text line for displaying the target text in the text line sequence (ie, the next text line) can be determined as a single text line for displaying the target text.

[0153] As a third example, if the third example is used to determine the text type of the target text, then the step 103 may be performed in the manner described below, which will not be described in detail here.

[0154] Step 104: display the target text in the single text line.

[0155] In this embodiment, after determining a single text line for displaying the target text, the target text can be displayed in the single text line. For example, the word spacing between two adjacent characters in each character included in the target text can be calculated first, and then the determined word spacing can be stored in the disk as document data, so that when the document is subsequently opened, the document can be typeset according to the word spacing stored in the disk to ensure that the same word spacing is maintained between each character in the target text when the document is subsequently opened. Among them, the word spacing between two adjacent characters in each character included in the target text can be equal or unequal.

[0156] Here, the process of typesetting characters in the target document may include the following two stages:

[0157] In the first stage, the sequence of text lines is determined.

[0158] In this stage, the text lines constituting the target document can be preliminarily determined according to the typesetting data specified in the document data. This first stage can also be understood as a preliminary typesetting stage.

[0159] In the second stage, a single text line for displaying the target text is determined, and the characters to be displayed in the text line initially determined are updated.

[0160] In this stage, if the line number of the single text line determined in step 103 is the same as the line number of the text line where the target text is located; and the characters in the target text are distributed in only one text line, then there is no need to update the text line determined in the preliminary typesetting stage, or it can be considered that the characters in the updated text line are the same as the characters in the text line before the update. This second stage can also be understood as a reformatting stage. The content of the target document displayed in step 104 is the content determined after the reformatting in this second stage.

[0161] If the line number of the single text line determined in step 103 is different from the line number of the text line where the target text is located; or, the characters in the target text are distributed in two or more text lines, then all the characters contained in the target text can be displayed in the determined single text line to update the characters contained in the text line.

[0162] In addition, when the target text is displayed in the determined single text line, the single text line may include other characters outside the target text; or, it may not include other characters outside the target text, that is, the single text line may only include the characters in the target text.

[0163] Here, in the first stage as compared to the second stage, the relative order of the characters in the target document does not change, and only the characters to be displayed in the text line are re-determined, for example, the characters in the target text.

[0164] In some optional implementations of this embodiment, the document text display method is executed when the target document is in a preset mode. Exemplarily, the preset mode is an official document mode, in which typesetting rules corresponding to target texts of different text types are preset.

[0165] Here, "the target document is in the official document mode" can be used as a prerequisite for executing the above steps 101-104. However, it should be noted that the following describes a further refinement of the embodiment constituted by the above steps 101-104, so "the target document is in the official document mode" can also be used as a prerequisite for executing the subsequent corresponding steps.

[0166] The document text display method provided by the embodiment of the present application can obtain a target document, wherein the target document includes a text line sequence, and the target document includes a target text, and the target text includes at least one character, and then the text type of the target text is determined, and then, based on the text type, a single text line for displaying the target text is determined from the text line sequence, and then the target text is displayed in the single text line. Thus, the single text line for displaying the target text is determined by the text type of the target text, and then the target text is displayed in the determined single text line. In this way, for target texts of different text types, the target text can be displayed in a single text line without user editing, thereby ensuring the continuity of the user's reading of the target text, facilitating the user's understanding of the meaning of the target text, and improving the user's reading speed.

[0167] Figure 2 A flowchart of another method for displaying document text provided in an embodiment of the present application is shown below. Figure 2 As shown, the method specifically includes:

[0168] Step 201: Acquire a target document, wherein the target document includes a sequence of text lines, and the target document includes a target text, and the target text includes at least one character.

[0169] In this embodiment, step 201 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.

[0170] Step 202: determine the text type of the target text.

[0171] In this embodiment, step 202 and Figure 1 Step 102 in the corresponding embodiment is basically the same and will not be described again here.

[0172] Step 203: determine the text line where the first character of the target text is located from the text line sequence to obtain a first text line.

[0173] In this embodiment, the first text line may be a text line in the text line sequence where the first character of the target text is located.

[0174] The first character may be the first character of the target text. For example, if the target text is "ABCD", the first character of the target text may be "A".

[0175] In addition, the text line sequence in step 203 may be a sequence of text lines determined through the preliminary typesetting described in the first stage above.

[0176] Step 204: Based on the text type, determine the adjacent text line of the first text line from the text line sequence to obtain a second text line.

[0177] In this embodiment, the second text line may be a text line adjacent to the first text line in the text line sequence. For example, the second text line may be the previous text line of the first text line in the text line sequence (in this case, the first text line is not the first text line in the text line sequence), or the second text line may be the next text line of the first text line in the text line sequence.

[0178] Here, after displaying the text lines in the text line sequence, it is allowed that there are text lines that do not contain any text (it can also be understood as displaying only empty characters). Therefore, the second text line determined here may not contain characters if it is not determined as a single text line for displaying the target text. For example, the text line sequence may include a first text line and a second text line. Among them, the first text line may include the characters "X document is an online document that can be edited by multiple people in real time and collaboratively.", and the target document may only include the following characters "X document is an online document that can be edited by multiple people in real time and collaboratively." In this case, if the second text line is the next text line of the first text line, then the second text line can be displayed as empty characters.

[0179] As a first example, if the first example is used to determine the text type of the target text, the above step 204 may be performed in the following manner:

[0180] If the number of characters included in the target text is less than the first threshold, then the first text line may be determined as a single text line for displaying the target text.

[0181] If the number of characters included in the target text is greater than or equal to the first threshold, then the text line following the first text line may be determined as a single text line for displaying the target text.

[0182] In a specific embodiment, the first threshold may be set to 1, which can ensure that single words do not form lines and meet the requirements of official document standards.

[0183] As a second example, if the characters in the target text are distributed in one text line, then the current text line in the text line sequence for displaying the target text may be determined as the second text line.

[0184] If the characters in the target text are distributed in two or more text lines, then the text line following the current text line used to display the target text in the text line sequence may be determined as the second text line.

[0185] As a third example, if the second example is used to determine the text type of the target text, then the step 204 may be performed in accordance with the method described below, which will not be described in detail here.

[0186] Step 205: Determine a single text line for displaying the target text from the first text line and the second text line.

[0187] In this embodiment, the first text line may be determined as a single text line for displaying the target text. Alternatively, the second text line may be determined as a single text line for displaying the target text.

[0188] As an example, a text line may be randomly selected from the first text line and the second text line and determined as a single text line for displaying the target text.

[0189] As another example, a single text line for displaying the target text may be determined from the first text line and the second text line according to a certain strategy. Please refer to the following description for details.

[0190] In some optional implementations of this embodiment, the above step 205 may be performed in the following manner to determine a single text line for displaying the target text from the first text line and the second text line:

[0191] First, it is determined whether the first text line includes the preceding text of the target text.

[0192] The predecessor text is the text before the target text in the first text line. For example, if the first text line includes the text "ABCDE" and the target text is "B", then it can be determined that the first text line includes the predecessor text of the target text. And, in this case, the predecessor text is "A". If the first text line includes the text "ABCDE" and the target text is "A", then it can be determined that the first text line does not include the predecessor text of the target text.

[0193] Afterwards, based on whether the first text line includes the preceding text, a single text line for displaying the target text is determined from the first text line and the second text line.

[0194] As an example, in the case where the first text line includes the preceding text, the first text line or the second text line can be determined as a single text line for displaying the target text. In the case where the first text line does not include the preceding text, the first text line or the second text line can be determined as a single text line for displaying the target text.

[0195] In addition, other methods may be used to determine a single text line for displaying the target text. Please refer to the following description for details, which will not be described here.

[0196] It can be understood that in the above-mentioned optional implementation method, a single text line for displaying the target text can be determined from the first text line and the second text line based on whether the first text line includes the predecessor text. In this way, all characters of the target text can be displayed in the same text line, avoiding reading blockage caused by the target text being distributed in different text lines, and further ensuring the continuity of the user's reading of the target text, making it easier for the user to understand the meaning of the target text and improving the user's reading speed.

[0197] Optionally, in the case where the text type of the target text is determined based on the number of text lines in which the characters in the target text are distributed, if the characters in the target text are distributed in one text line, then the current text line (i.e., the first text line) in the text line sequence for displaying the target text can be determined as a single text line for displaying the target text. If the characters in the target text are distributed in two or more text lines, then the current text line in the text line sequence for displaying the target text or the next text line after the current text line (i.e., the second text line) can be determined as a single text line for displaying the target text.

[0198] In some optional implementations of this embodiment, the following method may be adopted to determine, based on the text type, an adjacent text line of the first text line from the text line sequence to obtain a second text line:

[0199] In the case that the text type is the first type, a previous text line of the first text line is determined from the text line sequence to obtain a second text line.

[0200] The first type indicates that the number of characters included in the target text is less than or equal to a preset number, and the first text line does not include subsequent text of the target text. The subsequent text is the text located after the target text in the first text line.

[0201] Here, if the number of characters included in the target text is less than or equal to a preset number, and the first text line does not include subsequent text of the target text, then the text type of the target text can be determined as the first type, and the previous text line of the first text line can be determined as the second text line.

[0202] It can be understood that in the above optional implementation, when the target text contains fewer characters and is located at the end of a paragraph, the target text can be displayed in the text line where the first character of the target text is located, or in the text line before the text line where the first character of the target text is located.

[0203] In some application scenarios of the above optional implementation manner, the following method can be adopted to determine a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text:

[0204] In a case where the first text line includes the preceding text, the first text line is determined as a single text line for displaying the target text.

[0205] In a case where the first text line does not include the preceding text, the second text line is determined as a single text line for displaying the target text.

[0206] It can be understood that in the above application scenario, when other text (i.e., characters) is included before the first character of the target text in the first text line, the target text can be displayed in the first text line; when other text is not included before the first character of the target text in the first text line, the target text can be displayed in the second text line.

[0207] It should be noted that the above-mentioned judgment of whether other text is included before the first character refers to judging whether the first text line includes the other text as mentioned above, rather than determining whether the text line before the text line where the target text is located (for example, the previous text line) includes the other text as mentioned above.

[0208] Specifically, if the first text line includes and only includes the text "ABC", the previous text line of the first text line includes and only includes the text "DEF", and the target text is "AB", then, in this case, according to the method described in the above application scenario, the following judgment result can be obtained: no other text is included before the first character of the target text in the first text line.

[0209] In some cases of the above application scenarios, when the first text line does not include the preceding text, before the target text is displayed in the single text line, the following steps may be further performed:

[0210] The first step is to determine a first character set for displaying in the second text line.

[0211] In the second step, a union of each character included in the target text and the first character set is determined as a second character set.

[0212] Here, the first step and the second step can be performed before updating the characters to be displayed in the text line that is initially determined in the second stage. In other words, the re-layout stage is entered only after the first step and the second step are performed.

[0213] On this basis, the target text may be displayed in the single text line in the following manner: the second character set is displayed in the single text line.

[0214] Before displaying the second character set in a single text line, the character spacing between adjacent characters in the second character set may be determined first, and then each character in the second character set may be displayed in a single text line according to the determined character spacing.

[0215] Here, the specific meaning of the previous text can be referred to the above description and will not be repeated here.

[0216] It can be understood that in the above case, the characters originally required to be displayed in the determined single text line and the characters in the target text can be displayed, thereby realizing the display of all the characters in the target text in the same text line, ensuring the continuity of the user's reading of the target text, facilitating the user's understanding of the meaning of the target text, and improving the user's reading speed.

[0217] Optionally, if the number of characters in the second character set in the above situation is greater than or equal to a preset value, then the individual characters in the second character set can be sorted according to the order in which they are typeset in the target document to obtain a character sequence, and then a preset number of characters at the tail of the character sequence are selected and displayed in the single text line, and the unselected characters in the character sequence are displayed in the previous text line of the single text line (i.e., the previous text line).

[0218] Among them, the above preset value is greater than the above preset number.

[0219] In some optional implementations of this embodiment, the following method may be adopted to determine, based on the text type, an adjacent text line of the first text line from the text line sequence to obtain a second text line:

[0220] In the case that the text type is the second type, the next text line of the first text line is determined from the text line sequence to obtain a second text line.

[0221] The second type indicates that the target text is a text in a preset text set.

[0222] Here, if the target text is text in a predetermined text set, the text type of the target text may be determined as the second type, and the next text line of the first text line may be determined as the second text line.

[0223] The predetermined text set may include one or more proper nouns such as names of persons and countries.

[0224] It can be understood that in the above optional implementation, when the target text is a predetermined text, the target text can be displayed in the text line where the first character of the target text is located, or in the next text line of the text line where the first character of the target text is located.

[0225] In some application scenarios of the above optional implementation manner, the following method may be adopted to determine a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text:

[0226] In a case where the first text line includes the preceding text, the first text line or the second text line is determined as a single text line for displaying the target text.

[0227] In a case where the first text line does not include the preceding text, the first text line is determined as a single text line for displaying the target text.

[0228] It can be understood that in the above application scenario, when other text is included before the first character of the target text in the first text line, the target text can be displayed in the first text line or the second text line; when no other text is included before the first character of the target text in the first text line, the target text can be displayed in the first text line.

[0229] In some cases of the above application scenarios, when the first text line includes the preceding text, the first text line or the second text line may be determined as a single text line for displaying the target text in the following manner:

[0230] Step 1: determine a first character spacing between two adjacent characters in a first character sequence.

[0231] The first character spacing may represent the character spacing between two adjacent characters in the first character sequence.

[0232] The first character sequence may be a sequence consisting of the characters included in the first text line, or may be a union of the characters included in the target text and the characters included in the first text line.

[0233] Here, the character spacing between the characters in the first character sequence may be evenly distributed, thereby determining the first character spacing.

[0234] Step 2: determine whether the first character spacing belongs to a preset spacing interval.

[0235] Step three, when the first character spacing belongs to the preset spacing interval, determine the first text line as a single text line for displaying the target text; when the first character spacing does not belong to the preset spacing interval, determine the second text line as a single text line for displaying the target text.

[0236] It can be understood that in the above situation, the character spacing between adjacent characters in the first character sequence can be used to determine whether the target text is displayed in the first text line or the second text line. In this way, it can be avoided that the character spacing between adjacent characters in the displayed target text is too small.

[0237] Step 206: display the target text in the single text line.

[0238] In this embodiment, step 206 and Figure 1 Step 104 in the corresponding embodiment is basically the same and will not be described again here.

[0239] In some application scenarios of the above optional implementation manner, when the text type is the second type, if the second text line is used as a single text line for displaying the target text, the following steps may also be performed:

[0240] First, the previous text line of the single text line is determined from the text line sequence.

[0241] Thereafter, a second character sequence for display on the previous text line is determined.

[0242] The second character sequence may be a sequence of characters displayed in the previous text line determined before the characters to be displayed in the text line initially determined in the second stage are updated, and the last character in the second character sequence is the character preceding the first character in the target document.

[0243] Then, a second character spacing between two adjacent characters in the second character sequence is determined.

[0244] The second character spacing may be the character spacing between two adjacent characters in the second character sequence.

[0245] Here, the character spacing between the characters in the second character sequence may be evenly distributed, thereby determining the second character spacing.

[0246] Then, the second character spacing is written to a disk for storage, so as to display the second character sequence on the previous text line according to the determined second character spacing.

[0247] It can be understood that in the above application scenario, the second character spacing is written to disk as document data and stored, and the second character spacing can be directly obtained later without repeated calculation, which improves the speed of subsequent determination of the second character spacing, and thus the target text can be displayed in a single text line more timely.

[0248] In some optional implementations of this embodiment, when the text type is the second type, if the first text line is used as a single text line for displaying the target text, the following method can be used to display the characters in the target document:

[0249] First, the character spacing between adjacent characters in the first text line is determined to obtain a third character spacing.

[0250] The third character spacing represents the character spacing between adjacent characters in the first text line. The third character spacing between adjacent characters in the first text line may be the same or different.

[0251] Afterwards, the determined third word spacing is taken as document data and written to a disk for storage.

[0252] It can be understood that when the target document is opened subsequently, the content in the target document (including each character in the first text line) can be typeset according to the third character spacing in the document data stored on the disk to keep the content layout of the target document displayed when the target document is opened subsequently consistent.

[0253] For example, when the first text line is determined as a single text line for displaying the target text, the character spacing between adjacent characters in the first text line can be determined to obtain a third character spacing. The determined third character spacing is then used as document data and written to a disk for storage.

[0254] For another example, when the second text line is determined as a single text line for displaying the target text, the character spacing between adjacent characters in the first text line can be determined to obtain a third character spacing. The determined third character spacing is then used as document data and written to a disk for storage.

[0255] Optionally, the word spacing between each adjacent character in the target text line can also be determined to obtain a fourth word spacing. The target text line can include a preset first number of text lines before the first text line, and a preset second number of text lines after the first text line. The fourth word spacing represents the word spacing between each adjacent character in the preset number of text lines before the first text line. The fourth word spacing between each adjacent character in the target text line can be the same or different.

[0256] Afterwards, the determined fourth word spacing is taken as document data and written to a disk for storage.

[0257] It can be understood that after the target text is reformatted, the layout of the text before and after the target text and that is closer to the target text may be affected. Therefore, by storing the spacing between adjacent characters in the target text line on disk, the layout of the text content that is closer to the target text in the target document displayed when the target document is subsequently opened can be kept consistent.

[0258] In some cases of the above application scenarios, after the second word spacing is stored in the writing disk, a preset document tag may be added to the document data of the target document.

[0259] The second character spacing can be used as document data and written to disk for storage. Thus, when the target document is subsequently opened, the content in the target document can be typeset according to the second character spacing in the document data written to disk for storage, so as to keep the character spacing between two adjacent characters in the second character sequence displayed when the target document is subsequently opened consistent.

[0260] It can be understood that in the above situation, by adding preset document tags, it can be ensured that the user can determine in the later editing process whether the target text is displayed in a single text line due to user editing, or whether the target text is displayed in a single text line due to the calculation of the second character spacing by using this method.

[0261] In some examples of the above situation, after the writing of the second word spacing to the disk and when the target document is in a non-official document mode, the following steps may also be performed:

[0262] First, the layout data of the target document is obtained.

[0263] The typesetting data includes the second character spacing stored in the disk.

[0264] Afterwards, the target document is typeset based on the typeset data to display the typeset target document.

[0265] It can be understood that in the above example, the target text can be displayed in a single text line in the non-official document mode.

[0266] It should be noted that, in addition to the above contents, this embodiment may also include Figure 1 The corresponding technical features described in the corresponding embodiments are realized Figure 1 For details on the technical effects of the method for displaying the document text shown, please refer to Figure 1 For the sake of brevity, the relevant description is not repeated here.

[0267] The document text display method provided in the embodiment of the present application can display the target text in the text line where its first character is located, or in the adjacent text line of the text line. In this way, the layout impact of texts far away from the target text can be reduced, so that the content of the target document finally displayed is more consistent with the document data edited by the user.

[0268] The following uses the target text as a special name or a single word as an example to illustrate the embodiments of the present application. However, it should be noted that the embodiments of the present application may have the features described below, but the following description does not constitute a limitation on the scope of protection of the embodiments of the present application.

[0269] Currently, there is no solution that can handle special names or words that do not form a single line and is compatible with the OOXML standard.

[0270] Among them, OOXML is an office document format based on XML (Extensible Markup Language).

[0271] The above-mentioned special names may be names of people, countries, etc., which, when separated, may affect reading and segmentation or cause ambiguity.

[0272] This method can facilitate users and avoid manually adjusting the line spacing of streaming software when encountering special names or single words. When encountering special names or single word lines in typesetting, the lines are automatically wrapped. The line spacing calculated by the line wrapping (that is, the second line spacing mentioned above) can be calculated. The line spacing is set in the kernel, and then the data is written to the disk.

[0273] Please refer to Figure 3 , Figure 3 A flowchart of another method for displaying document text provided in an embodiment of the present application.

[0274] Specifically, if Figure 3 As shown, the method specifically includes:

[0275] First, enter the official document mode and trigger the specific name to not wrap. Assuming that the specific name wraps, the typesetting needs to wrap automatically at this time, and then the typesetting spacing Wn is evenly distributed on the previous line.

[0276] The official document mode is a special mode of office software. In this mode, the office software has code logic to implement the method provided by this application.

[0277] In addition, in the official document mode, a database or list can be maintained to store specific names (corresponding to the above-mentioned preset text set). Further, the stored specific names can be used to match in the documents opened in the official document mode to determine whether to wrap the lines.

[0278] After that, when saving the document / exiting the official document mode, you need to calculate the average distance W1n of the previous line and calculate it.

[0279] Then, the calculated value W1n is stored in the OOXML document, and the information in the original document is stored in a custom tag (ie, the preset document tag mentioned above). As long as it is a custom tag supported by the standard, the value can be stored.

[0280] In other words, after storing W1n in the OOXML data corresponding to the document, the document can be opened using office software in non-official document mode and the document can be typeset normally according to W1n.

[0281] In addition, if the spacing tag is not set specifically, this value is 0, so the layout is arranged according to the original rules and the specific name is not triggered to not break. When the specific name is triggered to not break, this value (for example, 4) will be calculated in the layout, and finally it will be 4 (that is, the second word spacing (4) stored in the disk mentioned above), and the original data of the compatible version will be stored in a specific tag.

[0282] By adding the above tags, it can be ensured that the user can know whether the increase in spacing is caused by user editing or the value obtained through calculation during the editing process.

[0283] For applications that do not support official document mode, or applications that support official document mode but are not in official document mode, since the above line spacing (that is, the above second line spacing) has been stored on disk, it can recognize that the line spacing in the spacing tag is 4. Therefore, it will still read the value 4 calculated by the official document mode typesetting, so that the character spacing of the line can be set to 4, thus ensuring a compatible solution.

[0284] It should be noted that in the official document mode, since spacing is not empty, it means that the document has previously or currently triggered the function of not wrapping lines for specific names. It will be typeset based on val=0 according to the user's real-time editing, and will recalculate the line spacing in spacing after encountering a specific name.

[0285] In addition, the newly added tags are just examples. In fact, you can add new tags to record the values ​​of normal typesetting within the scope of the OOXML standard. The above OOXML standard is just an example. As long as it is an office software standard, it can support this method as a compatibility solution.

[0286] In addition, there are two cases in the calculation:

[0287] 1. Place the specific name on the next line, calculate the character spacing of the remaining characters on the previous line, and store it in the content.

[0288] 2. Determine the number of characters that have been typeset in the current line plus the number of characters of the complete specific name, and readjust the spacing between all characters in the current line so that the current line can accommodate the complete specific name and store it in the content.

[0289] Furthermore, the minimum allowable value of the character spacing of each line can be determined. When the character spacing calculated by the second method is greater than the minimum allowable value, the second method is used; when the character spacing calculated by the second method is less than the minimum allowable value, the first method is switched to use.

[0290] Similarly, the maximum allowable value of the character spacing of each line can be determined. When the character spacing calculated by the first method is less than the maximum allowable value, the first method is used; when the character spacing calculated by the first method is greater than the maximum allowable value, the second method is switched to use.

[0291] It should be noted that, in addition to the contents recorded above, this embodiment may also include the technical features described in the above embodiments, so as to achieve the technical effect of the method for displaying the document text shown above. Please refer to the above description for details. For the sake of brevity, it will not be repeated here.

[0292] This method does not require the user to edit the target document, and can achieve the goal of not wrapping special names and not forming lines for single words, thereby saving the user's time and avoiding the user from manually adjusting the layout to achieve the goal of displaying the target text in a single text line.

[0293] Figure 4 A schematic diagram of the structure of a document text display device provided in an embodiment of the present application. Specifically comprising:

[0294] A first acquisition unit 401 is used to acquire a target document, wherein the target document includes a text line sequence, and the target document includes a target text, and the target text includes at least one character;

[0295] A first determining unit 402, configured to determine the text type of the target text;

[0296] A second determining unit 403, configured to determine, based on the text type, a single text line from the text line sequence for displaying the target text;

[0297] The first display unit 404 is configured to display the target text in the single text line.

[0298] In a possible implementation, determining a single text line for displaying the target text from the text line sequence based on the text type includes:

[0299] Determine, from the text line sequence, the text line where the first character of the target text is located, to obtain a first text line;

[0300] Based on the text type, determining an adjacent text line of the first text line from the text line sequence to obtain a second text line;

[0301] A single text line for displaying the target text is determined from the first text line and the second text line.

[0302] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line includes:

[0303] Determining whether the first text line includes a preceding text of the target text, wherein the preceding text is text located before the target text in the first text line;

[0304] Based on whether the first text line includes the preceding text, a single text line for displaying the target text is determined from the first text line and the second text line.

[0305] In a possible implementation, the determining, based on the text type, from the text line sequence, an adjacent text line of the first text line to obtain a second text line includes:

[0306] In the case where the text type is the first type, determining a previous text line of the first text line from the text line sequence to obtain a second text line;

[0307] The first type indicates that the number of characters included in the target text is less than or equal to a preset number, and the first text line does not include subsequent text of the target text, and the subsequent text is text located after the target text in the first text line.

[0308] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text includes:

[0309] In a case where the first text line includes the preceding text, determining the first text line as a single text line for displaying the target text; or

[0310] In a case where the first text line does not include the preceding text, the second text line is determined as a single text line for displaying the target text.

[0311] In a possible implementation manner, when the first text line does not include the preceding text, before the single text line displays the target text, the device further includes:

[0312] A third determining unit (not shown in the figure), configured to determine a first character set to be displayed in the second text line;

[0313] a fourth determining unit (not shown in the figure), configured to determine a union of each character included in the target text and the first character set as a second character set; and

[0314] Displaying the target text in the single text line includes:

[0315] The second set of characters is displayed on the single text line.

[0316] In a possible implementation, the determining, based on the text type, from the text line sequence, an adjacent text line of the first text line to obtain a second text line includes:

[0317] In the case where the text type is the second type, determining the next text line of the first text line from the text line sequence to obtain a second text line;

[0318] The second type indicates that the target text is a text in a preset text set.

[0319] In a possible implementation manner, determining a single text line for displaying the target text from the first text line and the second text line based on whether the first text line includes the preceding text includes:

[0320] In a case where the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text; or

[0321] In a case where the first text line does not include the preceding text, the first text line is determined as a single text line for displaying the target text.

[0322] In a possible implementation, when the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text includes:

[0323] Determine a first character spacing between two adjacent characters in a first character sequence;

[0324] Determining whether the first character spacing belongs to a preset spacing interval;

[0325] In a case where the first character spacing belongs to the preset spacing interval, determining the first text line as a single text line for displaying the target text;

[0326] When the first character spacing does not belong to the preset spacing interval, the second text line is determined as a single text line for displaying the target text.

[0327] In a possible implementation manner, when the text type is the second type, the device further includes:

[0328] a fifth determining unit (not shown in the figure), configured to determine a previous text line of the single text line from the text line sequence;

[0329] a sixth determining unit (not shown in the figure), configured to determine a second character sequence for display in the previous text line, wherein the last character in the second character sequence is a character preceding the first character in the target document;

[0330] a seventh determining unit (not shown in the figure), configured to determine a second character spacing between two adjacent characters in the second character sequence;

[0331] A storage unit (not shown in the figure) is used for writing the second character spacing to a disk to store the second character spacing, so as to display the second character sequence in the previous text line according to the determined second character spacing.

[0332] In a possible implementation manner, after the writing disk stores the second word spacing, the device further includes:

[0333] An adding unit (not shown in the figure) is used to add a preset document tag to the document data of the target document.

[0334] In a possible implementation manner, after the writing disk stores the second word spacing, the device further includes:

[0335] A second acquisition unit (not shown in the figure), configured to acquire layout data of the target document when the target document is in a non-official document mode, wherein the layout data includes the second word spacing stored in a disk;

[0336] The second display unit (not shown in the figure) is used to typeset the target document based on the typeset data to display the typeset target document.

[0337] In a possible implementation manner, when the target document is in an official document mode, a device for displaying the document text is operated.

[0338] The document text display device provided in this embodiment can be as follows Figure 4 The document text display device shown in can execute all the steps of the document text display methods described above, thereby achieving the technical effects of the document text display methods described above. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0339] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 5 The electronic device 500 shown includes: at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not shown in FIG. Figure 5 Various buses are labeled as bus system 505 .

[0340] The user interface 503 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0341] It can be understood that the memory 502 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0342] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and an application program 5022 .

[0343] Among them, the operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 5022.

[0344] In this embodiment, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:

[0345] Acquire a target document, wherein the target document includes a sequence of text lines, and the target document includes a target text, and the target text includes at least one character;

[0346] Determining the text type of the target text;

[0347] Based on the text type, determining a single text line from the text line sequence for displaying the target text;

[0348] The target text is displayed in the single text line.

[0349] The method disclosed in the above embodiment of the present application can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above processor 501 can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.

[0350] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.

[0351] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0352] The electronic device provided in this embodiment may be Figure 5 The electronic device shown in can execute all steps of the display method of each document text described above, thereby achieving the technical effect of the display method of each document text described above. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0353] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0354] When one or more programs in the storage medium can be executed by one or more processors, the document text display method executed on the electronic device side can be implemented.

[0355] The processor is used to execute the document text display program stored in the memory to implement the following steps of the document text display method executed on the electronic device side:

[0356] Acquire a target document, wherein the target document includes a sequence of text lines, and the target document includes a target text, and the target text includes at least one character;

[0357] Determining the text type of the target text;

[0358] Based on the text type, determining a single text line from the text line sequence for displaying the target text;

[0359] The target text is displayed in the single text line.

[0360] The professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0361] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented by hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0362] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0363] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for displaying document text, characterized in that: The method comprises: Acquire a target document, wherein the target document includes a sequence of text lines, and the target document includes a target text, and the target text includes at least one character; Determining the text type of the target text; Based on the text type, determining a single text line from the text line sequence for displaying the target text; The target text is displayed in the single text line.

2. The method according to claim 1, characterized in that: The step of determining a single text line for displaying the target text from the text line sequence based on the text type includes: Determine, from the text line sequence, the text line where the first character of the target text is located, to obtain a first text line; Based on the text type, determining an adjacent text line of the first text line from the text line sequence to obtain a second text line; A single text line for displaying the target text is determined from the first text line and the second text line.

3. The method according to claim 2, characterized in that The step of determining a single text line for displaying the target text from the first text line and the second text line includes: Determining whether the first text line includes a preceding text of the target text, wherein the preceding text is text located before the target text in the first text line; Based on whether the first text line includes the preceding text, a single text line for displaying the target text is determined from the first text line and the second text line.

4. The method according to any one of claims 2-3, characterized in that: The step of determining, based on the text type, an adjacent text line of the first text line from the text line sequence to obtain a second text line comprises: In the case where the text type is the first type, determining a previous text line of the first text line from the text line sequence to obtain a second text line; The first type indicates that the number of characters included in the target text is less than or equal to a preset number, and the first text line does not include subsequent text of the target text, and the subsequent text is text located after the target text in the first text line.

5. The method according to claim 4, characterized in that The determining, based on whether the first text line includes the preceding text, a single text line for displaying the target text from the first text line and the second text line comprises: In a case where the first text line includes the preceding text, determining the first text line as a single text line for displaying the target text; or In a case where the first text line does not include the preceding text, the second text line is determined as a single text line for displaying the target text.

6. The method according to claim 5, characterized in that In the case that the first text line does not include the preceding text, before the single text line displays the target text, the method further includes: determining a first set of characters for display in the second text line; Determine a union of each character included in the target text and the first character set as a second character set; and Displaying the target text in the single text line includes: The second set of characters is displayed on the single text line.

7. The method according to any one of claims 2-3, characterized in that: The step of determining, based on the text type, an adjacent text line of the first text line from the text line sequence to obtain a second text line comprises: In the case where the text type is the second type, determining the next text line of the first text line from the text line sequence to obtain a second text line; The second type indicates that the target text is a text in a preset text set.

8. The method according to claim 7, characterized in that The determining, based on whether the first text line includes the preceding text, a single text line for displaying the target text from the first text line and the second text line comprises: In a case where the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text; or In a case where the first text line does not include the preceding text, the first text line is determined as a single text line for displaying the target text.

9. The method according to claim 8, characterized in that In the case where the first text line includes the preceding text, determining the first text line or the second text line as a single text line for displaying the target text includes: Determine a first character spacing between two adjacent characters in a first character sequence; Determining whether the first character spacing belongs to a preset spacing interval; In a case where the first character spacing belongs to the preset spacing interval, determining the first text line as a single text line for displaying the target text; When the first character spacing does not belong to the preset spacing interval, the second text line is determined as a single text line for displaying the target text.

10. The method according to claim 7, characterized in that In the case where the text type is the second type, the method further includes: Determining a previous text line of the single text line from the text line sequence; Determine a second character sequence for display on the previous text line, wherein the last character in the second character sequence is the character preceding the first character in the target document; Determine a second character spacing between two adjacent characters in the second character sequence; The second character spacing is written to a disk for storing, so as to display the second character sequence on the previous text line according to the determined second character spacing.

11. The method according to claim 10, characterized in that After storing the second word spacing in the writing disk, the method further includes: A preset document tag is added to the document data of the target document.

12. The method according to any one of claims 10-11, characterized in that: After storing the second word spacing in the writing disk, the method further includes: When the target document is in a non-official document mode, obtaining typesetting data of the target document, wherein the typesetting data includes the second character spacing stored in a disk; The target document is typeset based on the typeset data to display the typeset target document.

13. The method according to any one of claims 1-3, 5, 6, 8-11, characterized in that: When the target document is in an official document mode, the document text display method is executed.

14. A document text display device, characterized in that: The device comprises: A first acquisition unit is used to acquire a target document, wherein the target document includes a text line sequence, and the target document includes a target text, and the target text includes at least one character; A first determining unit, used to determine the text type of the target text; A second determination unit, configured to determine, based on the text type, a single text line from the text line sequence for displaying the target text; The first display unit is configured to display the target text in the single text line.

15. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method described in any one of claims 1 to 13 is implemented.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 13 is implemented.