FontFeature.characterVariant constructor
- int value
Select a character variant. (cv01
through cv99
)
Fonts may have up to 99 character variant sets, numbered 1 through 99, each of which can be independently enabled or disabled.
Related character variants are typically grouped into stylistic
sets, controlled by the FontFeature.stylisticSet feature
(ssXX
).
{@tool sample}
The Source Code Pro font supports the cvXX
feature for several
characters. In the example below, variants 1 (cv01
), 2
(cv02
), and 4 (cv04
) are selected. Variant 1 changes the
rendering of the "a" character, variant 2 changes the lowercase
"g" character, and variant 4 changes the lowercase "i" and "l"
characters. There are also variants (not shown here) that
control the rendering of various greek characters such as beta
and theta.
Notably, this can be contrasted with the stylistic sets, where the set which affects the "a" character also affects beta, and the set which affects the "g" character also affects theta and delta.
** See code in examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart ** {@end-tool}
See also:
- FontFeature.stylisticSet, which allows for groups of characters variants to be selected at once, as opposed to individual character variants.
- docs.microsoft.com/en-us/typography/opentype/spec/features_ae#cv01-cv99
Implementation
factory FontFeature.characterVariant(int value) {
assert(value >= 1);
assert(value <= 99);
return FontFeature('cv${value.toString().padLeft(2, "0")}');
}