Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to render properly if font does not support Nerd Fonts #1

Closed
David-Rushton opened this issue Aug 7, 2022 · 3 comments · Fixed by #50
Closed

Fails to render properly if font does not support Nerd Fonts #1

David-Rushton opened this issue Aug 7, 2022 · 3 comments · Fixed by #50
Labels

Comments

@David-Rushton
Copy link
Owner

David-Rushton commented Aug 7, 2022

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

image

Win 11 Cascadia Code with Nerd Fonts

image

@David-Rushton David-Rushton added the bug Something isn't working label Aug 7, 2022
@David-Rushton
Copy link
Owner Author

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:

  • They are cross platform
  • They appear to be the emerging standard

Currently Ansi escape doesn't support querying font capabilities.

@David-Rushton
Copy link
Owner Author

David-Rushton commented Aug 13, 2022

I think the best thing to do is:

  1. Make Nerd Font support configurable, with a sensible default
  2. Investigate options
  3. If investigation is successful; use outcome to set NF default value at start-up

@David-Rushton
Copy link
Owner Author

David-Rushton commented Aug 24, 2022

Suggestion:

enum NerdFontsSupported
{
  Yes,
  No,
  // Maybe a separate PR added later
  Detect
}

class MarkdownConsole
{
  // New property
  public NerdFontsSupported { get; set; } = NerdFontsSupported.Detect;
}

David-Rushton added a commit that referenced this issue Aug 28, 2022
David-Rushton added a commit that referenced this issue Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant