FontWeight 结构

定义

以笔画的粗细来引用字体的密度。Refers to the density of a typeface, in terms of the lightness or heaviness of the strokes.

public value class FontWeight : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.FontWeightConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None)]
public struct FontWeight : IFormattable
type FontWeight = struct
    interface IFormattable
Public Structure FontWeight
Implements IFormattable
继承
FontWeight
属性
实现

示例

在下面的代码示例中, FontWeight将设置为 "超粗"。In the following code example, the FontWeight is set to "UltraBold".

<TextBlock FontWeight="UltraBold" FontFamily="Gil Sans MT">Hello, world</TextBlock>

注解

通常, 相对于同一字样中的 "正常" 字符, 与字样中给定字符相关联的笔划或粗细增加了权重差异。Weight differences are generally differentiated by an increased stroke or thickness that is associated with a given character in a typeface, as compared to a "normal" character from that same typeface.

注意并非所有权重都适用于所有字样。Note Not all weights are available for all typefaces. 当某个权重不可用于某个字样时, 将返回最接近的匹配权重。When a weight is not available for a typeface, the closest matching weight is returned.

XAML 属性用法XAML Attribute Usage

<object fontWeightProperty="fontWeightsValue"/>  

XAML 值XAML Values

fontWeightsValuefontWeightsValue
FontWeights属性名称, 如 "Light"、"Normal" 或 "超粗"。A FontWeights property name, such as "Light", "Normal", or "UltraBold".

方法

Compare(FontWeight, FontWeight)

比较 FontWeight 的两个实例。Compares two instances of FontWeight.

Equals(FontWeight)

确定当前的 FontWeight 对象是否与指定的 FontWeight 对象相等。Determines whether the current FontWeight object is equal to a specified FontWeight object.

Equals(Object)

确定当前的 FontWeight 对象是否与指定对象相等。Determines whether the current FontWeight object is equal to a specified object.

FromOpenTypeWeight(Int32)

创建 FontWeight 的一个新实例,该实例对应于 OpenTypeOpenType usWeightClass 值。Creates a new instance of FontWeight that corresponds to the OpenTypeOpenType usWeightClass value.

GetHashCode()

检索此对象的哈希代码。Retrieves the hash code for this object.

ToOpenTypeWeight()

返回一个值,该值表示 FontWeight 对象的 OpenTypeOpenType usWeightClassReturns a value that represents the OpenTypeOpenType usWeightClass for the FontWeight object.

ToString()

返回一个文本字符串,该字符串表示 FontWeight 对象的值且基于 CurrentCulture 属性信息。Returns a text string that represents the value of the FontWeight object and is based on the CurrentCulture property information.

运算符

Equality(FontWeight, FontWeight)

比较 FontWeight 的两个实例是否相等。Compares two instances of FontWeight for equality.

GreaterThan(FontWeight, FontWeight)

FontWeight 的两个实例进行计算,以确定其中一个实例是否大于另一个实例。Evaluates two instances of FontWeight to determine whether one instance is greater than the other.

GreaterThanOrEqual(FontWeight, FontWeight)

FontWeight 的两个实例进行计算,以确定其中一个实例是否大于或等于另一个实例。Evaluates two instances of FontWeight to determine whether one instance is greater than or equal to the other.

Inequality(FontWeight, FontWeight)

FontWeight 的两个实例进行评估,以确定它们是否不相等。Evaluates two instances of FontWeight to determine inequality.

LessThan(FontWeight, FontWeight)

FontWeight 的两个实例进行计算,以确定其中一个实例是否小于另一个实例。Evaluates two instances of FontWeight to determine whether one instance is less than the other.

LessThanOrEqual(FontWeight, FontWeight)

FontWeight 的两个实例进行计算,以确定其中一个实例是否小于或等于另一个实例。Evaluates two instances of FontWeight to determine whether one instance is less than or equal to the other.

显式接口实现

IFormattable.ToString(String, IFormatProvider)

有关此成员的说明,请参见 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

适用于

另请参阅