将HTML转换为XAML:将html转换为xaml时,将字体大小乘以4 [英] Converting HTML to XAML:Multiplying the font Size by four when convering html to xaml
问题描述
在我从MSDN获得的示例代码中,我发现在将html转换为xaml字体大小在&hbsp; htmltoxamlconverter.cs文件的getelementproperties方法中乘以4。
ex: -
< p style ="border:none; font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; font-size:13px; line -height:16px">
html字符串:
< p style ='font:normal 63px without-serif; color:#ffffff'>< font face ='without-serif'size ='63'color =' #fffff'> Fun fact< / font>< / p>< p style ='font:24px; color:#ff3333'>< font face ='without-serif'size ='24'color = '#ff3333'>做了
你知道< / font>< / p>
转换后得到的XAML字符串:
< Section xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<段落FontFamily =" / Receiver; component / Fonts / XFINITYSans-Lgt.otf #XFINITY Sans Lgt" FontWeight =" normal" FontSize =" 63" Foreground =" #ffffff" FontStyle =" normal">
< Run FontFamily =" / Receiver; component / Fonts / XFINITYSans-Lgt.otf#XFINITY Sans Lgt" FontSize =" 252" Foreground =" #ffffff">有趣的事实< / Run>
< / Paragraph>
< Paragraph FontFamily =" / Receiver; component / Fonts / XFINITYSans-Bold.otf #XFINITY Sans Reg" FontWeight =" normal" FontSize =" 24" Foreground ="#ff3333">
< Run FontFamily =" / Receiver; component /字体/ XFINITYSans-Lgt.otf#XFINITY Sans Lgt" FontSize =" 96" Foreground ="#ff3333">您知道< / Run>
< / paragraph>
< / section>
请注意,html字符串中提到的字体大小为63是在xaml string中转换为252.Can你能让我们知道为什么这个转换已经完成并且有任何具体原因
您能在这里向我们展示您的转换器代码吗?
Hi,
In the Sample code i got from MSDN i found that while converting html to xaml the font size is being multiplied by four in getelementproperties method of htmltoxamlconverter.cs file.
ex:-
html String:
<p style=‘font: normal 63px without-serif; color: #ffffff’><font face=‘without-serif’ size=‘63’ color=‘#ffffff’>Fun fact</font></p><p style=‘font: 24px; color: #ff3333’><font face=‘without-serif’ size=‘24’ color=‘#ff3333’>did you know</font></p>
XAML String got after the conversion:
<Section xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Paragraph FontFamily="/Receiver;component/Fonts/XFINITYSans-Lgt.otf#XFINITY Sans Lgt" FontWeight="normal" FontSize="63" Foreground="#ffffff" FontStyle="normal">
<Run FontFamily="/Receiver;component/Fonts/XFINITYSans-Lgt.otf#XFINITY Sans Lgt" FontSize="252" Foreground="#ffffff">Fun fact</Run>
</Paragraph>
<Paragraph FontFamily="/Receiver;component/Fonts/XFINITYSans-Bold.otf#XFINITY Sans Reg" FontWeight="normal" FontSize="24" Foreground="#ff3333">
<Run FontFamily="/Receiver;component/Fonts/XFINITYSans-Lgt.otf#XFINITY Sans Lgt" FontSize="96" Foreground="#ff3333">did you know</Run>
</Paragraph>
</Section>
Here please note that font size of 63 mentioned in html string is converted to 252 in xaml string.Can you please let us know why this conversion is done and is there any specific cause in it
Hi, could you please show us your converter code here?
这篇关于将HTML转换为XAML:将html转换为xaml时,将字体大小乘以4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!