scubajorgen / TomTomWatch

Tool for exporting GPS files from TomTom Sports Watches
84 stars 18 forks source link

Monospaced font for output textarea? #12

Closed heikojansen closed 6 years ago

heikojansen commented 6 years ago

I do not know if this is just a symptom of a badly configured setting in my environment (openSUSE Tumbleweed) but the output textarea at the bottom of the app window does not use a monospaced font for me. Doing so would certainly increase the readability of tabular data presented there. Does the TomTomWatch code try to enforce a monospaced font there? If yes: Do you know what setting might be responsible for the misbehavior in my environment? If no: would you consider adding such code?

scubajorgen commented 6 years ago

Yes, TomTomWatch should display a monospace (fixed letter size) font. Afaik I used a font that should be present in Java and hence it should be platform independent. I only recently changed the layout and fonts, so in the most recent version it should work fine. I modified this because of differences between Linux and Windows in text sizes. For me, the software now looks the same on Windows and Slackware Linux.
What version of the TTW software do you use? If the latest, what JVM/java do you use? It cannot be configured at least not in TTW

heikojansen commented 6 years ago

I'm using TomTomWatch Release 1.4 Java is:

~/TomTomWatch> java -version
openjdk version "11-internal" 2018-09-25
OpenJDK Runtime Environment (build 11-internal+24-suse-1.1-x8664)
OpenJDK 64-Bit Server VM (build 11-internal+24-suse-1.1-x8664, mixed mode)

~/TomTomWatch> rpm -qf /usr/lib64/jvm/jre-11-openjdk/bin/java
java-11-openjdk-headless-11.0.0.0~24-1.1.x86_64

ttw_20180808_160301

I run TTW like so as normal user (i.e.: not root):

~/TomTomWatch> java -jar ./TomTomWatch-1.4.jar

Unfortunately I do not use Java as a developer so I have no idea which packages or other components may be required.

scubajorgen commented 6 years ago

I'll have a look at it. Will take a fewxweeks though

scubajorgen commented 6 years ago

In the software I switched to fonts incorporated in Oracle Java (like Lucida) in order to have the same layout under Windows as under Linux. Unfortunately, the OpenJDK does not incorporate these Java fonts (probably a license issue, http://mail.openjdk.java.net/pipermail/discuss/2017-November/004630.html). Apparently OpenJDK Java chooses some default font instead, which in case of the large text box is not a mono-spaced font.

I have to look for a solution (incorporate the fonts in TomTomWatch?).

For the moment it should be possible to add the fonts from Oracle to OpenJDK: https://wiki.openjdk.java.net/display/OpenJFX/Font+Setup (Embedded Device Fonts section)

Only fonts used in the application are Lucida Sans Lucida Sans Typewriter

heikojansen commented 6 years ago

Hmm, while googling ab bit I've come across various hints on using "logical" fonts in Java which are automatically mapped to some locally installed font (so you cannot guarantee identical looks on different systems using this mechanism). One of those logical fonts is named "Monospaced" (new Font("Monospaced", Font.PLAIN, 12);), so should be appropriate here. Maybe that helps?

(Edit: https://docs.oracle.com/javase/tutorial/2d/text/fonts.html)

scubajorgen commented 6 years ago

That was what I started out with. However, when not using (=mapping on) exactly the same fonts the application looks different on different platforms. If the text extent is slightly larger because of a different font on system B than on system A, the text might look OK on system A but not on B. Text might not fit on a button on System B and be partly shown, etc. I solved this by using the java internal fonts, which are exactly the same on all platforms.

heikojansen commented 6 years ago

Well, it does not look identical on my system now anyway since unless you add the fonts to the TomTomWatch distribution you still cannot guarantee the same looks ;-) Does Java let you detect if the font you'd like to use cannot be found? If so, then imho you should at least use the logical font as fallback.