FontStretch Structure
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Describes the degree to which a font has been stretched, compared to the normal aspect ratio of that font.
Namespace: System.Windows
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Public Structure FontStretch
public struct FontStretch
<object property="fontStretchesPropertyName"/>
XAML Values
- fontStretchesPropertyName
A FontStretches static property name, such as Condensed, Normal, or Expanded.
The FontStretch type exposes the following members.
Methods
Name | Description | |
---|---|---|
Equals | Compares an object with the current FontStretch object. (Overrides ValueType.Equals(Object).) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Retrieves the hash code for this object. (Overrides ValueType.GetHashCode().) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Creates a String representation of the current FontStretch object. (Overrides ValueType.ToString().) |
Top
Operators
Name | Description | |
---|---|---|
Equality | Compares two instances of FontStretch for equality. | |
Inequality | Evaluates two instances of FontStretch to determine inequality. |
Top
Remarks
A font stretch describes the degree to which a font form is stretched from its normal aspect ratio, which is the original width to height ratio specified for the glyphs in the font.
This structure provides compatibility between Silverlight and WPF properties that specify a font stretch. The compatibility requirement is that in Silverlight 1.0, the relevant properties reference FontStretch, which is an enumeration, whereas WPF relevant properties referenced FontStretches, a class with static properties.
FontStretch is the value type for Silverlight properties or attributes that specify a font stretches value, but you must use static properties of FontStretches to provide a FontStretch value. In XAML, you specify the name of a FontStretches property as the attribute value. This functionality is enabled by native XAML parsing behavior that processes the string value.
FontStretches Static Property Names
Font stretch |
usWidthClass |
% of normal |
---|---|---|
1 |
50.0% |
|
2 |
62.5% |
|
3 |
75.0% |
|
4 |
87.5% |
|
5 |
100% |
|
6 |
112.5% |
|
7 |
125.0% |
|
8 |
150.0% |
|
9 |
200.0% |
Medium is also an accepted string value for XAML and type conversion, and evaluates to the same value as Normal, but Medium does not exist as a static property and therefore cannot be specified in code.
The FontStretches values correspond to the usWidthClass definition in the OpenType specification. The usWidthClass represents an integer value between 1 and 9—lower values indicate narrower widths; higher values indicate wider widths.
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.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.