FontFeature.stylisticSet constructor
- int value
Select a stylistic set. (ss01
through ss20
)
Fonts may have up to 20 stylistic sets, numbered 1 through 20, each of which can be independently enabled or disabled.
For more fine-grained control, in some fonts individual
character variants can also be controlled by the
FontFeature.characterVariant feature (cvXX
).
{@tool sample}
The Source Code Pro font supports the ssXX
feature for several
sets. In the example below, stylistic sets 2 (ss02
), 3
(ss03
), and 4 (ss04
) are selected. Stylistic set 2 changes
the rendering of the "a" character and the beta character,
stylistic set 3 changes the lowercase "g", theta, and delta
characters, and stylistic set 4 changes the lowercase "i" and
"l" characters.
This font also supports character variants (see FontFeature.characterVariant).
** See code in examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart ** {@end-tool}
{@tool sample}
The Piazzolla font supports the ssXX
feature for more
elaborate stylistic effects. Set 1 turns some Latin characters
into Roman numerals, set 2 enables some ASCII characters to be
used to create pretty arrows, and so forth.
These stylistic sets do not correspond to character variants.
** See code in examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart ** {@end-tool}
See also:
- FontFeature.characterVariant, which allows for individual character variants to be selected, as opposed to entire sets.
- docs.microsoft.com/en-us/typography/opentype/spec/features_pt#ssxx
Implementation
factory FontFeature.stylisticSet(int value) {
assert(value >= 1);
assert(value <= 20);
return FontFeature('ss${value.toString().padLeft(2, "0")}');
}