WPF 字体:为什么缺少某些字符? [英] WPF Font: Why are some characters missing?

查看:16
本文介绍了WPF 字体:为什么缺少某些字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 WPF 应用程序,而我使用的字体 only 在 WPF 中运行时出现问题 - 在其他任何东西(记事本、写字板等)中使用它都可以正常工作.WPF 的问题在于它有时会退回到另一种字体.有时"是指只有字符 [a-zA-Z] 似乎可以正确呈现 - 其他所有内容似乎都呈现为默认的 TextBox 字体.

I'm writing a WPF app and the font that I am using only has problems running in WPF - it works fine using it in anything else (notepad, wordpad, etc.). The problem with WPF is that it falls back to another font sometimes. By "sometimes" I mean that only characters [a-zA-Z] appear to render correctly - everything else appears to be rendered as the default TextBox font.

有谁知道 WPF 是否对它支持的字体有某种限制?它几乎似乎是 WPF 中的错误 - 该字体在其他任何地方都可以正常工作.

Does anyone know if WPF has some sort of limitation for the fonts that it supports? It almost seems to be bug in WPF - the font works fine everywhere else.

我尝试使用的字体是Scramble"TTF 字体(http://着名字体.smackbomb.com/fonts/scrabble.php).

The font that I'm trying to use is the "Scramble" TTF font (http://famousfonts.smackbomb.com/fonts/scrabble.php).

数字和空格应该被视为一个空白的拼字游戏/拼字游戏,但数字本身会出现在我正在使用的文本框中.

Numbers and spaces should be seen as a blank Scrabble/Scramble tile, but instead the number itself appears in the textbox I'm using.

我正在使用的代码:

<TextBox Text="Testing testing testing" FontFamily="Fonts/#Scramble" />

有没有其他人经历过类似的事情?

Has anyone else experienced something similar?

任何建议都会动摇!

谢谢!

推荐答案

来自 MSDN:

字体后备

字体回退是指自动替换字体以外的字体客户端选择的字体应用.有两个初级调用字体回退的原因:

Font fallback refers to the automatic substitution of a font other than the font that is selected by the client application. There are two primary reasons why font fallback is invoked:

  • 客户端应用程序指定的字体不存在在系统上.
  • 客户端应用程序指定的字体不包含所需的字形渲染文本.

在 WPF 中,字体回退机制使用默认的后备字体系列,全球用户界面",作为替代字体.此字体已定义作为复合字体,其文件名是GlobalUserInterface.CompositeFont".有关复合材料的更多信息字体,请参阅复合字体部分在这个话题中.

In WPF, the font fallback mechanism uses the default fallback font family, "Global User Interface", as the substitute font. This font is defined as a composite font, whose file name is "GlobalUserInterface.CompositeFont". For more information about composite fonts, see the Composite Fonts section in this topic.

WPF 字体回退机制替换以前的 Win32 字体替代技术.

The WPF font fallback mechanism replaces previous Win32 font substitution technologies.

我的猜测是该字体不支持 Unicode - 字体本身是在 1996 年创建的,由于它旨在模拟拼字游戏,我不确定字体作者是否考虑过本地化.

My guess would be that the font doesn't support Unicode - the font itself was created in 1996, and since it's intended to emulate Scrabble pieces, I'm not sure that the font author even considered localization.

编辑根据字体文档,该字体支持字母,并且任何数字都应该呈现空白图块.空间不渲染图块.

EDIT According to the font documentation, the font supports the letters, and any number is supposed to render a blank tile. Spaces don't render a tile.

这篇关于WPF 字体:为什么缺少某些字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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