spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.11k stars 1.57k forks source link

Some monospaced fonts cannot be loaded and used by Spyder #12641

Open zysNLP opened 4 years ago

zysNLP commented 4 years ago

Problem Description

I installed fonts such as Monaco.TTF on ubuntu and found that I could not find this font in the "plain text font" font collection in spyder. All the fonts installed in the system can be found in "rich text font", but the edit text is only work with "plain text font". Could you make "plain text font" as rich as "rich text font"? Why give it so few options?

Versions

Dependencies

PASTE DEPENDENCIES HERE
ccordoba12 commented 4 years ago

Plain text fonts mean monospaced fonts, i.e. fonts whose characters take the same space in pixels. These are the right fonts for programming, so we don't plan to change that, sorry.

ccordoba12 commented 4 years ago

There are many monospaced fonts out there. You need to find and install them instead.

sepremento commented 3 years ago

There are many monospaced fonts out there. You need to find and install them instead.

I have installed Fira Code and it is not available in plain text fonts section. Last time I checked Fira Code was a monospaced font. Can you please comment on why it is not available?

feliperiosg commented 3 years ago

I installed Fira Code in Windows OS and it was recognized by Spyder... but when I installed Fira Code in Ubuntu, it was NOT recognized by Spyder only in the "plain text font" menu. Hence... there is indeed something going on in there.

sohnishi commented 1 year ago

This is due to the mismatch of the monospaced criteria of QFontComboBox and QFontMetrics. QFontComboBox judges whether the pitch of characters is fixed. On the other hand, QFontMetrics determines based on the actual character width (and this criterion matches our senses). Fira Code is actually monospaced, but it is treated as a non-monospaced font in QFontComboBox on Linux. So QFontComboBox rejects many good fonts for programming on Spyder-ide.

I am also suffering from this because half-width spaces (U+0020) and full-width spaces (U+3000) cannot be distinguished in all the monospaced fonts that can be used on Spyder-ide. Qt won't change this behavior, so I'd like to implement an option (which can be enabled with a checkbox or something) to use non-monospaced fonts in plaintext.

ccordoba12 commented 1 year ago

@sohnishi, thanks for letting us know about this limitation in Qt. The idea you proposed to fix this problem needs more work, so we'll take a look at it for Spyder 6.