Invention content
To solve the above-mentioned problems, the embodiment of the invention discloses it is a kind of adjust paragraph spacing method and device, specifically
Technical solution is as follows:
A kind of method for adjusting paragraph spacing, including:
Obtain the line space value between at least two rows in destination document;
Acquired line space value is counted, it is more than the line space of preset accounting threshold value to judge whether accounting
Value determines the line space characteristic value of the destination document according to judging result;Wherein, it is described that the mesh is determined according to judging result
The line space characteristic value of document is marked, including:In the case where the judgment result is yes, it is more than the row of preset accounting threshold value by accounting
Distance values are determined as line space characteristic value;
According to the line space characteristic value and preset target phase distance values computation rule, target phase distance values are calculated;
Paragraph spacing between at least two paragraphs in the destination document is adjusted to the target phase distance values, is obtained
New paragraph display effect.
Optionally, the line space characteristic value that the destination document is determined according to judging result, further includes:
In the case where judging result is no, the average value of acquired line space value is calculated, is averaged what is be calculated
Value is determined as line space characteristic value.
Optionally, the method further includes:
The new paragraph display effect is preserved.
Optionally, the line space value obtained in destination document between at least two rows, including:
Obtain the line space value of the full text of destination document;
Or
The line space value of the preceding M rows of current display page in destination document is obtained, wherein, M is more than 1, and aobvious less than current
Show total line number of the page.
Optionally, it is described according to the line space characteristic value and preset target phase distance values computation rule, calculate mesh
Bid section distance values, including:
According to the line space characteristic value and calculation formula:Target phase distance values=line space characteristic value * α, calculate mesh
Bid section distance values, wherein, α is preset quantizing factor, and α>1.
Optionally, the paragraph spacing by between at least two paragraphs in the destination document is adjusted to the target phase
Distance values obtain new paragraph display effect, including:
Obtain the paragraph distance values between each paragraph in destination document;
The spacing only paragraph distance values in destination document being more than between two paragraphs of the target phase distance values adjusts
For the target phase distance values, new paragraph display effect is obtained.
Optionally, that the paragraph spacing between at least two paragraphs in the destination document is adjusted to the target is intersegmental
Away from value, before obtaining new paragraph display effect, further include:
It is shown to user for asking whether to allow the prompt message being adjusted to paragraph spacing, and is receiving user
Allow adjustment operate after, triggering perform the paragraph spacing by between at least two paragraphs in the destination document be adjusted to
The target phase distance values, the step of obtaining new paragraph display effect.
A kind of device for adjusting paragraph spacing, including:
Line space value acquisition module, for obtaining the line space value in destination document between at least two rows;
Judgment module, the line space value for being obtained to the line space value acquisition module count, judge whether to deposit
It is more than the line space value of preset accounting threshold value in accounting;
Line space characteristic value determining module, for determining the destination document according to the judging result of the judgment module
Line space characteristic value;Wherein, the line space characteristic value determining module, is specifically used for:In the judging result of the judgment module
In the case of being, the line space value for by accounting being more than preset accounting threshold value is determined as line space characteristic value;
Target phase distance values computing module, for the line space feature determined according to the line space characteristic value determining module
Value and preset target phase distance values computation rule, calculate target phase distance values;
Paragraph spacing adjusts module, for the paragraph spacing between at least two paragraphs in the destination document to be adjusted to
The target phase distance values obtain new paragraph display effect.
Optionally, the line space characteristic value determining module, is specifically additionally operable to:
In the case where the judging result of the judgment module is no, the average value of acquired line space value is calculated, it will
The average value being calculated is determined as line space characteristic value.
Optionally, described device further includes:
Preserving module is protected for paragraph display effect adjusted to paragraph spacing adjustment module, new
It deposits.
Optionally, the line space value acquisition module, is specifically used for:
Obtain the line space value of the full text of destination document;
Or
The line space value of the preceding M rows of current display page in destination document is obtained, wherein, M is more than 1, and aobvious less than current
Show total line number of the page.
Optionally, the target phase distance values computing module, is specifically used for:
The line space characteristic value and calculation formula determined according to the line space characteristic value determining module:
Target phase distance values=line space characteristic value * α, calculate target phase distance values, wherein, α for preset quantization because
Son, and α>1.
Optionally, the paragraph spacing adjustment module, including:
Paragraph distance values acquisition submodule, for obtaining the paragraph distance values in destination document between each paragraph;
Paragraph spacing adjusts submodule, for paragraph distance values in destination document only to be more than the target phase distance values
Spacing between two paragraphs is adjusted to the target phase distance values, obtains new paragraph display effect.
Optionally, described device further includes:
Prompt message display module, for showing to ask whether to allow to carry to what paragraph spacing was adjusted to user
Show information, and receive user adjustment is allowed to operate after, trigger the paragraph spacing adjustment module and perform:By the target
Paragraph spacing in document between at least two paragraphs is adjusted to the target phase distance values, obtains new paragraph display effect
Operation.
Using above-mentioned technical proposal, the method and device of adjustment paragraph spacing provided in an embodiment of the present invention is obtaining mesh
After marking the line space value in document between at least two rows, acquired line space value can be counted, judge whether to deposit
It is more than the line space value of preset accounting threshold value in accounting, the line space feature of the destination document is determined according to judging result
Value;Further according to the line space characteristic value and preset target phase distance values computation rule, target phase distance values are calculated,
And the paragraph spacing between at least two paragraphs in the destination document is adjusted to the target phase distance values, it is new so as to obtain
, convenient for user read paragraph display effect.
Compared with prior art, the embodiment of the present invention can automatically will be between two excessive paragraphs of blank in document
Paragraph spacing is adjusted to the paragraph distance values that user is suitble to read, and overcome caused by user's manual operation cumbersome lacks
Point, efficiency are higher.
Specific embodiment
In order to which those skilled in the art is made to more fully understand the technical solution in the present invention, implement below in conjunction with the present invention
Attached drawing in example, is clearly and completely described the technical solution in the embodiment of the present invention, it is clear that described embodiment
Only part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, the common skill in this field
Art personnel all other embodiments obtained without creative efforts belong to the model that the present invention protects
It encloses.
With the rapid development of terminal technology, the function of electronic equipment is become stronger day by day, and more and more user's selections are in electricity
Reading documents in sub- equipment, such as user's reading documents on computer or smart mobile phone.For there are more blank between paragraph
Document needs the paragraph spacing of the document being adjusted to the section distance values that user is suitble to read.
At present, the method for adjustment document segment spacing is mainly:User's manual setting and the relevant every ginseng of paragraph spacing
Number, to complete the adjustment to the paragraph spacing of document.However, due to every adjustment for carrying out a paragraph spacing, it is necessary to manually
Setting and the relevant parameters of paragraph spacing, therefore, operation is comparatively laborious, less efficient.To solve the above-mentioned problems, this hair
Bright embodiment provides a kind of method and device for adjusting paragraph spacing.
A kind of method for adjusting paragraph spacing provided in an embodiment of the present invention is introduced first below.
As shown in Figure 1, a kind of method for adjusting paragraph spacing provided in an embodiment of the present invention, can include:
S101 obtains the line space value between at least two rows in destination document;
Specifically, in one embodiment of the invention, above-mentioned S101 can include:
Obtain the line space value of the full text of destination document;
Or
The line space value of the preceding M rows of current display page in destination document is obtained, wherein, M is more than 1, and aobvious less than current
Show total line number of the page;For example the arbitrary multirow such as preceding 10 row of current display page, preceding 100 row in destination document can be obtained.
In addition it is also possible to the preceding N rows of the arbitrary page, I row to J rows etc. in destination document are obtained, wherein, N is more than
1, (J-I) is more than 1.
S102 counts acquired line space value, and it is more than preset accounting threshold value to judge whether accounting
Line space value determines the line space characteristic value of the destination document according to judging result.Specifically, in the implementation of the present invention
In example, as shown in Fig. 2, above-mentioned S102, can include:
S102a counts acquired line space value, and it is more than preset accounting threshold value to judge whether accounting
Line space value;In the case where the judgment result is yes, triggering performs S102b, and in the case where judging result is no, triggering performs
S102c。
Such as a total of 8 pages of destination document, this obtains the line space of preceding 11 row in the first page of the destination document
Value, can obtain 10 line space values;Corresponding value size is respectively:a、a、a、a、a、a、a、a、b、b;
After being counted to above-mentioned 10 line space values, find:Line space value a total of 8 of the size for a, size b
A total of 2 of line space value;Further, the accounting value for the line space value that size is a is (8/10) * 100%=80%, greatly
The accounting value of the small line space value for being b is (2/10) * 100%=20%.
Further, judge the line space value that accounting value, the size of the line space value that size is a are b accounting value whether
Which step performed to decide to continue with more than preset accounting threshold value, and then according to judging result.
It should be noted that under normal conditions, it is 70% to be empirically worth preset accounting threshold definitions, certainly,
Can be 60%, 80% etc. by preset accounting threshold definitions, the embodiment of the present invention does not limit this according to actual conditions
It is fixed.
S102b, the line space value for by accounting being more than preset accounting threshold value are determined as line space characteristic value.
At this time, it is assumed that preset accounting threshold value is 70%, since the accounting value 80% for the line space value that size is a is more than in advance
If accounting threshold value 70%, therefore, line space value a is determined as line space characteristic value.
S102c calculates the average value of acquired line space value, the average value being calculated is determined as line space feature
Value.
At this time, it is assumed that preset accounting threshold value is 80%, due to accounting value 80%, the size of line space value that size is a
The accounting value 20% of line space value for b is respectively less than preset accounting threshold value 80%, therefore, calculates above-mentioned 10 line space values
Average value A=(a*8+b*2)/10;
Further, average value A=(a*8+b*2)/10 is determined as line space characteristic value.
According to the line space characteristic value and preset target phase distance values computation rule, it is intersegmental to calculate target by S103
Away from value.
After line space characteristic value is obtained, line space characteristic value can be updated to preset target phase distance values and calculated
In rule, the target phase distance values for being adjusted to paragraph spacing are calculated.
Specifically, in one embodiment of the invention, above-mentioned S103 can include:
According to the line space characteristic value and calculation formula:Target phase distance values=line space characteristic value * α, calculate mesh
Bid section distance values, wherein, α is preset quantizing factor, and α>1.
For example α=200% is taken, target phase distance values are line space characteristic value * 200% at this time.
Specifically, in another embodiment of the present invention, above-mentioned S103 can include:
According to the line space characteristic value and calculation formula:Target phase distance values=line space characteristic value+β, calculate mesh
Bid section distance values, wherein, β is preset modifying factor.
Need what is illustrated, in practical applications, can in the embodiment of the present invention preset quantizing factor α, preset repair
The value of positive divisor β is adjusted.
Paragraph spacing between at least two paragraphs in the destination document is adjusted to the target phase spacing by S104
Value, obtains new paragraph display effect.
After target phase spacing is calculated, the white more place that can fall through to destination document stage casing carries out compression processing,
Specifically, the excessive paragraph distance values of paragraph blank are adjusted to above-mentioned target phase distance values.
Specifically, in one embodiment of the invention, above-mentioned S104 can include:
Obtain the paragraph distance values between each paragraph in destination document;
The spacing only paragraph distance values in destination document being more than between two paragraphs of the target phase distance values adjusts
For the target phase distance values, new paragraph display effect is obtained.
For example target phase distance values are M, are more than two paragraphs of M for paragraph distance values in destination document, by the two
Spacing between paragraph is adjusted to M;Paragraph distance values in destination document are less than with two paragraphs of M, not to the two sections
Spacing between falling is adjusted, so as to make document that user be facilitated to read.
It can be seen that the method for adjustment paragraph spacing provided in an embodiment of the present invention, at least two in destination document is obtained
After line space value between a row, acquired line space value can be counted, it is more than default to judge whether accounting
Accounting threshold value line space value, the line space characteristic value of the destination document is determined according to judging result;Further according to institute
Line space characteristic value and preset target phase distance values computation rule are stated, calculates target phase distance values, and the target is literary
Paragraph spacing in shelves between at least two paragraphs is adjusted to the target phase distance values, so as to obtain it is new, read convenient for user
The paragraph display effect of reading.
Compared with prior art, the embodiment of the present invention can automatically will be between two excessive paragraphs of blank in document
Paragraph spacing is adjusted to the paragraph distance values that user is suitble to read, and overcome caused by user's manual operation cumbersome lacks
Point, efficiency are higher.
Optionally, in one embodiment of the invention, destination document is read for ease of user, can also schemed
Increase S105 on the basis of method shown in 1, as shown in Figure 3;S105 is described below.
S105 preserves the new paragraph display effect;Thus when user reads the destination document again,
The user is facilitated to read.
Optionally, in one embodiment of the invention, before above-mentioned S104, can also include:
It is shown to user for asking whether to allow the prompt message being adjusted to paragraph spacing, and is receiving user
Allow adjustment operate after, triggering perform the paragraph spacing by between at least two paragraphs in the destination document be adjusted to
The target phase distance values, the step of obtaining new paragraph display effect.
The embodiment of the present invention can ask the user whether to allow before the paragraph distance values to destination document are adjusted
This paragraph re-pitching action in the case where user allows, is just adjusted the paragraph spacing of destination document, gives
The sufficient operating right of user;In practical application, the display mode of prompt message is specifically as follows:The display mode of dialog box,
The embodiment of the present invention is not construed as limiting this.
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of device for adjusting paragraph spacing.
As shown in figure 4, a kind of device for adjusting paragraph spacing provided in an embodiment of the present invention, can include:
Line space value acquisition module 401, for obtaining the line space value in destination document between at least two rows;
Judgment module 402, the line space value for being obtained to the line space value acquisition module 401 count, and judge
It is more than the line space value of preset accounting threshold value with the presence or absence of accounting;
Line space characteristic value determining module 403, for determining the target according to the judging result of the judgment module 402
The line space characteristic value of document;Wherein, the line space characteristic value determining module 403, is specifically used for:In the judgment module
402 judging result is in the case of being, the line space value for by accounting being more than preset accounting threshold value is determined as line space feature
Value;
Target phase distance values computing module 404, for being determined in the ranks according to the line space characteristic value determining module 403
Away from characteristic value and preset target phase distance values computation rule, target phase distance values are calculated;
Paragraph spacing adjusts module 405, for by the paragraph spacing tune between at least two paragraphs in the destination document
Whole is the target phase distance values, obtains new paragraph display effect.
It can be seen that the device of adjustment paragraph spacing provided in an embodiment of the present invention, at least two in destination document is obtained
After line space value between a row, acquired line space value can be counted, it is more than default to judge whether accounting
Accounting threshold value line space value, the line space characteristic value of the destination document is determined according to judging result;Further according to institute
Line space characteristic value and preset target phase distance values computation rule are stated, calculates target phase distance values, and the target is literary
Paragraph spacing in shelves between at least two paragraphs is adjusted to the target phase distance values, so as to obtain it is new, read convenient for user
The paragraph display effect of reading.
Compared with prior art, the embodiment of the present invention can automatically will be between two excessive paragraphs of blank in document
Paragraph spacing is adjusted to the paragraph distance values that user is suitble to read, and overcome caused by user's manual operation cumbersome lacks
Point, efficiency are higher.
Optionally, in another embodiment of the present invention, the line space characteristic value determining module 403, specifically may be used also
For:
In the case where the judging result of the judgment module 402 is no, the average value of acquired line space value is calculated,
The average value being calculated is determined as line space characteristic value.
It optionally, in one embodiment of the invention, can be with as shown in figure 5, the paragraph spacing adjusts module 405
Including:
Paragraph distance values acquisition submodule 405a, for obtaining the paragraph distance values in destination document between each paragraph;
Paragraph spacing adjusts submodule 405b, for paragraph distance values in destination document only to be more than the target phase spacing
Spacing between two paragraphs of value is adjusted to the target phase distance values, obtains new paragraph display effect.
Optionally, in another embodiment of the present invention, as shown in fig. 6, adjustment paragraph provided in an embodiment of the present invention
The device of spacing, can be to increase on the basis of device shown in Fig. 4:Preserving module 406;Preserving module 406 is carried out below
Description.
Preserving module 406, for adjusting paragraph display effect obtain, new to paragraph spacing adjustment module 405
It is preserved;So as to which the user when user reads the destination document again, be facilitated to read.
Optionally, in one embodiment of the invention, the line space value acquisition module 401, specifically can be used for:
Obtain the line space value of the full text of destination document;
Or
The line space value of the preceding M rows of current display page in destination document is obtained, wherein, M is more than 1, and aobvious less than current
Show total line number of the page.
Optionally, in one embodiment of the invention, the target phase distance values computing module 404, can specifically use
In:
The line space characteristic value and calculation formula determined according to the line space characteristic value determining module 403:
Target phase distance values=line space characteristic value * α, calculate target phase distance values, wherein, α for preset quantization because
Son, and α>1.
Optionally, in one embodiment of the invention, as shown in fig. 7, between adjustment paragraph provided in an embodiment of the present invention
Away from device, can be to increase on the basis of device shown in Fig. 4:Prompt message display module 407;Prompt message is shown below
Show that module 407 is described.
Prompt message display module 407, for showing to ask whether to allow to be adjusted paragraph spacing to user
Prompt message, and receive user adjustment is allowed to operate after, trigger paragraph spacing adjustment module 405 and perform:It will
Paragraph spacing in the destination document between at least two paragraphs is adjusted to the target phase distance values, obtains new paragraph and shows
Show the operation of effect.
For device embodiment, since it is substantially similar to embodiment of the method, so description is fairly simple, it is related
Part illustrates referring to the part of embodiment of the method.
For convenience of description, it is divided into various modules during description apparatus above with function to describe respectively.Certainly, implementing this
The function of each module is realized can in the same or multiple software and or hardware during invention.
It should be noted that herein, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any this practical relationship or sequence.Moreover, term " comprising ", "comprising" or its any other variant are intended to
Non-exclusive inclusion, so that process, method, article or equipment including a series of elements not only will including those
Element, but also including other elements that are not explicitly listed or further include as this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
Also there are other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is described using relevant mode, identical similar portion between each embodiment
Point just to refer each other, and the highlights of each of the examples are difference from other examples.Especially for device reality
For applying example, since it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
One of ordinary skill in the art will appreciate that all or part of step in realization above method embodiment is can
It is completed with instructing relevant hardware by program, the program can be stored in computer read/write memory medium,
The storage medium designated herein obtained, such as:ROM/RAM, magnetic disc, CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.