基于字体签名的C#字体选择 [英] C# Font selection based on font signature

查看:197
本文介绍了基于字体签名的C#字体选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要显示中文字符(最好是Unicode)的应用程序.在VS2008 C ++ Pro中,我可以通过字体签名过滤枚举字体:

I have an application that requires display of Chinese characters (preferably Unicode). In In VS2008 C++ Pro I can filter the enumerated fonts via font signature:

int CALLBACK MyApp::EnumFontCallback(...)
{
ENUMLOGFONTEX *lpelfe;
NEWTEXTMETRICEX *lpntme;

int nSimpCh = (lpntme->ntmFontSig.fsCsb[0] >> 17) && 0x1;
if (nSimpCh!=1) return;
int nTradCh = (lpntme->ntmFontSig.fsCsb[0] >> 19) && 0x1;
if (nTradCh=1) return;
...
else ListBox1.Items.Add(".....fontname ...");
....
}



如何在VS2010 C#(快速表达)中执行此操作?最接近的是InstalledFontCollection()和IsStyleAvailable()-但这非常简单,无法确定哪个字体家族包含Unicode中文.

谢谢.


[Edited]代码被包装在"pre"标签中[/Edited]



How can I do this in VS2010 C# (express)? The closest thingy is the InstalledFontCollection() and IsStyleAvailable() - but that is very simplistic and has no option to determine which of the font family contains Unicode Chinese.

Thanks.


Code is wrapped in "pre" tags[/Edited]

推荐答案

如今,中文几乎完全支持Unicode(其他一切都必须消亡).而且大多数字体都支持两种脚本(简体和繁体).但是,此问题很合理.

解决方案的说明如下: http://stackoverflow.com/questions/1439551/get-supported-characters-of-a-font-in-c [
These days, Chinese is supported almost exclusively in Unicode (everything else must die). And most font support both scripts (simplified and traditional). However, this Question makes perfect sense.

The solution is explained here: http://stackoverflow.com/questions/1439551/get-supported-characters-of-a-font-in-c[^].

If something is not clear, post a comment to this answer, I''ll answer later (I need to sleep :-))
I''m familiar with Chinese to certain point :-).

—SA


SAKryukov

非常感谢您的帮助.您一直非常乐于助人,但确实可以打到头上:

我需要在VS2010 VS#express中访问VS C ++的字体签名".

谢谢
SAKryukov

Many thanks for your help. You have been very helpful but really to hit the nail on the head:

I need to access the equivalent of VS C++''s "font signature" in VS2010 VS# express.

Thanks


这篇关于基于字体签名的C#字体选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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