NumberSubstitutionMethod 枚举


定义一个枚举类,该枚举类指定对文本运行中的数字执行的数字替换的类型。Defines an enumerator class that specifies the type of number substitution to perform on numbers in a text run.

public enum class NumberSubstitutionMethod
public enum NumberSubstitutionMethod
type NumberSubstitutionMethod = 
Public Enum NumberSubstitutionMethod


AsCulture 0

默认。Default. 指定应该根据数字区域性的 DigitSubstitution 属性值来确定替换方法。Specifies that the substitution method should be determined based on the number culture's DigitSubstitution property value.

Context 1

如果数字区域性为阿拉伯语、波斯语或达里语区域性,则指定数字取决于上下文。If the number culture is an Arabic, Persian, or Dari culture, specifies that the digits depend on the context. 根据紧靠在前面的强字符(如果没有,则根据段落的文本方向)来使用传统数字或拉丁数字。Either traditional or Latin digits are used depending on the nearest preceding strong character, or, if there is none, the text direction of the paragraph.

European 2

指定将码位 0x30-0x39 始终呈现为欧洲数字,在这种情况下,不需要执行数字替换。Specifies that code points 0x30-0x39 are always rendered as European digits, in which case, no number substitution is performed.

NativeNational 3

指定使用由区域性的 NativeDigits 属性值所指定的数字区域性民族数字来呈现数字。Specifies that numbers are rendered using the national digits for the number culture, as specified by the culture's NativeDigits property value.

Traditional 4

指定使用数字区域性民族数字来呈现数字。Specifies that numbers are rendered using the traditional digits for the number culture. 对于大多数区域性,这与 NativeNational 枚举值相同。For most cultures, this is the same as the NativeNational enumeration value. 但是,使用 NativeNational 可以让某些阿拉伯语区域性产生拉丁数字,而使用 Traditional 可让所有阿拉伯语区域性产生阿拉伯数字。However, using NativeNational can result in Latin digits for some Arabic cultures, whereas using Traditional results in Arabic digits for all Arabic cultures.


大多数区域性使用 decimal 系统来表示数字, 但许多区域性使用不同的数字形状。Most cultures use the decimal system to represent numbers, but many cultures use different digit shapes. 下表显示了不同区域性使用的多个编号系统。The following table shows several numbering systems used by different cultures.

数字替换标志符号表Table of number substitution glyphs
不同区域性中的数字外观示例Example of the appearance of digits in different cultures

为每组数字形状提供备用的 Unicode 码位是不够的, 因为与字母不同, 在计算中使用数字。It is not sufficient to provide alternate Unicode code points for each set of digit shapes, because, unlike letters, digits are used in calculations. 每个应用程序、每个操作系统和每个运行时库都包含专用于将内部二进制格式数值转换为字符串的代码, 反之亦然。Every application, every operating system, and every run-time library contains code dedicated to converting an internal binary format numeric value to a string of characters, and vice versa. 这些转换例程被编码为使用 Unicode 数字 "0030" 到 "0039"。These conversion routines are coded to use Unicode digits "0030" through "0039".

NumberSubstitution类提供允许不同区域性在呈现时替换适当的数字形状的功能。The NumberSubstitution class provides functionality that allows different cultures to substitute the appropriate digit shapes at rendering time. 此功能与用于提供字体替换和语言相关字体呈现的功能类似。This functionality is similar to the one used for providing font substitution and language dependent font rendering.


许多区域性都放弃了其传统的数字形状, 并采用了西方数字形状, 因此, number 替换功能可识别传统数字形状和国家/地区标准数字形状之间的每个区域性的区别。Many cultures are discarding their traditional digits shapes and adopting Western digits shapes, therefore the number substitution functionality recognizes the distinction for each culture between traditional digit shapes and national standard digit shapes.