Home > Mobile >  Turn off ligatures in Flutter
Turn off ligatures in Flutter

Time:07-26

I would like to turn off the font ligatures for a text. I use the Fira Code font, but I can't find a way to turn off the ligatures in TextStyle in my app. Can anyone help me?

CodePudding user response:

When you use a Text widget, you can enable or disable various FontFeatures via its TextStyle. Looking at Fira Code in https://wakamaifondue.com/, it appears ligatures are controlled by the calt feature, which is enabled by default. You therefore could try disabling that:

Text(
  someString,
  style: TextStyle(fontFeatures: [FontFeature.disable('calt')]),
)

Alternatively, Fira Code is open-source and has build options to enable or disable features in the generated font files.

  • Related