Fuzzy Text on High DPI display

128 views
Skip to first unread message

Steve

unread,
Oct 24, 2019, 2:43:58 PM10/24/19
to lanterna-discuss

Hi All 


I'm making progress in using Lanterna 3 but I'm facing a few issues and looking for some guidance - thank you in advance if you can help.


I'm using Clojure as the programming language, but interop isn't an issue or related to this query.


Ideally I'd like to use a Swing Screen/Terminal combination as I'd like to retain access to the launching terminal for logging and interactive debug purposes.


I create a DefaultTerminalFactory, set a few options and then createScreen from the factory.


This works well and I can create a Swing screen and terminal and write and redraw and set attributes colours, get keyboard input, etc - it's all great - BUT the text output looks quite fuzzy on my Mac high DPI display (too bad to be really tolerable).


I then tried to use setTerminalEmulatorFontConfiguration on DefaultTerminalFactory to set a font with antialiasing enabled, using the same font and size as I normally use in my Mac Term windows. This gives me a Swing terminal with a changed font, still fuzzy and the font bigger than the same font and size in Term.


(for those interested, the Clojure to do this is here, with tf being the DefaultTerminalFactory instance)


 (.setTerminalEmulatorFontConfiguration tf (new com.googlecode.lanterna.terminal.swing.SwingTerminalFontConfiguration true com.googlecode.lanterna.terminal.swing.AWTTerminalFontConfiguration$BoldMode/EVERYTHING_BUT    _SYMBOLS (into-array java.awt.Font [(new java.awt.Font "Menlo" java.awt.Font/PLAIN 14)]))) 


Making no progress on resolving the fuzzy font issue I thought I'd try using a text terminal next.


I use setForceTextTerminal on the factory before createScreen and great, it uses my launching Term as the terminal - nice crisp fonts, all good. But now when I exit the app (after using stopScreen) my terminal is in an unusable state and needs to be closed. 


So neither of these routes provides me with a good solution when trying to use a lanterna Screen.


I'd prefer to use the Swing terminal if I could fix the fuzzy font issue - is this possible?


Or if not, as second best, how do I cleanup and leave the terminal in a good state if I force DefaultTerminalFactory to create a screen with a text terminal behind it?


Any and all help appreciated, thanks again.


Regards

S



Steve

unread,
Oct 25, 2019, 5:47:15 PM10/25/19
to lanterna-discuss
Update

Issue with blurry text on SwingTerminal frame on Mac is probably this https://blog.xojo.com/2014/07/14/adding-plist-settings-to-your-os-x-apps/

Issue with leaving terminal in bad state with Terminal is related to launching from within a Clojure REPL and does not happen when running a built application jar from the terminal.

Cheers
S

Martin Berglund

unread,
Jan 5, 2020, 1:10:57 AM1/5/20
to lanterna...@googlegroups.com
We've tried to do HDPI support for AWT/SwingTerminal by detecting the resolution and applying a scaling for the font if it looks like the display is HDPI. This works somewhat. If the fonts are proper vector fonts, I don't see why they would be blurry, but it could be the OS thinking that the app isn't HDPI-aware and re-scaling it again.

If this is still an issue for you, do you mind trying to modify the fonts used in the font configuration class for Mac and see if you find any combination that looks reasonable?

Martin

--
Det här meddelandet skickas till dig eftersom du prenumererar på gruppen "lanterna-discuss" i Google Grupper.
Om du vill sluta prenumerera på den här gruppen och inte längre få någon e-post från den skickar du ett e-postmeddelande till lanterna-discu...@googlegroups.com.
Om du vill visa den här diskussionen på webben besöker du https://groups.google.com/d/msgid/lanterna-discuss/b5803bb9-59a1-48af-b6da-be44469d821c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages