Embedded font with compound name is not displayed

Asked

Viewed 54 times

3

I am embedding some fonts in my WPF application but some are not displayed.

Fonts are in the /Fonts folder at the application root and their properties are set to Resource.

Use like this:

<TextBlock FontFamily="pack://application:,,,/Fonts/#Pericles"   />

<TextBlock FontFamily="pack://application:,,,/Fonts/#Pericles Light"   />

In this case, "#Pericles" whose name is simple, displays normally. Already "#Pericles Light" which has compound name, does not display. Although several examples I found suggest this shape, I believe there must be some escape character for the spaces in the font name. It will be?

  • You mean \?

  • I believe backslash does not work in XAML. I tried &#160; unsuccessfully. :(

1 answer

1

One solution is to add the source file name:

<TextBlock FontFamily="pack://application:,,,/Fonts/PERICL.TTF#Pericles Light"   />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.