Hieu Nguyen
Hieu Nguyen

Reputation: 404

Font in silverlight for Windows Phone 7

I want to use a font for textbox in my silverlight application for Windows Phone 7. The font isn't contained in the default font list.

Here is xaml code for applying the font to a textbox:

<TextBlock Grid.Row="1" Height="95" HorizontalAlignment="Left" Margin="527,78,0,0" Name="textBox" Text="0" VerticalAlignment="Top" FontSize="72" Width="70" FontFamily="/MyAppNamespace;component/Fonts/Fonts.zip#Papyrus"/>

The font is included in the folder Fonts. The XAML view window for this page show exact font style that I want. But when I tried to deploy the app to my Samsung Omnia 7 the font used is still Segoe WP (the default font for text box).

So what's the problem here?

Upvotes: 0

Views: 465

Answers (1)

Mike Post
Mike Post

Reputation: 6460

You need to include the font in your application. The easiest way to do this is to go into Blend, select your TextBlock element, go to Text properties section, and click the Embed checkbox. Note that if you're using a separate build server, this will require you to have the Blend SDK installed on that system. (For font embedding, Blend uses a custom build target. I believe it's the SDK adds this build target to the target system.)

The reason you're seeing Segoe WP is because your specified font is not found, so the runtime is falling back to a font it knows. You haven't specified any fallback fonts, so it's using the default of Segoe WP.

Upvotes: 1

Related Questions