mar*_*t15 29 html fonts font-size
我需要转换<font size="10">为px.
仅示例(不正确):<font size="10">相当于12px.
是否有任何公式或表转换转换<font size="10">为px?
Eug*_*ota 41
<font size=1>- font size 1</font><br>
<span style="font-size:0.63em">- font size: 0.63em</span><br>
<font size=2>- font size 2</font><br>
<span style="font-size: 0.82em">- font size: 0.82em</span><br>
<font size=3>- font size 3</font><br>
<span style="font-size: 1.0em">- font size: 1.0em</span><br>
<font size=4>- font size 4</font><br>
<span style="font-size: 1.13em">- font size: 1.13em</span><br>
<font size=5>- font size 5</font><br>
<span style="font-size: 1.5em">- font size: 1.5em</span><br>
<font size=6>- font size 6</font><br>
<span style="font-size: 2em">- font size: 2em</span><br>
<font size=7>- font size 7</font><br>
<span style="font-size: 3em">- font size: 3em</span><br>
Run Code Online (Sandbox Code Playgroud)
使用接受答案中的数据点,您可以使用多项式插值来获得公式.
WolframAlpha输入:插值多项式{{1,.63},{2,.82},{3,1},{4,1.13},{5,1.5},{6,2},{7,3}}
公式:0.00223611x ^ 6 - 0.0530417x ^ 5 + 0.496319x ^ 4 - 2.30479x ^ 3 + 5.51644x ^ 2 - 6.16717x + 3.14
并在Groovy代码中使用:
import java.math.*
def convert = {x -> (0.00223611*x**6 - 0.053042*x**5 + 0.49632*x**4 - 2.30479*x**3 + 5.5164*x**2 - 6.167*x + 3.14).setScale(2, RoundingMode.HALF_UP) }
(1..7).each { i -> println(convert(i)) }