xterm.dart icon indicating copy to clipboard operation
xterm.dart copied to clipboard

Custom FontFamily in TerminalStyle

Open jamiewest opened this issue 3 years ago • 2 comments

I would like to set the terminal font using GoogleFonts but in order to do this I would need to pass a TextStyle rather than a font name. Is there a reason why the TerminalStyle does not accept a TextStyle? I can contribute a PR if you would be open to the change and if there are no other blockers. Thank you

jamiewest avatar Oct 25 '20 18:10 jamiewest

Is there a reason why the TerminalStyle does not accept a TextStyle?

Due to some font related issues on flutter desktop platform like this one, a long fontFamilyFallback list is required to ensure monospace characters, emojis and other special characters are correctly rendered on all platforms.

To replace fontSize and fontFamily with a TextStyle field in TerminalStyle, perhaps we have to provide a way to inherit the default fontFamilyFallback.

xtyxtyx avatar Oct 26 '20 02:10 xtyxtyx

Here's a PR (#9) where I added Google Fonts support, hopefully in a non-breaking way, by passing a TextStyle-producing function into the TerminalStyle constructor. If passing in a TextStyle would also work, feel free to change #9 or do that in a different PR - I just wanted to get something working for a personal project. It's working for me in Linux and Web targets.

timburks avatar Jan 18 '21 05:01 timburks