Prev | Current Page 363 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

xaml
This URI is made available in several places, including through the FontFamily.BaseUri
property. WPF uses this URI to base its font search. Thus, when you use the ./ syntax in a
compiled WPF application, WPF looks for fonts that are embedded as resources alongside
your compiled XAML.
After the ./ character sequence, you can supply the file name, but you??™ll usually just add
the number sign (#) and the font??™s real family name. In the previous example, the embedded
font is named Bayern.
nNote Setting up an embedded font can be a bit tricky. You need to make sure you get the font family
name exactly right, and you need to make sure you choose the correct build action for the font file. Furthermore,
Visual Studio doesn??™t currently provide design support for embedded fonts (meaning your control text
won??™t appear in the correct font until you run your application). To see an example of the correct setup, refer
to the sample code for this chapter.
Embedding fonts raises obvious licensing concerns. Unfortunately, most font vendors
allow their fonts to be embedded in documents (such as PDF files) but not applications (such
as WPF assemblies) even though an embedded WPF font isn??™t directly accessible to the end
user. WPF doesn??™t make any attempt to enforce font licensing, but you should make sure
you??™re on solid legal ground before you redistribute a font.


Pages:
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375