CN105786901B - A kind of method and device adjusting webpage font size - Google Patents

A kind of method and device adjusting webpage font size Download PDF

Info

Publication number
CN105786901B
CN105786901B CN201410822954.0A CN201410822954A CN105786901B CN 105786901 B CN105786901 B CN 105786901B CN 201410822954 A CN201410822954 A CN 201410822954A CN 105786901 B CN105786901 B CN 105786901B
Authority
CN
China
Prior art keywords
font size
size
reference type
font
threshold value
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
CN201410822954.0A
Other languages
Chinese (zh)
Other versions
CN105786901A (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.)
Alibaba China Co Ltd
Original Assignee
Guangzhou Dongjing Computer Technology Co 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 Guangzhou Dongjing Computer Technology Co Ltd filed Critical Guangzhou Dongjing Computer Technology Co Ltd
Priority to CN201410822954.0A priority Critical patent/CN105786901B/en
Publication of CN105786901A publication Critical patent/CN105786901A/en
Application granted granted Critical
Publication of CN105786901B publication Critical patent/CN105786901B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention discloses a kind of method and devices of font size in adjustment webpage, which comprises obtains at least partly corresponding font size of text in webpage;According to the corresponding font size of the text, the corresponding reference type size of each font size is determined;Text in the page is adjusted according to the corresponding reference type size and scaling set by user.In the embodiment of the present invention, according to the reference type size of the corresponding scaling of every kind of font size in determining webpage, to font sizes different in webpage, ratio is adjusted at different zoom, it is zoomed in or out more rationally with grade ratio, not only reduce the probability that overlapping, truncation occurs in the page, and keep page whole style constant, improve user experience and availability.

Description

A kind of method and device adjusting webpage font size
Technical field
The present invention relates to Web Page Processing technology, in particular to a kind of method and device for adjusting webpage font size.
Background technique
It is clear by browser along with the popularization of fast development and the application of network technology with the raising that people live Webpage is look to obtain various information and have become an indispensable branch in for people's lives.And text amplification is one in browser Very universal function is conducive to meet the different requirements that people read the page.Currently, the most frequently used in browser in terminal Two kinds of interpolator arithmetics are as follows:
One is amplify according to the ratio such as user setting ratio.For example a kind of browser use etc. works as user setting than amplification When font size is 120%, then font size all in the page is all amplified 1.2 times by UC browser.But in this way the advantages of Simply, intuitively, the relative size of all texts remains unchanged (for example, title and text) in the page after amplification, will not destroy page Design of the face original author for page font size (fidelity is high).But this mode disadvantage in mobile browser is also very bright It is aobvious.Whether the content that user is concerned about does not amplify, and after amplification, overlapping, truncated problem occurs in the page.The content of amplification is more, puts Large scale is higher, which is more obvious.
Another kind is, is the intelligent typesetting of representative with Google's (chrome) browser or Android (android) browser etc., Understand according to the text for needing to amplify in the unalterable rules intelligent recognition page-out of some settings, and in user setting font size size Afterwards, processing only is amplified to this segment word for needing to amplify in the page, other texts in the page are constant.But it uses This mode amplifies the text in webpage, and the webpage bigger for font size design difference in webpage, experience is poor, for example, If the font size of webpage current topic text is 12px, the font size of caption text is 24px.If the user feels that main body text is 12px font size is smaller, needs to be amplified to 16px, at this point, the font size of the caption text in the webpage will be put to arrive more greatly 32px reduces user experience since the font size of main body text and the font size difference of caption text are larger.
It follows that no matter being carried out by which kind of above-mentioned mode to the text in webpage since webpage design is multifarious Amplification generally will appear various problem after text amplification, for example, being overlapped after the text amplification in webpage, be truncated The problems such as, it is difficult to meet user and really needs the content of amplification, to reduces user experience.
Summary of the invention
A kind of method and device for adjusting webpage font size is provided in the embodiment of the present invention, to solve in the prior art Amplification webpage in text after, reduce user experience the problem of.
In order to solve the above-mentioned technical problem, the embodiment of the invention discloses following technical solutions:
First aspect provides a kind of method for adjusting font size in webpage, comprising:
Obtain at least partly corresponding font size of text in webpage;
According to the corresponding font size of the text, the corresponding reference type size of each font size is determined;
To the text in the page respectively according to the corresponding reference type size and scaling set by user into Row adjustment.
Optionally, the corresponding reference type size of the determination each font size, comprising:
On the direction of the font size from small to large, change rate between the reference type size and the corresponding font size by It is decrescence small;Or
On the direction of the font size from big to small, change rate between the reference type size and the corresponding font size by Gradual change is big.
Optionally, described on font size direction from small to large, the reference type size and the corresponding font size it Between change rate be gradually reduced, comprising:
When the font size is less than or equal to the first font size threshold value, the difference of the reference type size and corresponding font size is with N pounds Relationship become larger, wherein 1.5≤N≤2.5;
It is greater than the first font size threshold value, when less than the second font size threshold value, the reference type size and corresponding institute in the font size It states the difference of font size to become larger with M pounds of relationships, wherein 0.5≤M < 1.5;
When the font size is greater than or equal to the second font size threshold value, the size of the reference type size and the corresponding font size Close to identical;
The variation on font size direction from big to small, between the reference type size and the corresponding font size Rate becomes larger, comprising:
When the font size is less than or equal to the first font size threshold value, the difference of the reference type size and corresponding font size is with N pounds Relationship gradually become smaller, wherein 1.5≤N≤2.5;
It is greater than the first font size threshold value, when less than the second font size threshold value, the reference type size and corresponding institute in the font size It states the difference of font size to gradually become smaller with M pounds of relationship, wherein 0.5≤M < 1.5;
When the font size is greater than or equal to the second font size threshold value, the size of the reference type size and the corresponding font size Close to identical.
Optionally, the corresponding reference type size of the determination each font size, comprising:
Along the direction of the font size from small to large, by searching for the mapping table of the first font size and reference type size, obtain To the reference type size of the corresponding amplification of every kind of font size;Or along the direction of the font size from big to small, by searching for second The mapping table of font size and reference type size obtains the corresponding reference type size reduced of every kind of font size.
Optionally, the corresponding reference type size of the determination each font size, comprising:
On the direction of the font size from small to large, the character datum of the corresponding amplification of the font size is calculated according to the first curve Number, first curve is with the difference between the corresponding font size of the reference type size with the change of the corresponding font size The feature being gradually reduced greatly;Or
On the direction of the font size from big to small, the corresponding benchmark reduced of every kind of font size is calculated according to the second curve Font size, the difference between font size that second curve has the reference type size corresponding is with the corresponding font size The feature for becoming smaller and becoming larger.
Optionally, the formula of first curve are as follows:
Y (x)=2* (11-exp (- x/8.5) * 14)
The formula of second curve are as follows:
Y (x)=- 8.5*log (11-x/2)/14
Wherein, y is benchmark font size, and x is the practical font size of text in webpage.
Second aspect provides a kind of device for adjusting font size in webpage, comprising:
Acquiring unit, for obtaining in webpage at least partly corresponding font size of text;
Determination unit, for determining the corresponding reference type size of each font size according to the corresponding font size of the text;
Unit for scaling, for being set respectively according to the corresponding reference type size and user to the text in the page Scaling be adjusted.
Optionally, the determination unit includes:
First determination unit, for the direction in the font size from small to large, the reference type size with it is corresponding described Change rate between font size is gradually reduced;And/or
Second determination unit, for the direction in the font size from big to small, the reference type size with it is corresponding described Change rate between font size becomes larger.
Optionally, first determination unit includes: the first amplifying unit, the second amplifying unit and third amplifying unit; And/or second determination unit includes: the first reducing unit, the second reducing unit and third reducing unit, wherein
First amplifying unit is used for when the font size is less than or equal to the first font size threshold value, the reference type size And the difference of corresponding font size is become larger with N pounds of relationship, wherein 1.5≤N≤2.5;
Second amplifying unit, for being greater than the first font size threshold value, when less than the second font size threshold value, institute in the font size The difference for stating reference type size and the corresponding font size is become larger with M pounds of relationship, wherein 0.5≤M < 1.5;
The third amplifying unit is used for when the font size is greater than or equal to the second font size threshold value, the reference type size With the size of the corresponding font size close to identical;
First reducing unit, for the font size be less than or equal to the first font size threshold value when, the reference type size with it is right The difference for the font size answered is gradually become smaller with N pounds of relationship, wherein 1.5≤N≤2.5;
Second reducing unit, for being greater than the first font size threshold value, when less than the second font size threshold value, the base in the font size Quasi-font size and the difference of the corresponding font size are gradually become smaller with M pounds of relationship, wherein 0.5≤M < 1.5;
Third reducing unit, for the font size be greater than or equal to the second font size threshold value when, the reference type size with it is right The size for the font size answered is close to identical.
Optionally, the determination unit includes:
Searching unit, for the direction along the font size from small to large, by searching for the first font size and reference type size Mapping table obtains the reference type size of the corresponding amplification of every kind of font size;Or along the direction of the font size from big to small, By searching for the mapping table of the second font size and reference type size, the corresponding reference type size reduced of every kind of font size is obtained;With/ Or
Computing unit calculates every kind of font size according to the first curve for the direction in the font size from small to large The reference type size of corresponding amplification, the difference between font size that first curve has the reference type size corresponding is with right The becoming larger for font size answered and the feature being gradually reduced;Or on the direction of the font size from big to small, according to the second song The corresponding reference type size reduced of every kind of font size, the word that second curve has the reference type size corresponding described in line computation The feature that difference between number becomes larger with corresponding the becoming smaller for font size.
Optionally, the computing unit according to the first curve formula are as follows: y (x)=2* (11-exp (- x/8.5) * 14);Or
The computing unit according to the second curve formula are as follows: y (x)=- 8.5*log (11-x/2)/14;
Wherein, y is benchmark font size, and x is the practical font size of text in the page.
As shown from the above technical solution, in the embodiment of the present invention, according to the character datum of the corresponding scaling of every kind of determining font size Number, font sizes different in webpage are zoomed in or out according to different magnification ratios, the scheme with the amplification of grade ratio or Scaling It compares, not only reduces the page and the probability of overlapping, truncation occur, but also keep page whole style constant, improve user's body It tests and availability.
Detailed description of the invention
It in order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, below will be to institute in embodiment Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the invention Example, for those of ordinary skill in the art, without creative efforts, can also obtain according to these attached drawings Obtain other attached drawings.
Fig. 1 is the flow chart of the method for font size in a kind of adjustment webpage provided in an embodiment of the present invention;
Fig. 2 is a kind of curve graph provided in an embodiment of the present invention;
Fig. 3 is the structural schematic diagram of the device of font size in a kind of adjustment webpage provided in an embodiment of the present invention;
Fig. 4 is another structural schematic diagram of the device of font size in a kind of adjustment webpage provided in an embodiment of the present invention;
Fig. 5 is a kind of result schematic diagram of server provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Whole description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
The term used in embodiments of the present invention is only to be not intended to be limiting merely for for the purpose of describing particular embodiments The present invention.In the embodiment of the present invention and the "an" of singular used in the attached claims, " described " and "the" It is also intended to including most forms, unless the context clearly indicates other meaning.It is also understood that term used herein "and/or" refers to and includes that one or more associated any or all of project listed may combine.
Referring to Fig. 1, Fig. 1 is the process of the method for font size in a kind of adjustment webpage provided in an embodiment of the present invention Figure, in this embodiment, if the user feels that the font size on current web page is smaller, needs to amplify the font size on webpage, input is put Big ratio, at this point, browser is when receiving the magnification ratio, by the following method the step of the font size on webpage is carried out Amplification.The described method includes:
Step 101: obtaining at least partly corresponding font size of text in webpage;
In the step, when user opens a certain webpage by browser, browser can know in the webpage at least portion The different font sizes of single cent word size, for example, opening in webpage has 2 kinds of texts of different sizes of title and body matter, heading-text The size of word is 12 font sizes, can be indicated with 12px, and the size of main body text is No. 10 words, can be indicated with 10px.Certainly, In In the webpage of opening, there can also be 3 kinds or more of different size of text, the present embodiment is with no restriction.
Wherein, the different font sizes of some or all of webpage text are obtained for browser, this is for those skilled in the art It has been known technology, details are not described herein for member.
Step 102: according to the corresponding font size of the text, determining the corresponding reference type size of each font size;
In the step, the mode that determines can there are many, the present embodiment is not by taking following two kinds of methods of determination as an example, but not It is limited to this.
A kind of method of determination is: by searching for the mapping table of font size and reference type size, obtaining every kind of font size pair The reference type size that should be scaled;
That is, along the direction of the font size from small to large, it is corresponding with reference type size by searching for the first font size Relation table obtains the reference type size of the corresponding amplification of every kind of font size;Or along the direction of the font size from big to small, pass through The mapping table for searching the second font size and reference type size obtains the corresponding reference type size reduced of every kind of font size.
Optionally, in another embodiment, on font size direction from small to large, the reference type size with it is corresponding The case where change rate between the font size is gradually reduced is with the difference of reference type size and practical font size work in the embodiment For change rate, certainly, the change rate in the present embodiment can also be reference type size divided by the quotient of practical font size or other Similar calculation.Specifically:
When the font size is less than or equal to the first font size threshold value, the difference of the reference type size and corresponding font size is with N pounds Relationship become larger, wherein 1.5≤N≤2.5;It is specific as shown in table 1, the first font size threshold value in table 1 by taking 14px as an example, In this embodiment, the difference of reference type size and practical font size is by taking 2 pounds of relationship becomes larger as an example, when in practical applications It is not limited to this.
It is greater than the first font size threshold value, when less than the second font size threshold value, the reference type size and corresponding institute in the font size It states the difference of font size to become larger with M pounds of relationship, wherein 0.5≤M < 1.5;It is specific as shown in table 1, the first font size in table 1 Threshold value is with 14px, and the second font size threshold value is by taking 18px as an example, and in this embodiment, the difference of reference type size and practical font size is with 1 For the relationship of pound becomes larger;
When the font size is greater than or equal to the second font size threshold value, the size of the reference type size and the corresponding font size Close to identical;It is specific as shown in table 1, in table 1 by taking variation front and back is identical as an example.
Similarly, it is described when the font size from big to small when, variation between the reference type size and the corresponding font size The case where rate becomes larger, specifically:
When the font size is less than or equal to the first font size threshold value, the difference of the reference type size and corresponding font size is with N pounds Relationship gradually become smaller, wherein 1.5≤N≤2.5;It is specific as shown in table 2, the difference of reference type size and practical font size in table 2 It is not limited to this by taking 2 pounds of relationship gradually becomes smaller as an example, but in practical applications.
When the font size is greater than the first font size threshold value, when less than the second font size threshold value, the reference type size and corresponding institute It states the difference of font size to gradually become smaller with M pounds of relationship, wherein 0.5≤M < 1.5;It is specific as shown in table 2, in table 2 reference type size with The difference of practical font size is by taking 1 pound of relationship gradually becomes smaller as an example;
When the font size is greater than or equal to the second font size threshold value, the size of the reference type size and the corresponding font size Close to identical.It is specific as shown in table 2, in table 2 by taking variation front and back is identical as an example.
Wherein, mapping table is to be distributed habit according to domestic wap page font size to formulate, and under normal circumstances, is less than 11px is rarely used greater than the font size of 20px, wherein the font sizes such as 15px, 17px, 19px by frequency of use than even number font size 14px, 16px, 18px, 20px much less.Based on this, the mapping table of font size and amplification reference type size in webpage is set, Browser can be found and font size (current character in webpage when realizing webpage font size interpolator arithmetic according to mapping table The font size of size is referred to as former font size) corresponding reference type size.Specific mapping table is as shown in table 1, and table 1 is only given The corresponding amplification reference type size of part font size is gone out.Conversely, can also be reduced accordingly to every kind of font size in the page, have Body is as shown in table 2, and table 2 has been merely given as the corresponding diminution reference type size of part font size.
Table 1
Font size Reference type size
11px 13px
12px 14px
13px 15px
14px 16px
15px 16px
17px 18px
18px 19px
19px 19px
20px 20px
Table 2
Font size Reference type size
13px 11px
14px 12px
15px 13px
16px 14px
16px 15px
18px 17px
19px 18px
19px 19px
20px 20px
In this method of determination, the selection of reference type size can be according to the style, performance, user of browser habit, type Deng because being usually arranged, it is, different browsers or different types, can be set different scaling reference type sizes, when So, identical scaling reference type size also can be set, principle guarantee scales availability and the fidelity of font size scheme.
Another kind determines the corresponding reference type size of each font size are as follows: the base of the corresponding scaling of the font size is calculated according to curve Quasi-font size specifically includes:
On the direction of the font size from small to large, the benchmark of the corresponding amplification of every kind of font size is calculated according to the first curve Font size, the difference between font size that first curve has the reference type size corresponding is with the corresponding font size The feature for becoming larger and being gradually reduced;It is specific:
When the font size is less than or equal to the first font size threshold value, the difference of the reference type size and corresponding font size is with N pounds Relationship become larger, wherein 1.5≤N≤2.5;It is greater than the first font size threshold value in the font size, less than the second font size threshold value When, the difference of the reference type size and the corresponding font size is become larger with M pounds of relationship, wherein 0.5≤M < 1.5;Institute When stating font size more than or equal to the second font size threshold value, the reference type size and the size of the corresponding font size are close to identical.Or Person
On the direction of the font size from big to small, the corresponding benchmark reduced of every kind of font size is calculated according to the second curve Font size, the difference between font size that second curve has the reference type size corresponding is with the corresponding font size The feature for becoming smaller and becoming larger, specifically include:
When the font size is less than or equal to the first font size threshold value, the difference of the reference type size and corresponding font size is with N pounds Relationship gradually become smaller, wherein 1.5≤N≤2.5;It is greater than the first font size threshold value in the font size, less than the second font size threshold value When, the difference of the reference type size and the corresponding font size is gradually become smaller with M pounds of relationship, wherein 0.5≤M < 1.5;Institute When stating font size more than or equal to the second font size threshold value, the reference type size and the size of the corresponding font size are close to identical.
In this mode, if necessary to being amplified to the different font sizes of webpage, it can be calculated using the first curve pair The reference type size answered, wherein the curve equation of first curve by taking y (x)=2* (11-exp (- x/8.5) * 14) as an example, In, in the formula, y is benchmark font size, and x is the practical font size of text in webpage, and corresponding curve graph is as shown in Fig. 2, Fig. 2 is A kind of curve graph provided in an embodiment of the present invention.Certainly, it is not limited to this, which can also be fitted in practical applications Answering property modification etc., for example, the present embodiment is not illustrating one by one multiplied by different coefficients etc. on the basis of the formula.
In this mode, if necessary to being reduced to the different font sizes of webpage, can using with the second curve (i.e. with the The opposite mode of one curve) calculate corresponding reference type size, in the present embodiment, the formula of the second curve is with y (x)=- 8.5* For log (11-x/2)/14, wherein y is benchmark font size, and x is the practical font size of text in webpage.
In the present embodiment, this function that exponential function can be applied on value e is written as exp (x).It can be write with of equal value For e, e here is math constant, is exactly the truth of a matter of natural logrithm, is approximately equal to 2.718281828, also known as Euler's numbers.
In order to make it easy to understand, with a kind of size of the font size of text on webpage current page be 11px in the present embodiment, The reference type size then amplified are as follows: 2* (11-exp (- 11/8.5) * 14).
Step 103: to the text in the page according to the corresponding reference type size and pantograph ratio set by user Example is adjusted.
It, can be to the text in the page according to the corresponding reference type size and scaling set by user in the step The product of ratio is adjusted.That is, can be according to formula: the final font size of every kind of font size=every kind of character datum in webpage Number * scaling set by user carries out the scaling of different proportion to the text of font sizes different in webpage.
In the step, if it is assumed that the practical font size after amplification in net is real Font Size, the page word before amplification Number be page Font Size;The embodiment is by taking a kind of font size as an example, when in practical applications, various font sizes are simultaneously It calculates, is simultaneously amplified according to different proportion.
If magnification ratio set by user is 120%, the practical font size after amplification in webpage are as follows:
Real Font Size=1.2*2* (11-exp (- page Font Size/8.5) * 14);
Practical font size if magnification ratio 160%, after amplification in webpage are as follows:
Real Font Size=1.6*2* (11-exp (- page Font Size/8.5) * 14);
……
And so on, if magnification ratio is N, the practical font size after amplification in webpage is
Real Font Size=N*2* (11-exp (- page Font Size/8.5) * 14)
Wherein, N is magnification ratio coefficient.
Similarly, the different font sizes in the webpage can also be reduced according to different ratios using following formula.Its Formula are as follows:
Real Font Size=N*-8.5*log (11-page Font Size/2)/14
Wherein, N is to reduce proportionality coefficient.
In the embodiment of the present invention, according to the reference type size of the corresponding scaling of every kind of determining font size, to font sizes different in webpage It is zoomed in or out according to different magnification ratios, compared with the scheme of the amplification of grade ratio or Scaling, not only reduces the page and go out The probability for being now overlapped, being truncated, but also keep page whole style constant, improve user experience and availability.
For the ease of the understanding of those skilled in the art, illustrated below with an example.
It in a kind of embodiment, is opened in webpage in user, if the web page body font size is 12px, title font size is 18px.Assuming that user, which thinks that 12px font size is smaller, needs to be amplified to 150%, magnification ratio 150% is then inputted, at this point, clear Device is look at when receiving magnification ratio 150%, first obtains the different font sizes of text in the webpage, for example include: 12px and 18px Two kinds of font sizes;Then mapping table (the present embodiment is searched for mapping table) is looked into automatically, obtains needing font size 12px It is amplified to reference type size 14px, font size 18px is amplified to reference type size 19px, finally, by 150% multiplied by reference type size 14px, Obtain the amplified final font size of main body font size;And it is amplified to obtain title font size multiplied by reference type size 19px by 150% Final font size.That is, the text of 12px and 18px in the webpage are simultaneously amplified according to different ratios.Realize Different font sizes in webpage are amplified according to different proportion, while also can guarantee the whole font style of text in webpage not Become, big font size is still bigger than small type size, improves the satisfaction of user.
On the other hand, existing wait is optimized than interpolator arithmetic, has from availability and fidelity for the present embodiment Effect improves the magnification ratio for having the small type size of practical amplification demand, the appropriate magnification ratio for reducing big font size text in the page.Make It is more reasonable to obtain font size setting function, while promoting user experience, reduction etc. brings the probability of problem than interpolator arithmetic.
In another embodiment, by taking www.uc.cn/a/product/2014/0820/3817.html as an example.Webpage master Body is 12px, entitled 24px.It needs to be amplified to 16px assuming that user thinks that 12px font size is smaller, if according to existing etc. Than interpolator arithmetic, amplified title will be amplified to 32px, what this font size will not substantially be used in wap page Font size, occupies the screen more than one third if in some smaller screen mobile phone browser titles, and user experience is very poor.If Using reference type size of the invention, having selected font size correspondence to amplify, title will not be amplified to 32px, but be amplified to 26px, title 26px can still keep the comparison in size style with text 16px, and will not influence user due to excessive Experience.
Realization process based on the above method, the embodiment of the present invention also provide a kind of dress for adjusting font size in webpage It sets, structural schematic diagram is as shown in figure 3, described device includes: acquiring unit 31, determination unit 32 and unit for scaling 33, wherein
The acquiring unit 31, for obtaining in webpage at least partly corresponding font size of text;
The determination unit 32, for determining the corresponding character datum of each font size according to the corresponding font size of the text Number;
The unit for scaling 33, for the text in the page respectively according to the corresponding reference type size and use The scaling of family setting is adjusted.
Optionally, in another embodiment, on the basis of the above embodiments, the determination unit includes: the embodiment First determination unit and/or the second determination unit (not shown), wherein
First determination unit, for the direction in the font size from small to large, the reference type size with it is corresponding Change rate between the font size is gradually reduced;
Second determination unit, for the direction in the font size from big to small, the reference type size with it is corresponding Change rate between the font size becomes larger.
Optionally, in another embodiment, the embodiment on the basis of the above embodiments, the first determination unit packet It includes: the first amplifying unit, the second amplifying unit and third amplifying unit and/or the first reducing unit, the second reducing unit and Three reducing units, wherein
First amplifying unit is used for when the font size is less than or equal to the first font size threshold value, the reference type size And the difference of corresponding font size is become larger with N pounds of relationship, wherein 1.5≤N≤2.5;
Second amplifying unit, for being greater than the first font size threshold value, when less than the second font size threshold value, institute in the font size The difference for stating reference type size and the corresponding font size is become larger with M pounds of relationship, wherein 0.5≤M < 1.5;
The third amplifying unit is used for when the font size is greater than or equal to the second font size threshold value, the reference type size With the size of the corresponding font size close to identical;
First reducing unit is used for when the font size is less than or equal to the first font size threshold value, the reference type size And the difference of corresponding font size is gradually become smaller with N pounds of relationship, wherein 1.5≤N≤2.5;
Second reducing unit, for being greater than the first font size threshold value, when less than the second font size threshold value, institute in the font size The difference for stating reference type size and the corresponding font size is gradually become smaller with M pounds of relationship, wherein 0.5≤M < 1.5;
The third reducing unit is used for when the font size is greater than or equal to the second font size threshold value, the reference type size With the size of the corresponding font size close to identical.
Optionally, in another embodiment, the embodiment on the basis of the above embodiments, wrap by the determination unit 32 Include: searching unit 41 and/or computing unit 42, structural schematic diagram as shown in figure 4, the present embodiment with simultaneously include searching unit 41 and computing unit 42 for, but be not limited to this in practical applications, wherein
The searching unit 41, for the direction along the font size from small to large, by searching for the first font size and benchmark The mapping table of font size obtains the reference type size of the corresponding amplification of every kind of font size;Or from big to small along the font size On direction, by searching for the mapping table of the second font size and reference type size, the corresponding benchmark reduced of every kind of font size is obtained Font size;
The computing unit 42 calculates described every for the direction in the font size from small to large according to the first curve The reference type size of the corresponding amplification of kind font size, the difference between font size that first curve has the reference type size corresponding The feature being gradually reduced with corresponding the becoming larger for font size;Or the font size from big to small when, according to second song The corresponding reference type size reduced of every kind of font size, the word that second curve has the reference type size corresponding described in line computation The feature that difference between number becomes larger with corresponding the becoming smaller for font size.
Optionally, in another embodiment, the embodiment on the basis of the above embodiments, search by the searching unit 31 Reference type size in the mapping table is the style according to browser, performance, what user's habit and type were configured;No The reference type size of same browser, setting is different.
Optionally, in another embodiment, the embodiment on the basis of the above embodiments, the computing unit 32 according to The first curve formula are as follows: y (x)=2* (11-exp (- x/8.5) * 14);Wherein, y is benchmark font size, and x is text in the page Practical font size;Or
The computing unit according to the second curve formula are as follows: y (x)=- 8.5*log (11-x/2)/14;
Wherein, y is benchmark font size, and x is the practical font size of text in the page.
Optionally, in another embodiment, on the basis of the above embodiments, the unit for scaling 23 has the embodiment Body be used for the different font sizes in the webpage respectively according to every kind of reference type size and scaling set by user product into Row different proportion zooms in or out.
Optionally, described device can integrate in a browser, also can integrate on the server, or independent deployment, The present embodiment is with no restriction.
Fig. 5 is seen also, is a kind of structural schematic diagram of server provided in an embodiment of the present invention, which includes: Processor 510, memory 520, transceiver 530 and bus 540;
Processor 510, memory 520, transceiver 530 are connected with each other by bus 540;It is total that bus 540 can be ISA Line, pci bus or eisa bus etc..The bus can be divided into address bus, data/address bus, control bus etc..For convenient for table Show, only indicated with a thick line in Fig. 5, it is not intended that an only bus or a type of bus.
Memory 520 also can store the mapping table of font size and reference type size for storing program.Specifically, journey Sequence may include program code, and said program code includes computer operation instruction.Memory 520 may be deposited comprising high-speed RAM Reservoir, it is also possible to further include nonvolatile memory (non-volati le memory), for example, at least a magnetic disk storage.
Transceiver 530 is communicated for connecting other equipment with other equipment.The specific transceiver 530 can To be used for: obtaining at least partly corresponding font size of text in webpage;
The processor 510 executes the said program code stored in memory 520, for corresponding according to the text Font size determines the corresponding reference type size of each font size;And to the text in the page respectively according to the corresponding benchmark Font size and scaling set by user are adjusted.
Optionally, the processor 510 determines the corresponding reference type size of each font size, specifically can the font size from It is small on big direction, the change rate between the reference type size and the corresponding font size is gradually reduced;Or in the word On direction number from big to small, the change rate between the reference type size and the corresponding font size is become larger.
Optionally, the processor 510 determines the corresponding reference type size of each font size, specifically can along the font size from It is small on big direction, by searching for the mapping table of the first font size and reference type size, obtain every kind of font size correspondence and put Big reference type size;It is corresponding with reference type size by searching for the second font size or along the direction of the font size from big to small Relation table obtains the corresponding reference type size reduced of every kind of font size.
Optionally, the processor 510 determines the corresponding reference type size of each font size, specifically can be used in the word On direction number from small to large, the reference type size of the corresponding amplification of the font size, the first curve tool are calculated according to the first curve The spy that the difference between font size for having the reference type size corresponding is gradually reduced with corresponding the becoming larger for font size Sign;Or on the direction of the font size from big to small, the corresponding benchmark reduced of every kind of font size is calculated according to the second curve Font size, the difference between font size that second curve has the reference type size corresponding is with the corresponding font size The feature for becoming smaller and becoming larger.
Optionally, the processor 510 specifically can be used for: calculate the corresponding scaling of every kind of font size according to the first curve Reference type size the first curve equation are as follows:
Y (x)=2* (11-exp (- x/8.5) * 14)
Wherein, y is benchmark font size, and x is the practical font size of text in webpage.
The processor 510 specifically can be used for: the benchmark of the corresponding scaling of every kind of font size is calculated according to the second curve Second curve equation of font size are as follows:
Y (x)=- 8.5*log (11-x/2)/14
Wherein, y is benchmark font size, and x is the practical font size of text in webpage.
Optionally, the processor 510 specifically can be used for the different font sizes in the webpage respectively according to every kind of base Quasi-font size and the product of scaling set by user carry out the adjustment of different proportion.
In the embodiment of the present invention, according to the reference type size of the corresponding scaling of every kind of determining font size, to every kind of font size in webpage Ratio zooms in or out at different zoom, with grade ratio zoom in or out more rationally, not only reduce the page occur overlapping, The probability of truncation, and it is constant to be able to maintain page whole style, improves user experience.Meanwhile using the present embodiment can be with The content of user's care is zoomed in or out, the probability to go wrong after zooming in or out is reduced, to improve availability.
It is required that those skilled in the art can be understood that the technology in the embodiment of the present invention can add by software The mode of general hardware platform realize.Based on this understanding, the technical solution in the embodiment of the present invention substantially or Say that the part that contributes to existing technology can be embodied in the form of software products, which can deposit Storage is in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that computer equipment (can be with It is personal computer, server or the network equipment etc.) execute certain part institutes of each embodiment of the present invention or embodiment The method stated.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.
The embodiments of the present invention described above are not intended to limit the scope of the present invention.It is any in the present invention Spirit and principle within made modifications, equivalent substitutions and improvements etc., should all be included in the protection scope of the present invention.

Claims (8)

1. a kind of method of font size in adjustment webpage characterized by comprising at least partly text is corresponding in acquisition webpage Font size;According to the corresponding font size of the text, the corresponding reference type size of each font size is determined, specifically, in the font size On direction from small to large, the change rate between the reference type size and the corresponding font size is gradually reduced;Or described On the direction of font size from big to small, the change rate between the reference type size and the corresponding font size is become larger;Further Ground calculates the reference type size of the corresponding amplification of the font size according to the first curve on the direction of the font size from small to large, described First curve have the difference between the corresponding font size of the reference type size with corresponding the becoming larger for font size and by Decrescence small feature;Or on the direction of the font size from big to small, it is corresponding that every kind of font size is calculated according to the second curve The reference type size of diminution, the difference between font size that second curve has the reference type size corresponding is with corresponding The becoming smaller for font size and the feature become larger;To the text in the page respectively according to the corresponding reference type size with And scaling set by user is adjusted.
2. the method according to claim 1, wherein the corresponding reference type size of the determination each font size, packet It includes: along font size direction from small to large, by searching for the mapping table of the first font size and reference type size, obtaining described The reference type size of the corresponding amplification of every kind of font size;Alternatively, along the direction of the font size from big to small, by searching for the second font size with The mapping table of reference type size obtains the corresponding reference type size reduced of every kind of font size.
3. described the method according to claim 1, wherein described on font size direction from small to large Change rate between reference type size and the corresponding font size is gradually reduced, comprising: is less than or equal to the first word in the font size When number threshold value, the difference of the reference type size and corresponding font size is become larger with N pounds of relationship, wherein 1.5≤N≤2.5;In The font size is greater than the first font size threshold value, when less than the second font size threshold value, the difference of the reference type size and the corresponding font size It is become larger with M pounds of relationship, wherein 0.5≤M < 1.5;It is described when the font size is greater than or equal to the second font size threshold value Reference type size and the size of the corresponding font size are close to identical;It is described on font size direction from big to small, the base Change rate between quasi-font size and the corresponding font size becomes larger, comprising: is less than or equal to the first font size in the font size When threshold value, the difference of the reference type size and corresponding font size is gradually become smaller with N pounds of relationship, wherein 1.5≤N≤2.5;Institute Font size is stated greater than the first font size threshold value, when less than the second font size threshold value, the difference of the reference type size and the corresponding font size is with M The relationship of pound gradually becomes smaller, wherein 0.5≤M < 1.5;When the font size is greater than or equal to the second font size threshold value, the benchmark Font size and the size of the corresponding font size are close to identical.
4. the method according to claim 1, wherein wherein, the formula of first curve are as follows: y (x)=2* The formula of (11-exp (- x/8.5) * 14) described second curve are as follows: y (x)=- 8.5*log (11-x/2)/14 wherein, on the basis of y Font size, x are the practical font size of text in webpage.
5. the device of font size in a kind of adjustment webpage characterized by comprising acquiring unit, for obtaining in webpage extremely The corresponding font size of small part text;Determination unit, for determining that each font size is corresponding according to the corresponding font size of the text Reference type size;The determination unit includes: searching unit, for the direction in the font size from small to large, by searching for The mapping table of one font size and reference type size obtains the reference type size of the corresponding amplification of every kind of font size;Or along the word On direction number from big to small, by searching for the mapping table of the second font size and reference type size, every kind of font size pair is obtained The reference type size that should be reduced;And/or computing unit, for the direction in the font size from small to large, according to the first curve meter Calculate the reference type size of the corresponding amplification of every kind of font size, the font size that first curve has the reference type size corresponding it Between the feature that is gradually reduced with corresponding the becoming larger for font size of difference;Or the direction in the font size from big to small On, the corresponding reference type size reduced of every kind of font size is calculated according to the second curve, second curve has the character datum The feature that difference between number corresponding font size becomes larger with corresponding the becoming smaller for font size;Unit for scaling, For being adjusted respectively according to the corresponding reference type size and scaling set by user to the text in the page It is whole.
6. device according to claim 5, which is characterized in that the determination unit includes: the first determination unit, is used for On the direction of the font size from small to large, the change rate between the reference type size and the corresponding font size is gradually reduced;With/ Or second determination unit, for the direction in the font size from big to small, the reference type size and the corresponding font size it Between change rate become larger.
7. device according to claim 6, which is characterized in that first determination unit includes: the first amplifying unit, the Two amplifying units and third amplifying unit;And/or second determination unit includes: the first reducing unit, the second reducing unit With third reducing unit, wherein first amplifying unit is used for when the font size is less than or equal to the first font size threshold value, The difference of the reference type size and corresponding font size is become larger with N pounds of relationship, wherein 1.14≤N≤1.28;Described second puts Big unit, for the font size be greater than the first font size threshold value, when less than the second font size threshold value, the reference type size with it is corresponding The difference of the font size is become larger with M pounds of relationship, wherein 0.5≤M < 1.5;The third amplifying unit, for described When font size is greater than or equal to the second font size threshold value, the reference type size and the size of the corresponding font size are close to identical;It is described First reducing unit, for when the font size is less than or equal to the first font size threshold value, the reference type size and corresponding font size Difference gradually become smaller with N pounds of relationship, wherein 1.5≤N≤2.5;Second reducing unit, for being greater than in the font size First font size threshold value, when less than the second font size threshold value, the difference of the reference type size and the corresponding font size with M pounds of relationship by Gradual change is small, wherein 0.5≤M < 1.5;The third reducing unit, for being greater than or equal to the second font size threshold value in the font size When, the reference type size and the size of the corresponding font size are close to identical.
8. device according to claim 5, which is characterized in that the computing unit according to the first curve formula are as follows: y (x)=2* (11-exp (- x/8.5) * 14);Or the computing unit according to the second curve formula are as follows: y (x)=- 8.5* log(11-x/2)/14;Wherein, y is benchmark font size, and x is the practical font size of text in the page.
CN201410822954.0A 2014-12-23 2014-12-23 A kind of method and device adjusting webpage font size Active CN105786901B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410822954.0A CN105786901B (en) 2014-12-23 2014-12-23 A kind of method and device adjusting webpage font size

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410822954.0A CN105786901B (en) 2014-12-23 2014-12-23 A kind of method and device adjusting webpage font size

Publications (2)

Publication Number Publication Date
CN105786901A CN105786901A (en) 2016-07-20
CN105786901B true CN105786901B (en) 2019-11-15

Family

ID=56389268

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410822954.0A Active CN105786901B (en) 2014-12-23 2014-12-23 A kind of method and device adjusting webpage font size

Country Status (1)

Country Link
CN (1) CN105786901B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018032159A1 (en) * 2016-08-14 2018-02-22 阮元 Market-based format matching technology adjusting method and website
WO2018032157A1 (en) * 2016-08-14 2018-02-22 阮元 Method for matching webpage format according to mobile phone number and website
WO2018032158A1 (en) * 2016-08-14 2018-02-22 阮元 Method for disabling mobile phone number-based webpage format matching and website
CN109165065B (en) * 2018-07-26 2021-10-12 创新先进技术有限公司 Method, device and equipment for processing word list
CN109376806A (en) * 2018-10-26 2019-02-22 深圳点猫科技有限公司 A kind of method and electronic equipment based on Web page intelligent detection webpage text

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127035A (en) * 2007-10-11 2008-02-20 金蝶软件(中国)有限公司 Method and device drafting character string at targeted area
CN102707935A (en) * 2011-03-28 2012-10-03 腾讯科技(深圳)有限公司 Mobile terminal browsing tool and method for setting text properties thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7877392B2 (en) * 2006-03-01 2011-01-25 Covario, Inc. Centralized web-based software solutions for search engine optimization

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127035A (en) * 2007-10-11 2008-02-20 金蝶软件(中国)有限公司 Method and device drafting character string at targeted area
CN102707935A (en) * 2011-03-28 2012-10-03 腾讯科技(深圳)有限公司 Mobile terminal browsing tool and method for setting text properties thereof

Also Published As

Publication number Publication date
CN105786901A (en) 2016-07-20

Similar Documents

Publication Publication Date Title
CN105786901B (en) A kind of method and device adjusting webpage font size
US11853307B1 (en) Query suggestions based on entity collections of one or more past queries
US9069754B2 (en) Method, system, and computer readable medium for detecting related subgroups of text in an electronic document
CN109635077A (en) Calculation method, device, electronic equipment and the storage medium of text similarity
US9582486B2 (en) Apparatus and method for classifying and analyzing documents including text
CN103942189B (en) A kind of method and apparatus for determining works keyword
CN107391667B (en) Entry processing method and mobile terminal
CN103425691A (en) Search method and search system
CN103777866B (en) Data editing method and device for magnifying glass
CN104915186B (en) A kind of method and apparatus making the page
CN107357777A (en) The method and apparatus for extracting label information
CN113190683A (en) Enterprise ESG index determination method based on clustering technology and related product
CN105159927B (en) Method and device for selecting subject term of target text and terminal
CN107315735B (en) Method and equipment for note arrangement
CN106249879A (en) The display packing of a kind of virtual reality image and terminal
JP5559750B2 (en) Advertisement processing apparatus, information processing system, and advertisement processing method
US10254959B2 (en) Method of inputting a character into a text string using a sliding touch gesture, and electronic device therefor
CN107870985A (en) A kind of method, server and computer-readable recording medium for retrieving information
CN108920660B (en) Keyword weight obtaining method and device, electronic equipment and readable storage medium
CN107179857A (en) A kind of calculator system
CN115729360A (en) Input method word stock updating method, device, equipment and server
Chan Singular Fourier–Padé series expansion of European option prices
CN103197764B (en) Spelling input method and device
CN111159408A (en) Text data labeling method and device, computer device and computer readable storage medium
CN110083812A (en) Picture layout method and device, the electronic equipment of electronic document

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200528

Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Alibaba (China) Co.,Ltd.

Address before: 510627 Guangdong city of Guangzhou province Whampoa Tianhe District Road No. 163 Xiping Yun Lu Yun Ping B radio 14 floor tower square

Patentee before: Guangzhou Dongjing Computer Technology Co.,Ltd.

OL01 Intention to license declared