简体   繁体   English

如何计算字体对象的x高度即ex?

[英]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.

相关问题 如何计算文件增量,即更改的文件部分 - How to calculate delta on file i.e. changed file portion 如何从X的Button(即X内的Button)onclick事件获取Usercontrol对象“ X” - How to get Usercontrol object 'X' from X's Button(i.e. Button inside the X) onclick event 如何匹配2个字符串X%(即> 90%匹配) - How to match 2 strings by X% (i.e. >90% matching) 如何从另一个类的静态方法(即只有一个对象)调用实例方法? - How do I call an instance method from another classes' static method (i.e. have only one object)? 我如何解析ms Outlook 2003电子邮件正文中的字符串,即关键字“错误” - How do I parse ms outlook 2003 email body for a string i.e. keyword 'error' 如何重置静态字段(即触发下次创建类时再次创建它)? - How do I Reset a Static Field (i.e. trigger it to be created again the next time the class is created)? 使用.Net如何使用Sort方法反向排序数组,即Z到A? - Using .Net how do I use the Sort method to sort an Array in reverse i.e. Z to A? 如何在多个类中访问同一IoC容器(即Unity)? - How do I access the same IoC container (i.e. Unity) in multiple classes? 如何在MVC POST中更改文化以允许(例如)西班牙日期时间? - How do I Change culture to allow (i.e.) spanish datetime in MVC POST? 如何将字节数组(即 byte[])保存到 Azure Blob 存储? - How do I save byte arrays i.e. byte[] to Azure Blob Storage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM