FontFeature.swash constructor

const FontFeature.swash([
  1. int value = 1
])

Enable swash glyphs. (swsh)

Some fonts have beautiful flourishes on some characters. These come in many forms, such as exaggerated serifs, long tails, long entry strokes, or other forms of decorative extensions to the base character.

This feature enables the rendering of these flourishes. Some fonts have many swashes per character; the argument, if specified, selects which swash to use (0 disables them altogether).

Some fonts have an absurd number of alternative swashes. For example, Adobe's Poetica famously has 63 different ampersand forms available through this feature!

The BioRhyme Expanded font supports the swsh feature specifically for the capital "Q" and "R" glyphs and the ampersand.

link

To create a local project with this code sample, run:
flutter create --sample=dart.dart_ui.FontFeature.swash.1 mysample

import 'package:flutter/widgets.dart';

/// Flutter code sample for [FontFeature.FontFeature.swash].

void main() => runApp(const ExampleApp());

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return WidgetsApp(
      builder: (BuildContext context, Widget? navigator) =>
          const ExampleWidget(),
      color: const Color(0xffffffff),
    );
  }
}

class ExampleWidget extends StatelessWidget {
  const ExampleWidget({super.key});

  @override
  Widget build(BuildContext context) {
    // The BioRhyme Expanded font can be downloaded from Google Fonts
    // (https://www.google.com/fonts).
    return const Text(
      'Queer & Romantic',
      style: TextStyle(
        fontFamily: 'BioRhyme Expanded',
        fontFeatures: <FontFeature>[
          FontFeature.swash(),
        ],
      ),
    );
  }
}

See also:

Implementation

const FontFeature.swash([this.value = 1]) : feature = 'swsh', assert(value >= 0);