Windows8中首选的字体大小是否需要计算器? [英] Are preferred font sizes in Windows8 going to require a calculator?

查看:193
本文介绍了Windows8中首选的字体大小是否需要计算器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < TextBlock Text =Contoso CookbookFontFamily =Segoe UIFontWeight =SemiLightFontSize =26.667/> 

什么?!?字体大小为26.667?我意识到这是40的2/3和32的5/6,所以也许有一些转换的事情发生在那里,但是这将成为设置字体大小的首选方式,如果是的话,什么是来这些看起来是随机的大小?

解决方案有预定义的Windows 8样式,位于您的项目中 Common\StandardStyles.xaml 。以这些为标准。

您所谈论的大小属于 SubheaderTextStyle

这就是为什么你得到怪异的大小。如果您查看排版指南,则可以看到以磅为单位的值。但是,在XAML中,您可以指定以像素为单位的字体大小。样品去:96 PPI(像素每英寸)显示。在1英寸,你得到72分。做简单的数学运算:

 每英寸96像素/每英寸72点= 1.(3)pixels / point 

所以, 26.667 / 1.(3)〜20pt



通过这种方式,您可以获得一致的字体大小。


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?

解决方案

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.

这篇关于Windows8中首选的字体大小是否需要计算器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆