CN110705208A - Text display method and device, computer readable storage medium and electronic equipment - Google Patents

Text display method and device, computer readable storage medium and electronic equipment Download PDF

Info

Publication number
CN110705208A
CN110705208A CN201910889106.4A CN201910889106A CN110705208A CN 110705208 A CN110705208 A CN 110705208A CN 201910889106 A CN201910889106 A CN 201910889106A CN 110705208 A CN110705208 A CN 110705208A
Authority
CN
China
Prior art keywords
text
paragraph
distance
line
interval
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910889106.4A
Other languages
Chinese (zh)
Other versions
CN110705208B (en
Inventor
吴颖仪
刘开辉
陈志业
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910889106.4A priority Critical patent/CN110705208B/en
Publication of CN110705208A publication Critical patent/CN110705208A/en
Application granted granted Critical
Publication of CN110705208B publication Critical patent/CN110705208B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The embodiment of the application discloses a text display method and device, a storage medium and electronic equipment. The embodiment of the application receives a text display request; acquiring a line space of a text to be displayed according to the text display request; determining a target distance for displaying text objects in a text to be displayed according to a preset mapping relation between the text object distance and the line distance; and displaying the text object according to the line spacing and the target spacing. According to the method and the device for typesetting the text, the distance between the text objects is automatically adjusted according to the relation between the distance between the text objects and the line distance of the text, linkage typesetting is achieved, and therefore the efficiency of text typesetting is improved.

Description

Text display method and device, computer readable storage medium and electronic equipment
Technical Field
The present application relates to the field of electronic technologies, and in particular, to a text display method and apparatus, a computer-readable storage medium, and an electronic device.
Background
With the development of science and technology, electronic devices such as computers and smart phones have become indispensable tools in daily life, study and work of people. In order to make the layout of the text in these electronic devices as beautiful as possible, the layout of the text is usually adjusted on the electronic devices to achieve the desired layout. However, when adjusting the text layout, various pitches generally need to be adjusted manually, which is troublesome to operate and has low layout efficiency.
Disclosure of Invention
The embodiment of the application provides a text display method and device, a computer readable storage medium and electronic equipment, which can improve the efficiency of text typesetting.
In a first aspect, an embodiment of the present application provides a text display method, where the text display method includes:
receiving a text display request;
acquiring the line spacing of the text to be displayed according to the text display request;
determining a target distance for displaying the text objects in the text to be displayed according to a preset mapping relation between the text object distance and the line distance;
and displaying the text object according to the line spacing and the target spacing.
In a second aspect, an embodiment of the present application provides a text display apparatus, including:
the request receiving module is used for receiving a text display request;
the line space acquisition module is used for acquiring the line space of the text to be displayed according to the text display request;
the distance determining module is used for determining a target distance for displaying the text objects in the text to be displayed according to a mapping relation between a preset text object distance and the line distance;
and the text display module is used for displaying the text object according to the line spacing and the target spacing.
In a third aspect, the present application provides a storage medium, on which a computer program is stored, which, when running on a computer, causes the computer to execute the text display method provided by the present application.
In a fourth aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, where the processor is electrically connected to the memory, and the memory stores a computer program, and the processor executes the text display method provided in the embodiment of the present application by calling the computer program.
In the embodiment of the application, the space between the text objects is automatically adjusted according to the relation between the space between the text objects and the line space of the text, and the linkage typesetting is realized, so that the efficiency of text typesetting is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a text display method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a text to be displayed in the text display method according to the embodiment of the present application.
Fig. 3 is another schematic flowchart of a text display method according to an embodiment of the present application.
Fig. 4 is a schematic view of a first structure of a text display device according to an embodiment of the present application.
Fig. 5 is a second structural schematic diagram of a text display device according to an embodiment of the present application.
Fig. 6 is a schematic diagram of a third structure of a text display device according to an embodiment of the present application.
Fig. 7 is a fourth structural schematic diagram of a text display device according to an embodiment of the present application.
Fig. 8 is a fifth structural schematic diagram of a text display device according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Fig. 10 is another schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Referring to the drawings, wherein like reference numbers refer to like elements, the principles of the present application are illustrated as being implemented in a suitable computing environment. The following description is based on illustrated embodiments of the application and should not be taken as limiting the application with respect to other embodiments that are not detailed herein.
The embodiment of the application firstly provides a text display method, and the text display method is applied to electronic equipment. The main body of the text display method may be the text display device provided in the embodiment of the present application, or an electronic device integrated with the text display device, where the text display device may be implemented in a hardware or software manner, and the electronic device may be a device with processing capability and configured with a processor, such as a smart phone, a tablet computer, a palmtop computer, a notebook computer, or a desktop computer.
Referring to fig. 1, fig. 1 is a flowchart illustrating a text display method according to an embodiment of the present disclosure. The text display method is applied to the electronic device provided by the embodiment of the application, and the flow of the text display method provided by the embodiment of the application can be as follows:
101, a text display request is received.
The text refers to a representation form of a written language, and the text may include sentences, paragraphs, articles, and the like. The text may be displayed on an interface of the electronic device, for example, in a document processing application of the electronic device, and the user may type the text in the application, so that the text achieves a preset display effect.
In addition, for the developer, the text can also be typeset at the development interface of the electronic device, for example, the text which we directly see when entering the "setting" application program is already typeset and laid out by the developer at the development time.
And 102, acquiring the line space of the text to be displayed according to the text display request.
The text to be displayed is the text which the user wants to adjust the typesetting and display the typesetting on the interface of the electronic equipment. The text to be displayed may include a body and a title, where the title may include a main title, a sub-title, etc., or a primary title, a secondary title, etc.
Referring to fig. 2, fig. 2 is a schematic diagram of a text to be displayed in a text display method according to an embodiment of the present application. The text to be displayed includes 1 major title (text title), 2 minor titles (paragraph titles) and 3 paragraph texts. In the embodiment of the present application, the line spacing of the text to be displayed, which is obtained according to the text display request, refers to the line spacing of characters in a paragraph text (excluding a title) in the text to be displayed.
Referring to fig. 2, in an embodiment, when typesetting the text, the text in the same line is aligned by using the baseline, and at this time, the line spacing of the text to be displayed, which is obtained according to the text display request, may also be the distance between the text baselines of two adjacent text lines in the text of the same paragraph, i.e., a in fig. 2. The line spacing of the text to be displayed can be obtained by measuring the distance between the character baselines of two adjacent characters in the text of the same paragraph.
Or, the line spacing a at this time is the sum of the height x of one line of characters in the paragraph text and the line spacing a of two lines of characters (the distance between two lines of characters). The method comprises the steps of obtaining a character size of a text to be displayed, finding a character height x corresponding to the character size in a terminal, measuring a line spacing a of two lines of characters in a paragraph body, and determining the line spacing A of the text to be displayed according to A ═ a + x.
And 103, determining a target distance for displaying the text objects in the text to be displayed according to the preset mapping relation between the text object distance and the line distance.
In the text to be displayed, various text objects may be contained. The text object may include a body and a title.
The titles can be divided into a first-level title, a second-level title, a third-level title and the like according to the number of the title levels contained in the text to be displayed. In the embodiment of the present application, the number of the hierarchies of the title is not limited, and the title may be divided according to the number of the hierarchies of the title actually included in the text to be displayed.
Where text may appear in paragraphs, the text of each paragraph is also referred to as paragraph text when the text appears in paragraphs. For paragraph text, there may be paragraph headings to summarize the content of one or more paragraph texts. Each paragraph heading may correspond to one or more paragraph bodies and be displayed above all of the paragraph bodies to which it corresponds. And dividing each paragraph text by the corresponding paragraph titles, wherein the paragraph texts corresponding to the same paragraph title are the same group of paragraph texts.
Referring to fig. 2, in an embodiment, a text object in a text to be displayed includes 1 primary title, 2 secondary titles, and 3 paragraph texts, where the primary title is a title of the entire text to be displayed and may be referred to as a text title; the secondary headings are headings that summarize the textual content of the paragraphs and may be referred to as paragraph headings. The 2 paragraph texts from top to bottom can be referred to as a first paragraph text, a second paragraph text and a third paragraph text in sequence.
The paragraph header of the first paragraph text is paragraph header 1, and the paragraph headers of the second paragraph text and the third paragraph text are paragraph header 2, so that the second paragraph text and the third paragraph text corresponding to paragraph header 2 are the same group of paragraph texts.
Taking several text objects shown in fig. 2 as examples, some distance parameters involved in typesetting the text to be displayed may include:
a: the distance between two adjacent lines of characters in the text of the same paragraph;
a: line spacing, i.e. the distance between baselines of two adjacent lines of text in the same paragraph;
b: the distance between the paragraph title and the text of the next paragraph, also called the first distance;
c: the distance between two adjacent paragraph texts is also called as a second distance;
d: the distance between the text title and the body of the first paragraph, also called the third distance.
The distance a between two adjacent characters can be directly obtained by measurement, or obtained by subtracting the character size height x from the row distance A; the line spacing a can be obtained by the method described previously; the text object distances b, c and d can be determined according to the preset mapping relationship between the text object distances and the line distances.
In one embodiment, the target distance of the text object in the text to be displayed, which is determined according to the preset mapping relationship between the text object distance and the line space, satisfies the following conditions: the third distance d between the text title and the text of the first paragraph is larger than the second distance c between the text of two adjacent paragraphs, the first distance b between the text title and the text of the next paragraph is larger than the distance a between two adjacent words in the text of the same paragraph, so that the typesetting effect of the text to be displayed looks neat and beautiful.
The method comprises the steps that a preset mapping relation between text object distances and line distances can be stored in a text processing database in a table form, when a user adjusts the line distance A of a text to be displayed, a terminal obtains the preset mapping relation between the text object distances and the line distances from the text processing database, and the target distance for displaying the text objects in the text to be displayed is determined according to the preset mapping relation between the text object distances and the line distances.
In an embodiment, when the line spacing a of the text to be displayed is adjusted, the numerical value of the line spacing a is obtained, and the target spacing, that is, the first spacing b, is determined according to the mapping relationship between the first spacing b and the line spacing a, so that when the line spacing a is adjusted by a user, the first spacing b between the paragraph title and the text of the next paragraph is correspondingly changed.
In an embodiment, when the line spacing a of the text to be displayed is adjusted, the numerical value of the line spacing a is obtained, and the target spacing, that is, the second spacing c, is determined according to the mapping relationship between the second spacing c and the line spacing a, so that when the line spacing a is adjusted by a user, the second spacing c of the texts of two adjacent paragraphs is correspondingly changed.
In an embodiment, when the line spacing a of the text to be displayed is adjusted, the numerical value of the line spacing a is obtained, and the target spacing, that is, the third spacing d, is determined according to the mapping relationship between the third spacing d and the line spacing a, so that when the line spacing a is adjusted by a user, the third spacing d between the text title and the text of the first paragraph is correspondingly changed.
Or when the line spacing a of the text to be displayed is adjusted, the numerical value of the line spacing a is obtained, and the first spacing b, the second spacing c and the third spacing d are determined according to the mapping relation between the first spacing b and the line spacing a, the mapping relation between the second spacing c and the line spacing a and the mapping relation between the third spacing d and the line spacing a, so that when the line spacing a is adjusted by a user, the first spacing b between the paragraph title and the next paragraph text, the second spacing c between the two adjacent paragraph texts and the third spacing d between the text title and the first paragraph text are correspondingly changed, and the linked typesetting effect is achieved.
Preferably, the preset mapping relationship between the text object distance and the line space may be a magnification relationship. And the corresponding multiplying power of different text object intervals is different, so that the third interval d between the text title and the first paragraph text is larger than the second interval c between two adjacent paragraph texts, and the first interval b between the text title and the next paragraph text is larger than the interval a between two adjacent words in the same paragraph text, and the beautiful typesetting effect is achieved.
In an embodiment, when a paragraph header is included between two adjacent paragraph texts, a reference distance (i.e. the first distance b) between the paragraph header and a next paragraph text is obtained, a font height x of the paragraph text is obtained, and a product obtained by multiplying a sum of the reference distance and the font height by a second magnification is used as the second distance C between two adjacent paragraph texts.
In one embodiment, when a paragraph title is included between the text title and the first paragraph body, the third distance refers to the distance between the text title and the paragraph body. In other words, the third distance is a distance between the text title in the text and the content other than the text title.
And 104, displaying the text object according to the line spacing and the target spacing.
And after determining a target distance for displaying the text object in the text to be displayed according to a preset mapping relation between the text object distance and the line distance, displaying the text object in the text to be displayed according to the target distance, wherein the line distance of the paragraph text is displayed according to the adjusted line distance A, and displaying the distances of the positions corresponding to the target distances b, c and/or d according to the numerical values determined by the mapping relation.
As can be seen from the above, in the embodiment of the present application, a text display request is received; acquiring a line space of a text to be displayed according to the text display request; determining a target distance for displaying text objects in a text to be displayed according to a preset mapping relation between the text object distance and the line distance; and displaying the text object according to the line spacing and the target spacing. According to the method and the device for typesetting the text, the distance between the text objects is automatically adjusted according to the relation between the distance between the text objects and the line distance of the text, linkage typesetting is achieved, and therefore the efficiency of text typesetting is improved.
Referring to fig. 3, fig. 3 is another schematic flow chart of a text display method according to an embodiment of the present application. In this embodiment, a preset mapping relationship between a text object distance and a line space is described as an example of a magnification relationship, and the text display method is applied to the electronic device provided in this embodiment, and the flow of the text display method may include:
201. a text display request is received.
The text refers to a representation form of a written language, and the text may include sentences, paragraphs, articles, and the like. The text may be displayed on an interface of the electronic device, for example, in a document processing application of the electronic device, and the user may type the text in the application, so that the text achieves a preset display effect.
In addition, for the developer, the text can also be typeset at the development interface of the electronic device, for example, the text which we directly see when entering the "setting" application program is already typeset and laid out by the developer at the development time.
202. And acquiring the font height x and the basic line space multiplying power y of the paragraph text in the text to be displayed.
203. And calculating the product of the word size height x and the basic line space multiplying power y to obtain the line space A of the text to be displayed, namely y x.
When setting the line spacing of the text, the line spacing may be set directly, for example, set to a fixed value of 24 pounds; the line space can also be set by setting the font size and the line space multiplying power, so that when the font size and the line space multiplying power are changed, the line space is correspondingly changed. Wherein, the font size refers to the size of characters, and different font sizes correspond to different character heights. The base line pitch magnification may be set to 1.0 times, 1.5 times, etc. When the multiplying power of the basic line space is 1.0 times, the line space of the paragraph text is equal to the distance between baselines of two adjacent lines of characters in the paragraph text, and the distance between the baselines is equal to the font height x of the paragraph text; when the basic line space multiplying factor is 1.5 times, the line space of the paragraph text is equal to 1.5 times of the distance between baselines of two adjacent lines of characters in the paragraph text.
Therefore, when the line space is set by setting the font size and the line space multiplying power, the size of the line space can be determined by the font size height x corresponding to the font size set by the falling text in the text to be displayed after setting and the basic line space multiplying power y, and the calculation mode is as follows: the line spacing a is y x.
204. And determining the first preset multiplying power interval to be 0.4-0.5.
205. The first distance b between the paragraph title and the text of the next paragraph is determined to be 0.4A-0.5A.
206. And determining the second preset multiplying power interval to be 0.75-1.25.
207. And determining the second distance c between two adjacent paragraph texts to be 0.75A-1.25A.
208. And determining the third preset multiplying power interval to be 0.9-1.625.
209. And determining that the third distance d between the text title and the text of the first paragraph is 0.9A-1.625A.
In an embodiment, a target distance for displaying text objects in a text to be displayed is determined according to a preset mapping relation between a text object distance and a line distance. Taking the mapping relationship as a magnification relationship as an example, the magnification between the target pitch and the line pitch a may not be a specific numerical value, but a preset magnification interval.
For example, when the target interval is a first interval b between a paragraph title and a text of a next paragraph, the target interval corresponds to a first preset magnification interval of 0.4-0.5; when the target distance is a second distance c between two adjacent paragraph texts, corresponding to a second preset multiplying power interval of 0.75-1.25; and when the target interval is a third interval d between the text title and the text of the first paragraph, corresponding to a third preset magnification interval of 0.9-1.625.
Therefore, when the value of the first distance b is determined, the first multiplying power can be determined in the first preset multiplying power interval, and the product of the line space a and the first multiplying power is determined as the first distance b between the paragraph title and the next paragraph text. For example, if the first magnification is 0.45 from the first preset magnification interval 0.4 to 0.5, the first pitch b can be determined to be 0.45A.
When the value of the second distance c is determined, a second multiplying power can be determined in a second preset multiplying power interval, and the product of the line distance a and the second multiplying power is determined as the second distance c of two adjacent paragraph texts. For example, if the second magnification 1 is determined from the second predetermined magnification interval 0.75 to 1.25, the second pitch b can be determined to be a.
When the value of the third distance d is determined, a third multiplying power can be determined in a third preset multiplying power interval, and the product of the line spacing a and the third multiplying power is determined as the third distance d between the paragraph title and the text of the first paragraph below the paragraph title. For example, if the third magnification ratio 1.5 is determined from the third preset magnification ratio interval 0.9 to 1.625, the third pitch b can be determined to be 1.5A.
In one embodiment, the third pitch d is actually varied according to the second pitch c: d is 1.2c to 1.3c, and the second pitch c varies according to the line pitch a: c is 0.75A to 1.25A, and thus, after combining the two mapping relationships, the mapping relationship that the third pitch d changes with the pitch a is determined as follows: d is 0.9A to 1.625A.
In an embodiment, in order to satisfy the third distance d between a text title and a first paragraph body > the second distance c between two adjacent paragraph bodies > the first distance b between the paragraph title and a next paragraph body > the distance a between two adjacent words in the same paragraph body, so that the typesetting effect of the text to be displayed looks neat and beautiful, the mapping relationship of the third distance d is further defined as d being 1.25A-1.625A. Therefore, the above-described magnitude relationship can be satisfied regardless of the values of the first pitch b, the second pitch c, and the third pitch d in the respective mapping relationships.
Note that, the first pitch b may be changed only according to the line pitch a, the second pitch c may be changed only according to the line pitch a, or the third pitch d may be changed only according to the line pitch a. Alternatively, the first pitch b, the second pitch c, and the third pitch d may be changed in synchronization with the line pitch a.
210. And displaying the text objects according to the line spacing A, the first spacing b, the second spacing c and the third spacing d.
After target distances b, c and d for displaying text objects in the text to be displayed are determined according to preset mapping relations b between the text object distances and the line distances, 0.4A-0.5A, c, 0.75A-1.25A and d between 0.9A-1.625A, the text objects in the text to be displayed are displayed according to the target distances, wherein the distances of the positions corresponding to the target distances b, c and/or d are displayed according to the numerical values determined by the mapping relations, and the line distances of the text are displayed according to the adjusted line distances A.
In the above embodiments, the descriptions of the embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed description of the page processing method, and are not described herein again.
As can be seen from the above, in the embodiment of the present application, a text display request is received; acquiring a line space of a text to be displayed according to the text display request; determining a target distance for displaying text objects in a text to be displayed according to a preset mapping relation between the text object distance and the line distance; and displaying the text object according to the line spacing and the target spacing. According to the method and the device for typesetting the text, the distance between the text objects is automatically adjusted according to the relation between the distance between the text objects and the line distance of the text, linkage typesetting is achieved, and therefore the efficiency of text typesetting is improved.
The embodiment of the application also provides a text display device. Referring to fig. 4, fig. 4 is a first structural schematic diagram of a text display device according to an embodiment of the present application. The text display apparatus 300 is applied to an electronic device, the electronic device includes a plurality of cameras, the text display apparatus includes a request receiving module 301, a line space obtaining module 302, a space determining module 303, and a text display module 304, as follows:
a request receiving module 301, configured to receive a text display request;
a line space obtaining module 302, configured to obtain a line space of a text to be displayed according to the text display request;
the distance determining module 303 is configured to determine a target distance for displaying a text object in the text to be displayed according to a preset mapping relationship between a text object distance and a line distance;
and the text display module 304 is used for displaying the text objects according to the line spacing and the target spacing.
When the line space of the text to be displayed is obtained according to the text display request, the line space obtaining module 302 may be configured to:
acquiring the font height and basic line space multiplying power of a paragraph body in a text to be displayed;
and calculating the product of the height of the character size and the multiplying power of the basic line space to obtain the line space of the text to be displayed.
Referring to fig. 5, in an embodiment, the text display module further includes a magnification acquisition module 305:
and a magnification acquiring module 305, configured to acquire a preset magnification interval corresponding to the text object interval.
Referring to fig. 6, in an embodiment, the text object includes a paragraph title and a paragraph body, the preset magnification interval is a first preset magnification interval, and the distance determining module 303 includes a first magnification unit 3031 and a first distance unit 3032:
a first magnification unit 3031, configured to determine a first magnification in a first preset magnification interval;
a first distance unit 3032, configured to determine a product of the line space and the first magnification as a first distance between the paragraph header and the text of the next paragraph.
Referring to fig. 7, in an embodiment, the text object includes two adjacent paragraph texts, the preset magnification interval is a second preset magnification interval, and the distance determining module 303 includes a second magnification unit 3033 and
second pitch unit 3034:
a second magnification unit 3033, configured to determine a second magnification in a second preset magnification interval;
a second distance unit 3034, configured to determine the product of the line distance and the second magnification as the second distance between two adjacent paragraph texts.
With continued reference to fig. 7, in an embodiment, the distance determining module 303 further includes a title determining unit 3035:
the title determining unit 3035 is configured to determine whether a paragraph title is included between two adjacent paragraph texts.
In an embodiment, when the product of the line pitch and the second magnification is determined as the second pitch of two adjacent paragraph texts, the second pitch unit 3034 is configured to:
when judging that the two adjacent paragraph texts contain paragraph titles, acquiring a reference distance between the paragraph titles and the next paragraph text;
acquiring the font height of the paragraph text;
multiplying the sum of the reference distance and the character size height by a second multiplying power to obtain a second distance between two adjacent paragraph texts;
and when judging that the paragraph titles are not contained between two adjacent paragraph texts, determining the product of the line spacing and the second magnification as the second spacing of the two adjacent paragraph texts.
Referring to fig. 8, in an embodiment, the text object includes a text title and a paragraph body, the preset magnification interval is a third preset magnification interval, and the distance determining module 303 includes a third magnification unit 3036 and a third distance unit 3037:
a third multiplying power unit 3036, configured to determine a third multiplying power in a third preset multiplying power interval;
a third distance unit 3037, configured to determine the product of the line distance and the third time as the third distance between the text title and the body of the first paragraph.
It should be noted that the text display device provided in the embodiment of the present application and the text display method in the foregoing embodiment belong to the same concept, and any method provided in the text display method embodiment may be run on the text display device, and a specific implementation process thereof is described in detail in the text display method embodiment, and is not described herein again.
In the embodiment of the application, a text display request is received by a request receiving module 301; the line space obtaining module 302 obtains the line space of the text to be displayed according to the text display request; the distance determining module 303 determines a target distance for displaying the text objects in the text to be displayed according to a preset mapping relationship between the text object distance and the line distance; the text display module 304 displays text objects according to the line spacing and the target spacing. According to the method and the device for typesetting the text, the distance between the text objects is automatically adjusted according to the relation between the distance between the text objects and the line distance of the text, linkage typesetting is achieved, and therefore the efficiency of text typesetting is improved.
Embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which, when being invoked by a processor, causes the processor to perform the steps in the text display method as provided by the embodiments of the present application. The storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like.
An electronic device is further provided in the embodiments of the present application, please refer to fig. 9, and fig. 9 is a schematic structural diagram of the electronic device provided in the embodiments of the present application. The electronic device comprises a processor 401 and a memory 402. The processor 401 is electrically connected to the memory 402.
The processor 401 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by running or loading a computer program stored in the memory 402 and calling data stored in the memory 402.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by operating the computer programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
In this embodiment, the processor 401 in the electronic device loads instructions corresponding to one or more processes of the computer program into the memory 402 according to the following steps, and the processor 401 runs the computer program stored in the memory 402, so as to implement various functions, as follows:
receiving a text display request;
acquiring a line space of a text to be displayed according to the text display request;
determining a target distance for displaying text objects in a text to be displayed according to a preset mapping relation between the text object distance and the line distance;
and displaying the text object according to the line spacing and the target spacing.
Referring to fig. 10, fig. 10 is another schematic structural diagram of the electronic device according to the embodiment of the present disclosure, and the difference from the electronic device shown in fig. 9 is that the electronic device further includes components such as an input unit 403 and an output unit 404.
The input unit 403 may be used for receiving input numbers, character information, voice or user characteristic information (such as fingerprints), and generating a keyboard, a mouse, a joystick, a voice signal, an optical or trackball signal input, and the like, related to user setting and function control, among others.
The output unit 404 may be used to present information input by the user or information provided to the user, such as a screen, a recording, and the like.
In this embodiment, the processor 401 in the electronic device loads instructions corresponding to one or more processes of the computer program into the memory 402 according to the following steps, and the processor 401 runs the computer program stored in the memory 402, so as to implement various functions, as follows:
receiving a text display request;
acquiring a line space of a text to be displayed according to the text display request;
determining a target distance for displaying text objects in a text to be displayed according to a preset mapping relation between the text object distance and the line distance;
and displaying the text object according to the line spacing and the target spacing.
In an embodiment, the mapping relationship includes a magnification relationship, and before determining a target distance for displaying a text object in the text to be displayed according to a preset mapping relationship between a text object distance and a line space, the processor 401 further performs:
and acquiring a preset magnification interval corresponding to the text object interval.
In an embodiment, the text object includes a paragraph title and a paragraph body, the preset magnification interval is a first preset magnification interval, and when a target interval for displaying the text object in the text to be displayed is determined according to a preset mapping relationship between a text object interval and a line space, the processor 401 further performs:
determining a first multiplying power in a first preset multiplying power interval;
and determining the product of the line space and the first multiplying power as the first space between the paragraph title and the text of the next paragraph.
In an embodiment, the text object includes two adjacent paragraph bodies, the preset magnification interval is a second preset magnification interval, and when a target interval for displaying the text object in the text to be displayed is determined according to a mapping relationship between a preset text object interval and a line space, the processor 401 further executes:
determining a second multiplying power in a second preset multiplying power interval;
and determining the product of the line spacing and the second multiplying power as the second spacing of the texts of two adjacent paragraphs.
Wherein, whether a paragraph title is contained between two adjacent paragraph texts is judged. When the paragraph titles are judged to be contained between two adjacent paragraph texts, acquiring the reference distance between the paragraph titles and the next paragraph text, acquiring the font height of the paragraph text, and multiplying the sum of the reference distance and the font height by a second multiplying power to obtain a second distance between the two adjacent paragraph texts; and when judging that the paragraph titles are not contained between two adjacent paragraph texts, determining the product of the line spacing and the second magnification as the second spacing of the two adjacent paragraph texts.
In an embodiment, the text object includes a text title and a paragraph body, the preset magnification interval is a third preset magnification interval, and when a target interval for displaying the text object in the text to be displayed is determined according to a mapping relationship between a preset text object interval and a line space, the processor 401 further executes:
determining a third multiplying power in a third preset multiplying power interval;
the product of the line spacing and the third rate is determined as the third spacing of the text title and the body of the first paragraph.
In an embodiment, when the line space of the text to be displayed is obtained according to the text display request, the processor 401 further performs:
acquiring the font height and basic line space multiplying power of a paragraph body in a text to be displayed;
and calculating the product of the height of the character size and the multiplying power of the basic line space to obtain the line space of the text to be displayed.
It should be noted that the electronic device provided in the embodiment of the present application and the text display method in the above embodiment belong to the same concept, and any method provided in the text display method embodiment may be run on the electronic device, and a specific implementation process thereof is described in detail in the feature extraction method embodiment, and is not described herein again.
It should be noted that, for the text display method of the embodiment of the present application, it can be understood by a person skilled in the art that all or part of the process of implementing the text display method of the embodiment of the present application can be completed by controlling the relevant hardware through a computer program, the computer program can be stored in a computer readable storage medium, such as a memory of the electronic device, and executed by at least one processor in the electronic device, and the process of executing the process can include the process of the embodiment of the text display method. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, etc.
In the text display device according to the embodiment of the present application, each functional module may be integrated into one processing chip, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, or the like.
The text display method, the text display device, the text storage medium and the electronic device provided by the embodiments of the present application are described in detail above, and a specific example is applied to illustrate the principle and the implementation manner of the present application, and the description of the embodiments above is only used to help understanding the method and the core concept of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A text display method, comprising:
receiving a text display request;
acquiring the line spacing of the text to be displayed according to the text display request;
determining a target distance for displaying the text objects in the text to be displayed according to a preset mapping relation between the text object distance and the line distance;
and displaying the text object according to the line spacing and the target spacing.
2. The text display method according to claim 1, wherein the mapping relationship includes a magnification relationship, and before determining a target distance for displaying text objects in the text to be displayed according to a mapping relationship between a preset text object distance and the line space, the method further includes:
and acquiring a preset magnification interval corresponding to the text object interval.
3. The text display method according to claim 2, wherein the text object includes a paragraph title and a paragraph body, the preset magnification interval is a first preset magnification interval, and determining the target interval for displaying the text object in the text to be displayed according to a mapping relationship between a preset text object interval and the line interval includes:
determining a first multiplying power in the first preset multiplying power interval;
and determining the product of the line space and the first multiplying power as a first space between the paragraph title and the text of the first paragraph under the paragraph title.
4. The text display method according to claim 2, wherein the text object includes two adjacent paragraph bodies, the preset magnification interval is a second preset magnification interval, and determining the target interval for displaying the text object in the text to be displayed according to a mapping relationship between a preset text object interval and the line interval includes:
determining a second multiplying power in the second preset multiplying power interval;
and determining the product of the line spacing and the second multiplying power as a second spacing of the text of the two adjacent paragraphs.
5. The text display method according to claim 4, wherein before determining the product of the line space and the second magnification as the second space distance of the two adjacent paragraph texts, the method further comprises:
and judging whether paragraph titles are contained between the two adjacent paragraph texts.
6. The text display method according to claim 5, wherein the determining the product of the line space and the second magnification as the second space of the two adjacent paragraph texts comprises:
when judging that the two adjacent paragraph texts contain paragraph titles, acquiring the reference distance between the paragraph titles and the next paragraph text;
acquiring the font height of the paragraph text;
multiplying the sum of the reference distance and the character size height by the second multiplying power to obtain a second distance between two adjacent paragraph texts;
and when judging that no paragraph title is contained between the two adjacent paragraph texts, determining the product of the line spacing and the second multiplying power as a second spacing of the two adjacent paragraph texts.
7. The text display method according to claim 2, wherein the text object includes a text title and a paragraph body, the preset magnification interval is a third preset magnification interval, and determining the target interval of the text object according to the mapping relationship between the line space and the interval of the text object includes:
determining a third multiplying power in the third preset multiplying power interval;
and determining the product of the line space and the third multiplying power as the third space between the text title and the first paragraph text.
8. A text display apparatus, comprising:
the request receiving module is used for receiving a text display request;
the line space acquisition module is used for acquiring the line space of the text to be displayed according to the text display request;
the distance determining module is used for determining a target distance for displaying the text objects in the text to be displayed according to a mapping relation between a preset text object distance and the line distance;
and the text display module is used for displaying the text object according to the line spacing and the target spacing.
9. A computer-readable storage medium, having stored thereon a computer program which, when run on a computer, causes the computer to execute the text display method according to any one of claims 1 to 7.
10. An electronic device, comprising a processor and a memory, wherein the processor is electrically connected to the memory, the memory stores a computer program, and the processor executes the text display method according to any one of claims 1 to 7 by calling the computer program.
CN201910889106.4A 2019-09-19 2019-09-19 Text display method, text display device, computer readable storage medium and electronic equipment Active CN110705208B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910889106.4A CN110705208B (en) 2019-09-19 2019-09-19 Text display method, text display device, computer readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910889106.4A CN110705208B (en) 2019-09-19 2019-09-19 Text display method, text display device, computer readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN110705208A true CN110705208A (en) 2020-01-17
CN110705208B CN110705208B (en) 2023-05-02

Family

ID=69195491

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910889106.4A Active CN110705208B (en) 2019-09-19 2019-09-19 Text display method, text display device, computer readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN110705208B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445545A (en) * 2020-02-27 2020-07-24 北京大米未来科技有限公司 Text-to-map method, device, storage medium and electronic equipment
CN113111624A (en) * 2021-04-19 2021-07-13 北京字节跳动网络技术有限公司 Text display method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014012565A1 (en) * 2012-07-20 2014-01-23 Microsoft Corporation Color coding of layout structure elements in a flow format document
CN108172200A (en) * 2018-01-25 2018-06-15 腾讯科技(深圳)有限公司 A kind of method and terminal device of this display of applicating Chinese

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014012565A1 (en) * 2012-07-20 2014-01-23 Microsoft Corporation Color coding of layout structure elements in a flow format document
CN108172200A (en) * 2018-01-25 2018-06-15 腾讯科技(深圳)有限公司 A kind of method and terminal device of this display of applicating Chinese

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
边龙龙等: "利用InDesign基线网格实现书刊精确排版", 《广东印刷》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445545A (en) * 2020-02-27 2020-07-24 北京大米未来科技有限公司 Text-to-map method, device, storage medium and electronic equipment
CN111445545B (en) * 2020-02-27 2023-08-18 北京大米未来科技有限公司 Text transfer mapping method and device, storage medium and electronic equipment
CN113111624A (en) * 2021-04-19 2021-07-13 北京字节跳动网络技术有限公司 Text display method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110705208B (en) 2023-05-02

Similar Documents

Publication Publication Date Title
US8600164B2 (en) Method and tool for recognizing a hand-drawn table
US8634645B2 (en) Method and tool for recognizing a hand-drawn table
US20160275647A1 (en) Dynamic Image Presentation
US20120004898A1 (en) Contextual Input Method
US8185817B2 (en) Utilizing spreadsheet references with grouped aggregate views
US8458194B1 (en) System and method for content-based document organization and filing
US20210012547A1 (en) Glyph Weight Modification
US11934774B2 (en) Systems and methods for generating social assets from electronic publications
US20130290837A1 (en) Method and Apparatus for Correcting Document Formatting Based on Source Document
CN110705208B (en) Text display method, text display device, computer readable storage medium and electronic equipment
US20070245235A1 (en) Efficient storage of drawing objects in synchronizable electronic documents
US7146561B2 (en) Method and system in an electronic spreadsheet for comparing series of cells
CN106601256A (en) Voice recognition method and mobile terminal
KR102287149B1 (en) Electronic device that displays a separation line of a paragraph based on text line information in a pdf document and operating method thereof
US20100225667A1 (en) Content Display Method Content Display Device and Program
US6065022A (en) Scroll control for a table display
US20200265612A1 (en) Automatic patent drawings displaying device
US20180350121A1 (en) Global annotations across contents
US7243096B2 (en) Method and system in an electronic data table for managing order oriented criteria
CN114692577A (en) Content positioning method and system for text document automatic editing and process automation robot
CN113157964A (en) Method and device for searching data set through voice and electronic equipment
CN110059299B (en) Electronic book font control method and device, electronic equipment and storage medium
US11755817B2 (en) Systems for generating snap guides relative to glyphs of editable text
US20240202428A1 (en) Method, device, computer equipment and storage medium for processing pdf files
CN115422916A (en) Data access method, data access device, electronic equipment, storage medium and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant