WPF字体:为什么有些字符丢失? [英] WPF Font: Why are some characters missing?

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

问题描述

我正在写一个WPF应用程序,而且我正在使用的字体 在WPF中运行时遇到了问题 - 在任何其他方面(记事本,写字板等)都可以正常使用。 WPF的问题在于它有时会回退到另一个字体。 有时候的意思是只有字符[a-zA-Z]看起来能够正确渲染,其他的东西看起来都是默认的TextBox字体。

有谁知道WPF是否对它支持的字体有某种限制?这似乎是在WPF中的错误 - 字体在其他地方工作正常。

我试图使用的字体是ScrambleTTF字体( http://famousfonts.smackbomb.com/fonts/scrabble.php )。



数字和空格应该被看作是一个空白的Scrabble / Scramble,但是数字本身出现在我正在使用的文本框中。



我正在使用的代码:

 < TextBox Text =测试测试测试FontFamily =Fonts / #Scramble/> 

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

谢谢!

解决方案

From < a href =http://msdn.microsoft.com/en-us/library/system.windows.media.fontfamily.aspx =noreferrer> MSDN :


字体后退
$ b 字体后备是指自动
替换客户
应用程序选择的
字体以外的字体。有两个主要的
原因调用字体回退:


  • 由客户端应用程序指定的字体不存在

  • 由客户端应用程序指定的字体不包含
    所需的字形,用于呈现文本。在WPF中,字体回退机制
    使用默认的回退字体系列
    全局用户界面 ,作为
    替换字体。该字体被定义为
    作为复合字体,其文件名

    GlobalUserInterface.CompositeFont。
    有关组合
    字体的更多信息,请参阅本主题中的复合字体部分



    WPF字体回退机制
    替换了以前的Win32字体
    替换技术。

我的猜测是字体不支持Unicode - 字体本身是在1996年创建的,因为它的目的是模仿拼字游戏的作品,我不确定字体作者甚至考虑本地化。



编辑
根据字体文档,字体支持字母,任何数字应该呈现一个空白的瓷砖。空间不会渲染一个贴图。


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.

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.

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.

The code I'm using:

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

Has anyone else experienced something similar?

Any suggestions would rock!

Thanks!

解决方案

From MSDN:

Font Fallback

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:

  • The font that is specified by the client application does not exist on the system.
  • The font that is specified by the client application does not contain the glyphs that are required to render text.

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.

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

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天全站免登陆