Compartir a través de


Glyphs.FontUri Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the location of the font used for rendering the glyphs.

Namespace:  System.Windows.Documents
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property FontUri As Uri
public Uri FontUri { get; set; }
<Glyphs FontUri="uriString"/>

Property Value

Type: System.Uri
The URI source of the font. The default is nulla null reference (Nothing in Visual Basic).

Remarks

Dependency property identifier field: FontUriProperty

The URI you specify must use the same scheme as the hosting HTML page. Usually you specify the font by using a relative URI path. The starting location for the relative reference is the HTML page that contains the current Silverlight plug-in. You cannot set an explicit file: location for FontUri. Backslashes (\)are not permitted in Silverlight URIs; always use forward slashes (/). The number sign (#) in FontUri specifies a font offset within a TrueType collection, overriding its usual HTML meaning. You can specify a cross-domain source for FontUri if this is allowed by the source server configuration.

NoteNote:

Any font specified by FontUri must reside in a font file or zip file of fonts that is embedded in a DLL as a resource.

FontUri supports fonts in the OTF and TTF formats. FontUri also supports obfuscated fonts. Obfuscated fonts are an XPS concept implemented by Microsoft technologies that use the XPS document format. You can produce an XPS document that contains the necessary obfuscated subsetted font, rename the XPS document to have a .zip extension, and then extract the obfuscated font as a part. The part name will be a GUID. The obfuscated font file must have an .odttf or .odttc file extension, and you cannot change the file name.

If you use obfuscated fonts in this way, make sure that the XPS document that produces the obfuscated font has UnicodeString content within the XPS content that matches what you specify as the value of the UnicodeString property. 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. You can index a specific font face offset in the collection using 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.

NoteNote:

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.