FontFeature.localeAware constructor
- bool enable = true,
Use locale-specific glyphs. (locl
)
Some characters, most notably those in the Unicode Han Unification blocks, vary in presentation based on the locale in use. For example, the ideograph for "grass" (U+8349, 草) has a broken top line in Traditional Chinese, but a solid top line in Simplified Chinese, Japanese, Korean, and Vietnamese. This kind of variation also exists with other alphabets, for example Cyrillic characters as used in the Bulgarian and Serbian alphabets vary from their Russian counterparts.
A particular font may default to the forms for the locale for
which it was constructed, but still support alternative forms
for other locales. When this feature is enabled, the locale (as
specified using painting.TextStyle.locale
, for instance) is
used to determine which glyphs to use when locale-specific
alternatives exist. Disabling this feature causes the font
rendering to ignore locale information and only use the default
glyphs.
This feature is enabled by default. Using
FontFeature.localeAware(enable: false)
disables the
locale-awareness. (So does not specifying the locale in the
first place, of course.)
{@tool sample}
The Noto Sans CJK font supports the locl
feature for CJK characters.
In this example, the localeAware
feature is not explicitly used, as it is
enabled by default. This example instead shows how to set the locale,
thus demonstrating how Noto Sans adapts the glyph shapes to the locale.
** See code in examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart ** {@end-tool}
See also:
Implementation
const FontFeature.localeAware({bool enable = true})
: feature = 'locl',
value = enable ? 1 : 0;