Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
49.65k stars 1.73k forks source link

[REQUEST] detect fonts automatically #3508

Open xun-xh opened 1 month ago

xun-xh commented 1 month ago

在提出功能请求之前,考虑在https://github.com/textualize/rich/discussions中发布反馈。

I have browsed all the relevant issues about "font". so many developers got an unexpected output, caused by it.

你如何提高富贵?

I think rich can add a feature that automatically detects terminal fonts. using ansi char when proportional font, otherwise not.

它能为你解决什么问题?

in that case, rich can work better in Asia environment

github-actions[bot] commented 1 month ago

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

TomJGooding commented 1 month ago

I'm afraid there isn't a way to detect the font or any possible font fallbacks in the terminal.

xun-xh commented 1 month ago

I'm afraid there isn't a way to detect the font or any possible font fallbacks in the terminal.

https://learn.microsoft.com/en-us/windows/console/getcurrentconsolefontex

TomJGooding commented 1 month ago

Interesting, but this page even warns that "This API is not recommended and does not have a virtual terminal equivalent". Presumably this would only work in the classic conhost and not the new Windows Terminal?

xun-xh commented 1 month ago

We do not recommend using this content in new products, but we will continue to support existing usages for the indefinite future.

TomJGooding commented 1 month ago

Let me clarify: even if your feature request could be implemented, it would only work on Windows and specifically in the old conhost, not in the new default Windows Terminal?

xun-xh commented 1 month ago

yes, it would only work on Windows. but it also be used in the new terminal.

willmcgugan commented 3 weeks ago

using ansi char when proportional font, otherwise not.

I'm not clear on what output you would expect with a proportional font. Very little of Rich would work without a monospace font.

Does this related to using Chinese characters in the terminal? Is it common for Chinese users to use proportional fonts?