Platform SDK: International Features |
Arabic, Thai, and Indic languages have classical shapes for numbers that are different from the conventional western digits most often used on computers. To avoid ambiguity in naming these shapes, this document uses the following names from the Unicode standard.
Countries | Unicode name |
---|---|
Europe, America, and many others | European digits |
Arabic countries (although many use European digits) | Arabic-Indic digits |
Thailand (although many use European digits) | Thai digits |
Unicode provides separate code points for each digit shape. Thus, to access special language–digit shapes, you can use the relevant Unicode character codes for the digits above U+0030 through U+0039. These are always displayed with the appropriate shape (subject to the available fonts).
The Unicode digits U+0030 through U+0039 are nominally the European digits of 0 through 9, but their digit shape can be altered. The system displays the digits U+0030 through U+0039 in the following ways:
Native digits are the digit shapes chosen by the user in the Regional Settings program on the Number property sheet. To find the user's preferred digit presentation, use the GetLocaleInfo function with the LOCALE_SNATIVEDIGITS flag. Typically, Unicode digit codes are generated in run-time system routines such as _itoa, so common run-time systems must be upgraded for the application to inspect this variable appropriately.
Digit substitution tells the system how to print digits U+0030 through U+0039 in the absence of the NADS or NODS control codes. The LOCALE_IDIGITSUBSTITUTION constant, which controls this operation, can have one of the following values.
Value | Meaning | ||
---|---|---|---|
0 | Context-based substitution. Digits are displayed based on the previous text in the same output—that is, European digits follow Latin scripts, Arabic-Indic digits follow Arabic text, and Thai digits follow Thai text. When there is no preceding text, the locale and the displayed reading order determine digit substitution, as shown in the following. | ||
Locale | Reading order | Digits used | |
Arabic | Right-to-left | Arabic-Indic | |
Thai | Left-to-right | Thai | |
All others | Any | No substitution is used. | |
1 | No substitution is used. This gives full Unicode compatibility. | ||
2 | Native digit substitution. Digits are displayed according to LOCALE_SNATIVEDIGITS. |
The ExtTextOut, GetCharacterPlacement, and GCP_RESULTS APIs have flags that govern the substitution of Unicode characters U+0030 through U+0039 for the duration of the function call. That is, these flags override regional settings in Control Panel, but do not reset the settings. Also, they do not override the Unicode control characters NADS and NODS. The following flags are available.
Flags | Digits used |
---|---|
ETO_NUMERICSLATIN | European digits. |
ETO_NUMERICSLOCAL | Digits appropriate to the locale. |
GCP_NUMERICSLATIN | European digits. |
GCP_NUMERICSLOCAL | Digits appropriate to the locale. |
GCPCLASS_LATINNUMBER | European digits. |
GCPCLASS_LOCALNUMBER | Digits appropriate to the locale. |