FontUri Property

Gets or sets the Uri that represents the location of the font used for rendering the Glyphs.

XAML
<object FontUri="string" .../>
Scripting
value = object.FontUri
object.FontUri = value

Property Value

string

A value that represents the URI source of the font.

This property is read/write. The default value is null.

Remarks

The URI you specify must use the same scheme as the hosting HTML page. Generally, the best practice for specifying the URI is to use a relative URI. The starting location for the relative reference is the HTML page that contains the current Silverlight plug-in. Setting a cross-domain URI or explicit file: scheme for FontUri is not permitted; a downloader error is thrown. Also, backslashes (\) in Silverlight URIs are not permitted; always use forward slashes (/). An additional URI consideration for FontUri is that the hash sign (#) has special meaning that overrides its usual HTML meaning; the hash is used to target a font offset within a TrueType collection.

FontUri supports fonts in the OTF and TTF formats.

FontUri supports obfuscated fonts. Obfuscated fonts are an XPS concept that is implemented by Microsoft technologies that use XPS as a document format. You can produce an XPS document that contains the necessary obfuscated subsetted font, rename the XPS document so that it can be recognized as a ZIP package, then extract the obfuscated font as a part. The part name will be a GUID. Changing the name of the obfuscated font file/part is not supported and must conform to the XPS obfuscation scheme. In addition, obfuscated fonts must have the "odttf" or "odttc" file extension.

If you use obfuscated fonts in this way, make sure that the XPS document that produces the obfuscated font has a matching UnicodeString content within the XPS content to what you will specify as the Glyph UnicodeString. Depending on your document save options, the XPS obfuscated font is typically drastically subsetted and will only include glyph mappings for the Unicode information from that XPS document.

FontUri also supports TTC (TrueType Collection) fonts. Using this mode, you can index a specific font face offset in the collection, in the format collectionname.ttc#n where n is the index within the collection. You can omit "#0" if you intend to reference the first font face in the collection.

Note   As with most types of software, font files are licensed, rather than sold, and licenses that govern the use of fonts vary from vendor to vendor. As a developer it is your responsibility to ensure that you have the required license rights for any font you embed within a document or application, or otherwise redistribute.

Applies To

Glyphs

See Also

Text and Fonts Overview
TextBlock