Platform SDK: International Features

ScriptRecordDigitSubstitution

The ScriptRecordDigitSubstitution function reads the National Language Support (NLS) native digit and digit substitution settings and records them in the SCRIPT_DIGITSUBSTITUTE structure.

HRESULT WINAPI ScriptRecordDigitSubstitution(
  LCID Locale,
  SCRIPT_DIGITSUBSTITUTE *psds
);

Parameters

Locale
[in] NLS locale to be queried. Typically, it should be set to LOCALE_USER_DEFAULT. Alternatively, it can be a locale combined with LOCALE_NOUSEROVERRIDE to obtain the default settings.

Note that context digit substitution is supported only in Arabic and Farsi locales. In other locales, context digit substitution is mapped to no substitution.

psds
[out] Pointer to a SCRIPT_DIGITSUBSTITUTE structure. This structure may be passed later to ScriptApplyDigitSubstitution.

Return Values

If successful, the function returns S_OK.

If psds is NULL, the function returns E_POINTER.

If Locale is invalid or not installed, the function returns E_INVALIDARG.

If any other unrecoverable error is encountered, it is also returned as HRESULT. For example, error returns from Win32 API functions are converted to HRESULT using the HRESULT_FROM_WIN32 macro and returned to the client in the HRESULT.

Remarks

The typical way to call this function is:

SCRIPT_DIGITSUBSTITUTE sds;
ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &sds);

At every itemization, you can use the results like this:

SCRIPT_CONTROL sc = {0};
SCRIPT_STATE   ss = {0};
ScriptApplyDigitSubstitution(&sds, &sc, &ss);

For performance reasons you should not call ScriptRecordDigitSubstitution frequently. In particular, it requires considerable overhead to call it every time you call ScriptItemize or ScriptStringAnalyse. Instead, you can save the SCRIPT_DIGITSUBSTITUTE structure and update it only when:

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Usp10.h.
  Library: Use Usp10.lib.

See Also

Uniscribe Overview, Uniscribe Functions, ScriptStringAnalyse, ScriptApplyDigitSubstitution, ScriptItemize, SCRIPT_DIGITSUBSTITUTE