Closed David-Rushton closed 2 years ago
There are various ways you can determine which font the console is using. However these differ between Windows and Linux (and not all distros follow the same pattern).
I would prefer to use Ansi escape codes if possible. Two reasons:
Currently Ansi escape doesn't support querying font capabilities.
I think the best thing to do is:
Suggestion:
enum NerdFontsSupported
{
Yes,
No,
// Maybe a separate PR added later
Detect
}
class MarkdownConsole
{
// New property
public NerdFontsSupported { get; set; } = NerdFontsSupported.Detect;
}
Issue
Markdown.Console
requires Nerd Fonts.If your font has not been patched fallback characters are used, These are less than ideal and lead to a messy output. The aim of this project is to deliver beautiful rendering of markdown in the console. Messy fallbacks undermine this.
Here are few ways we could address this. I've not given this a lot of thought. So there may well be other/better ways of addressing.
Ideas
1) Only use Nerd Fonts if available Detecting font support in the terminal may be impossible. Using a whitelist of font names is also problematic.
2) Make Nerd Fonts configurable This is probably the easiest option. But in many case you may not know at design time what will be available at runtime.
Example
Win 11 Cascadia Code without Nerd Fonts
Win 11 Cascadia Code with Nerd Fonts