在WPF中嵌入字体不工作 [英] Embedded Font in WPF not working

查看:122
本文介绍了在WPF中嵌入字体不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我用的图标从字体的Segoe UI符号WPF应用程序。但部署到Windows 7时,我意识到图标丢失,因为字体是在Windows 8更新。

I have a WPF application where I use icons from the font "Segoe UI Symbol". But when deploying to Windows 7 I realize the icons are missing because the font is updated in Windows 8.

我试着在WPF应用程序中嵌入字体作为以下说明资源: http://msdn.microsoft.com/en-us/library/ms753303。 。ASPX
,而这是行不通的。

I tried to embed font in WPF application as a resource following these instructions: http://msdn.microsoft.com/en-us/library/ms753303.aspx But it does not work.

起初我有:

<TextBlock FontFamily="Segoe UI Symbol">



而Windows 8的电脑上正常工作。
然后我说seguisym.ttf到目录_Resources,然后使用:

which works fine on Windows 8 computer. Then I added seguisym.ttf to directory "_Resources" and then use:

<TextBlock FontFamily="./_Resources/#Segoe UI Symbol">

这不会在Windows 8或Windows 7没有工作!
我尝试了不同的设置BuildAction的:资源,嵌入的资源和内容,但他们没有工作。

This does not work on neither Windows 8 or Windows 7! I tried different settings for BuildAction: Resource, Embedded Resource and Content, but none of them work.

推荐答案

我终于找到了一种利用安装旧版本,即使当的Segoe UI符号的新版本(即上Windows 7的)。这种方法的工作原理,可以在ClickOnce的安装,不需要自举

I finally found a way to use the newer version of "Segoe UI Symbol" even when older version is installed (i.e. on Windows 7). This approach works also in ClickOnce installation and requires no bootstrapping.

我想这个问题是通过与已经装入在Windows字体的名称冲突引起的。所以我改名为新版本,以避免冲突。它的工作原理

I guess the problem is caused by a name conflict with a font already loaded in Windows. So I renamed the newer version to avoid the conflict. It works.

1) Download utility program Typograf from this link: http://www.neuber.com/typograph/
2) Open directory where you have a copy of your font file
3) Click on font in list
4) Click Properties button in bar
5) Click Rename button, specify a new name (I chose "SegoeDynamic") and select where to save the new file
6) Add the new font file to your Visual Studio project directory (my directory is "/_Resources")
7) Use relative path or root path as you wish when referencing the font dynamically

 <TextBlock FontFamily="../_Resources/#SegoeDynamic">
 <TextBlock FontFamily="pack://application:,,,/_Resources/#SegoeDynamic">

请观察的Segoe UI符号多个版本,每个版本增加了更多的符号被释放。我已经发现至少有以下内容:

Please observe that "Segoe UI Symbol" is released in several versions where each version adds more symbols. I have discovered at least the following:

Windows 7中:5.01(823KB)

Windows 7: 5.01 ( 823kb)

Windows 8中:5.90( 1660kb)

Windows 8: 5.90 (1660kb)

是Windows 8.1:6.09(1740kb)

Windows 8.1: 6.09 (1740kb)

这篇关于在WPF中嵌入字体不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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