[英]How do I calculate x-height i.e. ex of a Font object?
The x-height is a font metric, that is given in terms of the em-height, and is approximately 0.48 of an em, but this depends on the font... x高度是字体度量,以em-height的形式给出,大约是em的0.48,但这取决于字体......
In CSS these two units are available, I am interested in the ex unit. 在CSS这两个单位可用,我对前单位感兴趣。 There is also an em unit, such that the ex unit is given in terms of it.
还有一个em单元,这样就可以给出ex单元。
The following table shows some metrics, available throug the following site: 下表显示了一些指标,可通过以下站点获得:
http://www.cs.tut.fi/~jkorpela/x-height.html http://www.cs.tut.fi/~jkorpela/x-height.html
Arial 0.519
Arial Unicode MS 0.518
Calibri 0.466
Cambria 0.466
Candara 0.463
Code2000 0.444
Comics Sans MS 0.532
Courier 0.425
Courier New 0.423
Garamond 0.384
Georgia 0.481
Helvetica 0.523
Tahoma 0.545
Times New Roman 0.448
Trebuchet MS 0.523
Verdana 0.545
I want to know the x-height of a given Font object in C#. 我想知道C#中给定Font对象的x高度。 I get the M height like this:
我得到这样的M高度:
TextRenderer.MeasureText("M", font).Height
But I can not figure out how to get the x-height. 但我无法弄清楚如何获得x高度。
Using WinAPI is acceptable. 使用WinAPI是可以接受的。 It does not matter the way... browsers do this.
它的方式并不重要......浏览器这样做。 They know how to calculate the ex value, I want to know how to get this value too.
他们知道如何计算ex值,我想知道如何获得这个值。 Please help!!
请帮忙!!
Thanks. 谢谢。
Related question that helps convert Font to Typeface:
有助于将Font转换为Typeface的相关问题:
How to convert System.Drawing.font to System.Windows.Media.Fonts or TypeFace
如何将System.Drawing.font转换为System.Windows.Media.Fonts或TypeFace
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.