净不一致的字体渲染 [英] .Net Inconsistent Font rendering

查看:122
本文介绍了净不一致的字体渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造一个NET 2.0 SP2的Windows窗体应用程序。该表格​​字体看起来很好,在我的机器上,当我试图在另一台机器,它看起来更大。 (这不是分辨率差,因为,字体较大的相对于其它图标等)

I am creating an .Net 2.0 SP2 windows Forms Application. The form fonts looks fine in my machine, when i tried in another machine, it looks bigger. (This is not because of resolution difference, fonts are bigger relatively to other icons etc.)

我试图调试问题,发现以下code返回在不同的机器不同的尺寸。

I tried to debug the problem and found following code returns different sizes on different machine.

//inside a windows form
private void checkfont()
{
    var g = this.CreateGraphics();
    MessageBox.Show(g.MeasureString("Hello World", this.Font) + "," + this.Font);
}

我希望graphics.measurestring()返回在不同的机器相同的参数值相同。

I expect graphics.measurestring() to return same value for same arguments in different machines.

有关字体宋体8.25

  • 在机器1Hello World的措施69.0px,14.7px
  • 在机器2Hello World的措施86.3px,18.4px

为什么这种差异?也正因为如此我的应用程序的字体看起来更大,影响布局。

Why this difference ? because of this my application fonts looks bigger and affect layout.

编辑:

这两款机器了.NET 2.0 SP2,但它们的分辨率和屏幕尺寸不同。据我所知,字体外形尺寸(物理屏幕上)将随分辨率和屏幕尺寸。但我的问题是,为什么它们在像素单元的尺寸有什么区别?

Both Machines have .Net 2.0 SP2 , but their resolution and screen sizes differ. I understand that fonts physical dimension (on physical screen) will vary with resolution and screen size. But my question is why their dimension in pixel units differ ?

机2是 eeetop ET1602 与Windows XP,它的触摸屏系统中,默认情况下它与所有的桌面字体更大来了,但我有重置Windows主题/ Windows字体为默认值。

Machine 2 is eeetop ET1602 with windows xp, its touch screen system, by default it came with all desktop fonts bigger, but i have reset windows theme/windows fonts to default.

推荐答案

在secify宋体8.25,这8.25无关直接,相反,他们被认为是点的像素,它们将被不同的呈现不同的机器如果屏幕的DPI是不同的。

When you secify "Verdana 8.25" , this 8.25 has nothing to do with pixels directly, instead they are considered as "Points" and they will be rendered differently on different machines if the Screen DPI is different.

在Windows中,在桌面设置,你必须增加屏幕字体大小不改变分辨率的选项。如果增加屏幕字体大小,然后点按它可以测量不同的像素大小不同的机器上同一文本像素变化。

In Windows, under Desktop settings you have option of increasing the screen font size without changing the resolution. If you increase screen font size then the Dot per pixel changes which can measure different pixel size for same text on different machine.

这是由于事实,老人们看不懂较小的字体,这就是为什么他们可以增加桌面设置字体大小。而且只能在指定点的字体大小,如果字体尺寸将固定为像素,这将是困难的老人或视障人士能正确朗读课文。这种方式的整个操作系统的文本大小是在由用户控制。

This is due to fact that old people can not read smaller fonts, thats why they can increase the font size in desktop settings. And you can only specify the font size in points, if font size will be fixed to pixels, it will be difficult for the old or visually impaired people to read the text correctly. This way the text size of entire operating system is in control by the user.

这篇关于净不一致的字体渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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