phronmophobic / membrane.term

A terminal emulator in pure clojure
Eclipse Public License 1.0
52 stars 1 forks source link

Java2d toolkit looks noticeably worse on linux. #32

Open phronmophobic opened 2 years ago

phronmophobic commented 2 years ago

As mentioned in https://github.com/phronmophobic/membrane.term/pull/14#issuecomment-977189391, the font rendering on linux using the java2d toolkit looks pretty rough.

Here are the screenshots from the linked comment:

clojure -M:membrane.term run-term --toolkit java2d --font-size 20 143132470-7cfe8434-e327-443e-8436-27109c1f7da2

clojure -M:membrane.term:skia run-term --toolkit skia --font-size 20 143132451-8f8fee7e-a1c6-40f1-9f3a-6d2cc600efd0

Note: the way github displays the screenshots doesn't look so bad for the java2d toolkit, but if you look at the high resolution version, it should look obviously worse.

phronmophobic commented 2 years ago

For whatever reason, I do explicitly turn on anti aliasing when drawing to an image. I wonder if the same artifacts show up when running screenshot.

phronmophobic commented 2 years ago

I found these two references that might also help:

https://batsov.com/articles/2010/02/26/enable-aa-in-swing/ https://askubuntu.com/questions/636666/ugly-non-anti-aliased-fonts-in-java-swing-applications

Both recommend the following

// enable anti-aliasing
System.setProperty("awt.useSystemAAFontSettings","on");
System.setProperty("swing.aatext", "true");

// Alternatively (and if you do not have access to the source, or if you find this easier) you can simply pass
// the system properties above to the JVM by adding these options to the command line:

-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true