不同字符间距在WPF的RichTextBox [英] Differing char spacing in a WPF RichTextBox
问题描述
我有一个自定义的控制我做了。它扩展了一个RichTextBox。
I have a custom control I have made. It extends a RichTextBox.
我有code,设置文档的宽度,使字符的数量是有限的。 (我用宋体,所以我有一个固定宽度的字体。)
I have code that sets the width of the Document so that the number of chars is limited. (I am using Courier New, so I have a fixed width font.)
这一切工作正常。
但是,一旦我把控制我的应用程序,限制开始失效。两相比较后,我指出,我的测试应用和我的实际应用之间的间距是不同的。
But once I put the control in my application, the limit starts failing. After comparing the two, I noted that the spacing between my test application and my real application is different.
下面是一个例子:
正如你可以看到我的间距,测试程序比间距真正的应用程序大。
As you can see my spacing for the Test App is larger than the spacing for the Real App.
我没有任何任何间距,字距,排版或gliph设置(即我能找到),在任何应用程序。另外,我已经检查以字体(FontSpacing,字号...)他们都是一模一样的。
I don't have any any spacing, kerning, typography or gliph settings (that I can find) in either app. Also, I have checked every setting starting with "Font" (FontSpacing, FontSize...) they are all exactly the same.
还有什么可能导致文本应用不同的间隔在一个应用程序,而不是另一个?
请注意:
在情况下,它是相关的,即插入控制到我的测试应用程序的XAML是一样的插入控制到我真正的应用程序的XAML。我将它张贴如果有人想看看吧。
In case it is relevant, the xaml that inserts the control into my test app is the same as the xaml that inserts the control into my real app. I will post it if someone wants to see it.
推荐答案
它可能有做之间的差异的<一个href="http://msdn.microsoft.com/en-us/library/vstudio/system.windows.media.textformattingmode%28v=vs.100%29.aspx"相对=nofollow>理想和显示文本排版模式。看到这个太问题从汉斯一个很好的解释。
It probably has to do with the differences between the Ideal and Display TextFormatting Modes. See this SO Question for a good explanation from Hans.
这篇关于不同字符间距在WPF的RichTextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!