Why Does Monospaced Not Match Courier New?
Answered
I installed IDEA on Linux and the font in the editor looked weird to me so I switched back to Windows to work out the font I needed to download to make it the same.
Monospace and Line spacing = 1 is the default.
Monospaced is a Java logical font that maps to Courier New.
However, if I switch the editor font (in Windows) from Monospaced to Courier New it doesn't look the same.
Courier New and Line spacing = 1.15 is almost the same (a few pixels difference in height over 30 lines!).
Why do I have to switch the line spacing as well as the font in order to make it look the same?
Please sign in to leave a comment.
Font mapping is controlled by the JVM and may be different depending on the OS or Java version/vendor.
'Monospaced' is a 'composite' logical font, provided by JDK, with different physical fonts used for different character sets. When line height is calculated for a composite font, JDK takes into account all constituent fonts, so resulting line height is defined by 'highest' font in the list.
I never knew that!
I can't seem to get comfortable with the fonts on linux. :(
Right now I am using Fira Code Size 12 Line Space 1.0. Cousine and Liberation Mono aren't bad either.
Something doesn't quite feel right though.
Has anyone got any other suggestions (apart from Source Code Pro, Roboto Mono and Ubuntu Mono)?
It would be nice if the font preview box had some actual code in it as well as all the characters so you could get a better idea of what the font looked like without clicking apply.
Same here! In Windows fonts looks more beauty.