bundledLabelStyle function

TextStyle bundledLabelStyle(
  1. TextStyle style, {
  2. bool slashedZero = false,
})

style with the variable-font axes and features of its bundled family (unchanged for the platform font).

Implementation

TextStyle bundledLabelStyle(TextStyle style, {bool slashedZero = false}) {
  final font = BundledFont.fromFamily(style.fontFamily);
  if (!font.isBundled) return style;
  final weight = (style.fontWeight ?? FontWeight.w400).value.toDouble();
  return style.copyWith(
    fontVariations: font.variations(weight: weight, fontSize: style.fontSize),
    fontFeatures: font.features(slashedZero: slashedZero),
  );
}