如何在.NET中绘制0..255范围之外的Wingdings 2字符?
标准 Windows Charmap 实用程序显示“Wingdings 2”字体中的相当多字符,其字符代码大于 255 - 例如,0xE4E 显示一只手。
但是,如果我尝试按如下方式绘制这些字符:
g.DrawString(new string((char) 0xE4E, 1), new Font("Wingdings 2", 20), brush, x, y);
那么我得到的只是一个标准的“盒子”替换字符。这很奇怪,因为上面的代码适用于 0x21 和 0xFF 之间的 Wingdings 2 符号,也适用于 Arial Unicode MS 中的所有符号。
我怎样才能从这种特定的字体中绘制这些字符?有单独的API吗?
(Win7;.NET 3.5 SP1)
PS 这是带有重复字符范围的奇怪字符映射字体:
The standard windows Charmap utility shows quite a few characters in the "Wingdings 2" font whose character codes are greater than 255 - for example, 0xE4E shows a hand.
However, if I try to draw these characters as follows:
g.DrawString(new string((char) 0xE4E, 1), new Font("Wingdings 2", 20), brush, x, y);
then all I get is a standard "box" replacement character. This is weird, because the above code works for Wingdings 2 symbols between 0x21 and 0xFF, and also works for ALL symbols in, say, Arial Unicode MS.
How can I draw those characters from this particular font? Is there a separate API?
(Win7; .NET 3.5 SP1)
P.S. Here's the weird Character Map font with the duplicated character ranges:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,没有特殊的 API,字体本身也不是特殊的。温丁斯等人。只是不要使用字符代码的“预期”字形
但是,我在 Charmap 中没有看到该字符具有该字体的字符代码(Win 7)。如果你想到的是我认为你想到的角色,那就是 0x4E。
字符映射表中的 Wingdings 2 http://img213.imageshack.us/img213/5746/charmapwingdings2 .png
No, there is no special API, nor is the fonts special per se. Wingdings et al. just don't use the "expected" glyphs for the character codes
However, I don't see that character in Charmap with that character code for that font (Win 7). If you're thinking of the character I think you're thinking of, it's just 0x4E.
Wingdings 2 in Character Map http://img213.imageshack.us/img213/5746/charmapwingdings2.png
在我的 CharMap (Vista) 中,WinDings 2 只到 0xFF
所以你的代码是好的,你的 (char) 代码有疑问。
In my CharMap (Vista), WinDings 2 only goes as far as 0xFF
So your code is good, you (char)codes are in doubt.