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

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

Info

Publication number
CN110705208B
CN110705208B CN201910889106.4A CN201910889106A CN110705208B CN 110705208 B CN110705208 B CN 110705208B CN 201910889106 A CN201910889106 A CN 201910889106A CN 110705208 B CN110705208 B CN 110705208B
Authority
CN
China
Prior art keywords
text
spacing
paragraph
multiplying power
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910889106.4A
Other languages
Chinese (zh)
Other versions
CN110705208A (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

Abstract

The embodiment of the application discloses a text display method, a text display 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 a 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 objects according to the line spacing and the target spacing. According to the embodiment of the application, according to the relation between the text object spacing and the text line spacing, the spacing between the text objects is automatically adjusted, and linkage typesetting is realized, so that the efficiency of text typesetting is improved.

Description

Text display method, text display device, computer readable storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of electronic technologies, and in particular, to a text display method, a text display device, a computer readable storage medium, and an electronic device.
Background
With the development of technology, electronic devices such as computers and smart phones have become an indispensable tool in daily life, study and work. In order to make the text typesetting in these electronic devices as beautiful as possible, the text typesetting is usually adjusted on the electronic device to achieve the desired typesetting mode. However, when adjusting the text typesetting, it is generally necessary to manually adjust various pitches, which is troublesome to operate and has low typesetting efficiency.
Disclosure of Invention
The embodiment of the application provides a text display method, a text display device, a computer readable storage medium and electronic equipment, which can improve the text typesetting efficiency.
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 a line space of a 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 row spacing and the target spacing.
In a second aspect, embodiments of the present application provide a text display device, 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 interval determining module is used for determining a target interval for displaying the text objects in the text to be displayed according to a preset mapping relation between the text object interval and the line interval;
and the text display module is used for displaying the text objects according to the row spacing and the target spacing.
In a third aspect, embodiments of the present application provide a storage medium having stored thereon a computer program which, when run on a computer, causes the computer to perform a text display method as provided by embodiments of the present application.
In a fourth aspect, an embodiment of the present application provides an electronic device, including 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 a text display method provided in the embodiment of the present application by calling the computer program.
According to the embodiment of the application, according to the relation between the text object spacing and the text line spacing, the spacing between the text objects is automatically adjusted, and linkage typesetting is realized, so that the efficiency of text typesetting is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a text display method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of text to be displayed in the text display method provided in the embodiment of the present application.
Fig. 3 is another flow chart of a text display method according to an embodiment of the present application.
Fig. 4 is a schematic diagram 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 the text display device provided in the embodiment of the present application.
Fig. 6 is a schematic diagram of a third structure of the text display device according to the embodiment of the present application.
Fig. 7 is a fourth structural schematic diagram of the text display device provided in the embodiment of the present application.
Fig. 8 is a fifth structural diagram of the text display device provided in the embodiment of the present application.
Fig. 9 is a schematic structural diagram of an electronic device according to 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 throughout, the principles of the present application are illustrated as being implemented in a suitable computing environment. The following description is based on the illustrated embodiments of the present application and should not be taken as limiting other embodiments not described in detail herein.
The embodiment of the application firstly provides a text display method which is applied to electronic equipment. The execution main body of the text display method may be a 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 configured with a processor and having a processing capability, 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 of a text display method according to an embodiment of the present application. 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, receiving a text display request.
Where text refers to a representation of a written language, the text may include sentences, paragraphs, articles, or 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 typeset the text in the application so that the text achieves a preset display effect.
In addition, text may be typeset by a developer at the development interface of the electronic device, for example, text that we see directly when entering the "setup" application is already typeset by the developer at the time of development.
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 typesetting and display on the interface of the electronic equipment. The text to be displayed may include a body and a title, wherein the title may include a large title, a subtitle, 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 the text display method according to the embodiment of the present application. The text to be displayed contains 1 large title (text title), 2 sub-titles (paragraph title) and 3 paragraph texts. In this embodiment of the present application, the line space of the text to be displayed obtained according to the text display request refers to the line space of the text (excluding the title) in the paragraph text in the text to be displayed.
With continued reference to fig. 2, in an embodiment, when typesetting text, a line distance of a text to be displayed, which is obtained according to a text display request, may also be a distance between text bases of two adjacent lines of text in the same text paragraph, i.e. a in fig. 2, is utilized to typeset text of a line Ji Tong. The line spacing of the text to be displayed can be obtained by measuring the distance between the text base lines of two adjacent texts in the same paragraph of text.
Or, since 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 a 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 may be further divided into primary titles, secondary titles, tertiary titles, etc. according to the number of title levels included in the text to be displayed. In this embodiment of the present application, the number of levels of the title is not limited, and the title may be divided according to the number of levels of the title actually included in the text to be displayed.
Where the text may appear in the form of paragraphs, the text of each paragraph is also referred to as paragraph text when the text appears in the form of a paragraph. For paragraph text, there may be paragraph titles to summarize the content of one or more paragraph text. Each paragraph title may correspond to one or more paragraph texts and be displayed above all paragraph texts to which it corresponds. Dividing the text of each paragraph by the corresponding paragraph title, wherein the text of the paragraph corresponding to the same paragraph title is the text of the same group of paragraphs.
With continued reference to fig. 2, in one embodiment, the text object in the text to be displayed includes 1 primary title, 2 secondary titles and 3 paragraph texts, where the primary title is the title of the entire text to be displayed and may be referred to as a text title; the secondary title is a title summarizing the text content of the paragraph and may be referred to as a paragraph title. The 2 paragraph texts from top to bottom can be sequentially called a first paragraph text, a second paragraph text and a third paragraph text.
Wherein the first paragraph text has a paragraph title 1, and the second and third paragraph texts have a paragraph title 2, so that the second and third paragraph texts corresponding to the paragraph title 2 are the same group of paragraph texts.
Taking several text objects as shown in fig. 2 as an example, some distance parameters involved in typesetting text to be displayed may include:
a: the distance between two rows of adjacent characters in the same paragraph of text;
a: line spacing, i.e., the distance between the base lines of two adjacent characters in the same paragraph body;
b: the distance between the paragraph title and the text of the following paragraph is also called as the first distance;
c: the spacing between two adjacent paragraph text, also referred to as the second spacing;
d: the distance of the text header from the body of the first paragraph, also called the third distance.
The distance a between two rows of adjacent characters can be obtained directly by measurement or obtained by subtracting the character size height x from the row spacing A; the row spacing a can be obtained by the method described above; the text object distances b, c and d can be determined according to a preset mapping relation between the text object distances and the line distances.
In an embodiment, a target distance between text objects in a text to be displayed determined according to a preset mapping relationship between a text object distance and a line distance satisfies: the third distance d between the text title and the first paragraph text is larger than the second distance c between the two adjacent paragraph texts is larger than the first distance b between the paragraph title and the next paragraph text, and the distance a between the two adjacent texts in the same paragraph text is larger than the first distance b between the two adjacent texts, so that the typesetting effect of the text to be displayed looks neat and attractive.
The mapping relation between the preset text object distance and the line distance can be stored in a text processing database in a form of a table, and when the line distance A of the text to be displayed is adjusted by a user, the terminal obtains the mapping relation between the preset text object distance and the line distance from the text processing database, and determines the target distance for displaying the text object in the text to be displayed according to the mapping relation between the preset text object distance and the line distance.
In an embodiment, when the line space a of the text to be displayed is adjusted, the value of the line space a is obtained, and the target distance, i.e., the first distance b, is determined according to the mapping relationship between the first distance b and the line space a, so that when the line space a is adjusted by a user, the first distance b between the paragraph title and the text of the subsequent paragraph is correspondingly changed.
In an embodiment, when the line space a of the text to be displayed is adjusted, the value of the line space a is obtained, and the target distance, namely the second distance c, is determined according to the mapping relationship between the second distance c and the line space a, so that when the user adjusts the line space a, the second distance c of the text of two adjacent paragraphs is correspondingly changed.
In an embodiment, when the line space a of the text to be displayed is adjusted, the value of the line space a is obtained, and according to the mapping relationship between the third space d and the line space a, the determined target space is the third space d, so that when the line space a is adjusted by the user, the third space d between the text title and the text of the first paragraph is correspondingly changed.
Or when the line space A of the text to be displayed is adjusted, acquiring the value of the line space A, and determining the first interval b, the second interval c and the third interval d according to the mapping relation between the first interval b and the line space A, the mapping relation between the second interval c and the line space A and the mapping relation between the third interval d and the line space A, so that when the line space A is adjusted by a user, the first interval b between the paragraph title and the text of the next paragraph, the second interval c between the two adjacent paragraphs and the third interval d between the text title and the first paragraph are correspondingly changed, and the linkage typesetting effect is achieved.
Preferably, the preset mapping relationship between the text object distance and the line distance may be a multiplying power relationship. And the corresponding multiplying power of the spaces between different text objects is different, so that the third space d between the text title and the first paragraph text is larger than the second space c between the two adjacent paragraph texts, and the first space b between the paragraph title and the subsequent paragraph text is larger than the space a between the two adjacent texts in the same paragraph text, thereby achieving attractive typesetting effect.
In one embodiment, when a paragraph title is included between two adjacent paragraph texts, a reference distance (i.e., a first distance b) between the paragraph title and a subsequent paragraph text is obtained, a word size height x of the paragraph text is obtained, and a product obtained by multiplying a sum of the reference distance and the word size height by a second multiplying factor is used as a second distance C between the 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 a text title and content other than the text title in the text.
104, displaying the text objects according to the line spacing and the target spacing.
After 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, displaying the text objects in the text to be displayed according to the target distance, wherein the line distance of a paragraph text is displayed according to the adjusted line distance A, and the distances of positions corresponding to the target distances b, c and/or d are displayed according to the numerical value 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 a 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 objects according to the line spacing and the target spacing. According to the embodiment of the application, according to the relation between the text object spacing and the text line spacing, the spacing between the text objects is automatically adjusted, and linkage typesetting is realized, so that the efficiency of text typesetting is improved.
Referring to fig. 3, fig. 3 is another flow chart of the text display method according to the embodiment of the present application. In the embodiment of the present application, taking a preset mapping relationship between a text object distance and a line distance as an example for describing a multiplying factor relationship, the text display method is applied to the electronic device provided in the embodiment of the present application, and the flow of the text display method may include:
201. a text display request is received.
Where text refers to a representation of a written language, the text may include sentences, paragraphs, articles, or 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 typeset the text in the application so that the text achieves a preset display effect.
In addition, text may be typeset by a developer at the development interface of the electronic device, for example, text that we see directly when entering the "setup" application is already typeset by the developer at the time of development.
202. And acquiring the word size height x and the basic line space multiplying power y of the falling 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=y x of the text to be displayed.
In setting the line space of the text, the line space may be set directly, for example, the line space is set to a fixed value of 24 pounds; the line space can also be set by setting the line space and line space magnification, so that when the line space and line space magnification are changed, the line space is correspondingly changed. The character sizes refer to the sizes of characters, and different character sizes correspond to different character heights. The base line space magnification may be set to 1.0 times, 1.5 times, etc. When the basic line spacing multiplying power is 1.0 times, the line spacing of the text of the paragraph is equal to the distance between the baselines of two adjacent characters in the text of the paragraph, and the distance between the baselines is equal to the character size height x of the text of the paragraph; when the basic line spacing multiplying power is 1.5 times, the line spacing of the text of the paragraph is equal to 1.5 times of the distance between the baselines of two adjacent characters in the text of the paragraph.
Therefore, when the line space is set by setting the line space and the line space multiplying power, the line space can be determined by setting the line space height x corresponding to the line space set by the text falling in the text to be displayed and the basic line space multiplying power y, and the calculation mode is as follows: row spacing a=y×x.
204. And determining the first preset multiplying power interval to be 0.4-0.5.
205. The first interval b=0.4a to 0.5A between the paragraph title and the body of the following paragraph is determined.
206. And determining the second preset multiplying power interval to be 0.75-1.25.
207. A second spacing c=0.75a to 1.25A of the bodies of two adjacent paragraphs is determined.
208. And determining the third preset multiplying power interval to be 0.9-1.625.
209. A third distance d=0.9a-1.625A between the text header and the body of the first paragraph is determined.
In an embodiment, a target distance for displaying text objects in a text to be displayed is determined according to a preset mapping relationship between text object distance and line distance. Taking the mapping relationship as a multiplying power relationship as an example, the multiplying power between the target pitch and the row pitch a may not be a specific numerical value, but a preset multiplying power interval.
For example, when the target distance is the first distance b between the paragraph title and the text of the following paragraph, the first preset multiplying power interval is corresponding to 0.4-0.5; when the target interval is the second interval c of the text of two adjacent paragraphs, the interval corresponding to the second preset multiplying power is 0.75-1.25; and when the target distance is a third distance d between the text title and the text of the first paragraph, the target distance corresponds to a third preset multiplying power interval of 0.9-1.625.
Therefore, when the value of the first interval b is determined, the first multiplying power can be determined in the first preset multiplying power interval, and the product of the line interval A and the first multiplying power is determined as the first interval b between the paragraph title and the text of the following paragraph. For example, if the first magnification is determined to be 0.45 from the first preset magnification interval 0.4 to 0.5, the first pitch b=0.45A may be determined.
When the value of the second interval c is determined, a second multiplying power can be determined in a second preset multiplying power interval, and the product of the line interval A and the second multiplying power is determined as the second interval c of two adjacent paragraph texts. For example, when the second magnification 1 is determined from the second preset magnification interval 0.75 to 1.25, the second pitch b=a may be determined.
When determining the value of the third interval d, a third multiplying power can be determined in a third preset multiplying power interval, and the product of the line interval A and the third multiplying power is determined as the third interval d between the paragraph title and the first paragraph text under the paragraph title. For example, if the third multiplying factor of 1.5 is determined from the third preset multiplying factor interval of 0.9 to 1.625, the third interval b=1.5a may be determined.
In an embodiment, the third spacing d is actually varied according to the second spacing c: d=1.2c to 1.3c, and the second pitch c varies according to the line pitch a: c=0.75a to 1.25A, and thus, after combining the two mapping relationships, it is determined that the mapping relationship of the third pitch d changing with the row pitch a is: d=0.9a to 1.625A.
In an embodiment, in order to satisfy that the third distance d between the text header and the first paragraph text is greater than the second distance c between the two adjacent paragraph texts, the first distance b between the paragraph header and the next paragraph text is greater than the distance a between the two adjacent texts in the same paragraph text, so that the typesetting effect of the text to be displayed looks neat and attractive, the mapping relationship of the third distance d is further defined as d=1.25a-1.625A. Therefore, the above-described size relationship can be satisfied regardless of how the first pitch b, the second pitch c, and the third pitch d take values in the respective mapping relationships.
The first pitch b may be changed only by the row pitch a, the second pitch c may be changed only by the row pitch a, and the third pitch d may be changed only by the row pitch a. Alternatively, the first pitch b, the second pitch c, and the third pitch d may be changed synchronously according to the line pitch a.
210. Text objects are displayed according to the row spacing A, the first spacing b, the second spacing c and the third spacing d.
After the target distances b, c and d for displaying the text objects in the text to be displayed are determined according to the preset mapping relation b=0.4A-0. A, c =0.75A-1.25A and d=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 value determined according to the mapping relation, and the line distance of the text of the paragraph is displayed according to the adjusted line distance A.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and the portions of a certain embodiment that are not described in detail may be referred to the detailed description of the page processing method above, which is not repeated herein.
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 a 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 objects according to the line spacing and the target spacing. According to the embodiment of the application, according to the relation between the text object spacing and the text line spacing, the spacing between the text objects is automatically adjusted, and linkage typesetting is realized, so that 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 schematic diagram of a first structure of a text display device according to an embodiment of the present application. The text display device 300 is applied to an electronic device, and the electronic device comprises a plurality of cameras, and the text display device comprises a request receiving module 301, a line spacing obtaining module 302, a spacing determining module 303 and a text display module 304, and is as follows:
a request receiving module 301, configured to receive a text display request;
the line space obtaining module 302 is configured to obtain a line space of a text to be displayed according to a text display request;
the distance determining module 303 is configured to determine a target distance for displaying text objects in the text to be displayed according to a preset mapping relationship between text object distances and line distances;
the text display module 304 is configured to display text objects according to the line spacing and the target spacing.
When acquiring a line space of a text to be displayed according to a text display request, the line space acquiring module 302 may be configured to:
acquiring the word size height and the basic line space multiplying power of a text falling in the text to be displayed;
and calculating the product of the word size height and the basic line space multiplying power 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:
the multiplying power obtaining module 305 is configured to obtain a preset multiplying power interval corresponding to the text object distance.
With continued reference 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 pitch determining module 303 includes a first magnification unit 3031 and a first pitch unit 3032:
a first multiplying power unit 3031, configured to determine a first multiplying power in a first preset multiplying power interval;
a first spacing unit 3032 is configured to determine a product of the line spacing and the first multiplying factor as a first spacing between the paragraph header and the text of the following paragraph.
Referring to fig. 7, in an embodiment, the text object includes two adjacent paragraph bodies, the preset magnification interval is a second preset magnification interval, and the interval determining module 303 includes a second magnification unit 3033 and
second spacing unit 3034:
a second multiplying power unit 3033, configured to determine a second multiplying power in a second preset multiplying power interval;
a second spacing unit 3034 is configured to determine a product of the row spacing and the second magnification as a second spacing of two adjacent paragraphs text.
With continued reference to fig. 7, in one embodiment, the interval determining module 303 further includes a header determining unit 3035:
the title determining unit 3035 is configured to determine whether a paragraph title is included between two adjacent paragraph text.
In an embodiment, when determining the product of the line spacing and the second magnification as the second spacing of the two adjacent paragraph bodies, the second spacing unit 3034 is configured to:
when judging that the paragraph titles are contained between two adjacent paragraph texts, acquiring the reference distance between the paragraph titles and the next paragraph text;
acquiring the word size height of the text of the paragraph;
multiplying the sum of the reference space and the word size height by a second multiplying power to obtain a second space between two adjacent paragraph texts;
and when judging that the paragraph titles are not contained between the two adjacent paragraph texts, determining the product of the line spacing and the second multiplying power as the second spacing between the two adjacent paragraph texts.
With continued reference to fig. 8, in an embodiment, the text object includes a text header and a paragraph body, the preset magnification interval is a third preset magnification interval, and the pitch determining module 303 includes a third magnification unit 3036 and a third pitch unit 3037:
a third multiplying factor unit 3036, configured to determine a third multiplying factor in a third preset multiplying factor interval;
a third spacing unit 3037 is configured to determine a product of the line spacing and the third rate as a third spacing between the text header 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 above embodiment belong to the same concept, and any method provided in the embodiment of the text display method may be run on the text display device, and detailed implementation processes of the method are shown in the embodiment of the text display method, which is not repeated herein.
The text display request is received by the request receiving module 301; the line space acquisition module 302 acquires 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 text objects in the text to be displayed according to a preset mapping relation between the text object distance and the line distance; text display module 304 displays text objects at line spacing and target spacing. According to the embodiment of the application, according to the relation between the text object spacing and the text line spacing, the spacing between the text objects is automatically adjusted, and linkage typesetting is realized, so that the efficiency of text typesetting is improved.
The present embodiments provide a computer-readable storage medium having stored thereon a computer program which, when invoked by a processor, causes the processor to perform the steps of 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 (Random Access Memory, RAM), or the like.
An embodiment of the present application further provides an electronic device, please refer to fig. 9, and fig. 9 is a schematic structural diagram of the electronic device provided in the embodiment 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 computer programs 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 running the computer programs and modules stored in the memory 402. The memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, a computer program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, 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 with access to the memory 402.
In the embodiment of the present application, the processor 401 in the electronic device loads the instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 executes the computer programs 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 a 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 objects according to the line spacing and the target spacing.
Referring to fig. 10, fig. 10 is another schematic structural diagram of an electronic device according to an embodiment of the present application, which is different from the electronic device shown in fig. 9 in that the electronic device further includes an input unit 403, an output unit 404, and other components.
The input unit 403 may be used to receive input numbers, character information, sound, or user characteristic information (such as fingerprint), and to generate a keyboard, a mouse, a joystick, a sound signal, an optical or track ball signal input, etc. related to user settings and function control.
The output unit 404 may be used to present information entered by the user or information provided to the user, such as a screen, a recording, etc.
In the embodiment of the present application, the processor 401 in the electronic device loads the instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 executes the computer programs 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 a 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 objects according to the line spacing and the target spacing.
In an embodiment, the mapping relationship includes a magnification relationship, and before determining the target distance for displaying the text object in the text to be displayed according to the preset mapping relationship between the text object distance and the line distance, the processor 401 further executes:
and acquiring a preset multiplying power interval corresponding to the text object distance.
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 determining the target distance for displaying the text object in the text to be displayed according to the mapping relationship between the preset text object distance and the line distance, the processor 401 further executes:
determining a first multiplying power in a first preset multiplying power interval;
the product of the line spacing and the first multiplying power is determined as the first spacing between the paragraph title and the text of the following paragraph.
In an embodiment, the text object includes two adjacent paragraph text, the preset magnification interval is a second preset magnification interval, and when determining the target distance for displaying the text object in the text to be displayed according to the mapping relationship between the preset text object distance and the line distance, 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 text of two adjacent paragraphs.
And judging whether a paragraph title is contained between two adjacent paragraph texts. When judging that the paragraph titles are contained between two adjacent paragraph texts, acquiring a reference distance between the paragraph titles and a subsequent paragraph text, acquiring the word size height of the paragraph text, and multiplying the sum of the reference distance and the word size 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 the two adjacent paragraph texts, determining the product of the line spacing and the second multiplying power as the second spacing between the two adjacent paragraph texts.
In an embodiment, the text object includes a text title and a paragraph text, the preset magnification interval is a third preset magnification interval, and when determining the target distance for displaying the text object in the text to be displayed according to the mapping relationship between the preset text object distance and the line distance, 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 header from the body of the first paragraph.
In an embodiment, when acquiring the line space of the text to be displayed according to the text display request, the processor 401 further performs:
acquiring the word size height and the basic line space multiplying power of a text falling in the text to be displayed;
and calculating the product of the word size height and the basic line space multiplying power 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 foregoing embodiments belong to the same concept, and any method provided in the text display method embodiment may be run on the electronic device, and detailed implementation processes of the method are shown in the feature extraction method embodiment, which is not repeated herein.
It should be noted that, for the text display method of the embodiment of the present application, it will be understood by those skilled in the art that all or part of the process of implementing the text display method of the embodiment of the present application may be implemented by controlling related hardware by a computer program, where the computer program may be stored in a computer readable storage medium, such as a memory of an electronic device, and executed by at least one processor in the electronic device, and the execution may include the process of implementing 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.
For the text display device in the embodiment of the present application, each functional module may be integrated in one processing chip, or each module may exist alone physically, or two or more modules may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules, if implemented as software functional modules and sold or used as a stand-alone product, may also be stored on a computer readable storage medium such as read-only memory, magnetic or optical disk, etc.
The foregoing describes in detail a text display method, apparatus, storage medium and electronic device provided in the embodiments of the present application, and specific examples are applied to illustrate the principles and embodiments of the present application, where the foregoing examples are only used to help understand the method and core idea of the present application; meanwhile, as those skilled in the art will vary in the specific embodiments and application scope according to the ideas of the present application, the contents of the present specification should not be construed as limiting the present application in summary.

Claims (6)

1. A text display method, comprising:
receiving a text display request;
acquiring a line space of a text to be displayed according to the text display request;
acquiring a first preset multiplying power interval corresponding to the text object distance;
determining a first multiplying power in the first preset multiplying power interval;
determining the product of the line spacing and the first multiplying power as a first spacing for displaying a paragraph title included in a text object in the text to be displayed and a first paragraph text under the paragraph title;
displaying the text objects according to the row spacing and the first spacing;
or, acquiring a second preset multiplying power interval corresponding to the text object distance;
determining a second multiplying power in the second preset multiplying power interval;
determining the product of the line spacing and the second multiplying power as a second spacing for displaying two adjacent paragraph texts included by the text object in the text to be displayed;
displaying the text objects according to the row spacing and the second spacing;
or, acquiring a second preset multiplying power interval corresponding to the text object distance;
determining a third multiplying power in the third preset multiplying power interval;
determining the product of the line spacing and the third multiplying power as a third spacing for displaying a text title and a first paragraph body included in the text object in the text to be displayed;
and displaying the text object according to the row spacing and the third spacing.
2. The text display method according to claim 1, wherein before determining the product of the line spacing and the second magnification as the second spacing for displaying the two adjacent paragraph bodies included in the text object in the text to be displayed, further comprising:
and judging whether the paragraph titles are contained between the two adjacent paragraph texts.
3. The text display method according to claim 2, wherein the determining the product of the line space and the second magnification as the second space for displaying two adjacent paragraph pieces of text included in the text object in the text to be displayed includes:
when judging that the paragraph titles are contained between the two adjacent paragraph texts, acquiring the reference distance between the paragraph titles and the next paragraph text;
acquiring the word size height of the text of the paragraph;
multiplying the sum of the reference space and the word size height by the second multiplying power to obtain a second space between two adjacent paragraph texts;
and when judging that the paragraph titles are not contained between the two adjacent paragraph texts, determining the product of the line spacing and the second multiplying power as the second spacing of the two adjacent paragraph texts.
4. A text display device, 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 interval determining module is used for acquiring a first preset multiplying power interval corresponding to the interval of the text objects; determining a first multiplying power in the first preset multiplying power interval; determining the product of the line spacing and the first multiplying power as a first spacing for displaying a paragraph title included in a text object in the text to be displayed and a first paragraph text under the paragraph title;
the text display module is used for displaying the text objects according to the row spacing and the first spacing;
or the interval determining module is used for acquiring a second preset multiplying power interval corresponding to the interval of the text object; determining a second multiplying power in the second preset multiplying power interval; determining the product of the line spacing and the second multiplying power as a second spacing for displaying two adjacent paragraph texts included by the text object in the text to be displayed;
the text display module is used for displaying the text objects according to the row spacing and the second spacing;
or the interval determining module is used for acquiring a second preset multiplying power interval corresponding to the interval of the text object; determining a third multiplying power in the third preset multiplying power interval; determining the product of the line spacing and the third multiplying power as a third spacing for displaying a text title and a first paragraph body included in the text object in the text to be displayed;
and the text display module is used for displaying the text objects according to the row spacing and the third spacing.
5. A computer-readable storage medium, having stored thereon a computer program which, when run on a computer, causes the computer to perform the text display method according to any one of claims 1 to 3.
6. An electronic device comprising a processor and a memory, the processor being electrically connected to the memory, the memory storing a computer program, the processor executing the text display method according to any one of claims 1 to 3 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 CN110705208A (en) 2020-01-17
CN110705208B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445545B (en) * 2020-02-27 2023-08-18 北京大米未来科技有限公司 Text transfer mapping method and device, storage medium and electronic equipment
CN113111624B (en) * 2021-04-19 2023-04-18 抖音视界有限公司 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基线网格实现书刊精确排版;边龙龙等;《广东印刷》;20180820(第04期);全文 *

Also Published As

Publication number Publication date
CN110705208A (en) 2020-01-17

Similar Documents

Publication Publication Date Title
US20090245654A1 (en) Method And Tool For Recognizing A Hand-Drawn Table
US10318629B2 (en) Adaptive content rendering for optimizing page layout
EP2483770A2 (en) Dynamic image presentation
CN110705208B (en) Text display method, text display device, computer readable storage medium and electronic equipment
US11934774B2 (en) Systems and methods for generating social assets from electronic publications
JP2021124810A (en) Content creation support system
US7280693B2 (en) Document information input apparatus, document information input method, document information input program and recording medium
US6065022A (en) Scroll control for a table display
US20120102385A1 (en) Determining heights of table cells
CN113741753A (en) Revocation method, electronic device, storage medium, and computer program product
US20200265612A1 (en) Automatic patent drawings displaying device
US9626067B2 (en) Modifying positions of on-canvas objects
US20040044964A1 (en) Behavior of anchored frames
CN112329409A (en) Cell color conversion method and device and electronic equipment
CN115390976A (en) Layout method of interface design, display method of interface and related equipment
CN115016686A (en) File selection method and device, electronic equipment and readable storage medium
EP3929871A1 (en) Picture processing method, picture set processing method, computer device, and storage medium
CN111444452A (en) Conversion method, device and storage medium of webpage
US20040249852A1 (en) Method and system in an electronic data table for managing order oriented criterias
AU2016380716B2 (en) Method and apparatus for recognizing slide
US8810580B2 (en) Method and tool for creating irregular-shaped tables
CN111079771A (en) Method and system for extracting characteristics of click-to-read image, terminal device and storage medium
KR102545260B1 (en) Electronic terminal apparatus that supports application of natural substitute fonts when loading electronic documents with unsupported fonts applied and operating method thereof
KR102266073B1 (en) Electronic device that controls the efficient loading of each sheet that makes up a spreadsheet document based on a multi-thread and operating method thereof
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