Are preferred font sizes in Windows8 going to require a calculator?

荒凉一梦 提交于 2019-12-10 14:43:55

问题


While looking at some official Windows8/"Metro" material, I see this line of xaml:

<TextBlock Text="Contoso Cookbook" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="26.667" />

What?!? A font size of 26.667? I realize this is 2/3rds of 40, and 5/6ths of 32, so maybe there's some conversion thing happening there, but is this going to be the preferred way of setting font sizes, and if so, what are the guidelines for coming up with these seemingly random sizes?


回答1:


There are pre-defined Windows 8 styles, located in your project in Common\StandardStyles.xaml. Take those as the standard.

The size you are talking about belongs to SubheaderTextStyle.

Here is why you get the "weird" size. If you look at the typography guidelines, you see the values in points. However, in XAML you specify the font size in pixels. Sample to go with: 96 PPI (pixel-per-inch) display. In 1 inch, you get 72 points. Doing simple math:

96 pixels per inch / 72 points per inch = 1.(3) pixels/point

So, 26.667 / 1.(3) ~ 20pt

This way, you are getting a consistent font size.



来源:https://stackoverflow.com/questions/11876143/are-preferred-font-sizes-in-windows8-going-to-require-a-calculator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!