Java-Anwendung: bei einer bestimmten teilweise hässliche Fonts

Hallo!

Ich habe zur Zeit insgesamt drei (3) Java-Anwendungen auf meinem System:

  1. LanguageTool: Installation aus ZIP, Aufruf per java -jar languagetool.jar, Fonts i.O. :slight_smile:
  2. MediathekView: Installation aus AppImage, Aufruf per MediathekView-14.0.0-linux-x86_64.AppImage, Fonts i.O. :slight_smile: (Hinweis: da AppImage ist hier Java integriert und es wird nicht das systemweite Java verwendet.)
  3. Zirkel und Lineal (Z.u.L.): Installation aus ZIP, Aufruf per java -jar zirkel.jar, Fonts nur teilweise i.O. :frowning: … nicht schön!

Mein Java:

gunnersson@tulicube:/etc/java> java --version
openjdk 21.0.3 2024-04-16
OpenJDK Runtime Environment (build 21.0.3+9-suse-150600.1.8-x8664)
OpenJDK 64-Bit Server VM (build 21.0.3+9-suse-150600.1.8-x8664, mixed mode, sharing)

Ich habe hier einen Screenshot.

Das Merkwürdige: nur teilweise sind die Fonts hässlich. Aber sie sind es halt (und das ist nicht schön). Grün: OK, Rot: nicht OK.

Was ich bisher gemacht habe:

  • Ich habe Fontweak installiert und entsprechend ausgeführt, sowohl als Nutzer als auch als root. (Hinweis: fontweak deswegen, weil es Yast2-Fonts regulär nicht mehr gibt.) D.h. ich habe für Sans, Serif, Mono einige Fonts ausgewählt, ich habe Anti-Aliasing aktiviert etc. (als Nutzer und als root).
  • Ich habe als root ausgeführt: fonts-config --java sowie fonts-config --user --java.
  • Ich habe mir /etc/java/font.properties vorgenommen: die dort gelisteten Fonts sind auf meinem System tatsächlich gar nicht vorhanden. Ich habe sie entsprechend modifiziert und für alle Fonttypen jeweils explizit einen Font gesetzt.
  • Ich habe /etc/java/font.properties auch mal deaktiviert (durch Umbenennen zu /etc/java/font.properties.bak
  • Ich habe nach entsprechenden Umgebungsvariablen geguckt. Quasi nichts da… (Wenn man bei Google zu diesem Thema sucht, findet man einige Treffer. Teilweise mit Angaben von Umgebungsvariablen. Aber das Ergebnis ist nicht einheitlich. Ich habe jetzt nicht alle möglichen Vorschläge ausprobiert: es waren viele und teilweise abweichende.)
gunnersson@tulicube:~> export | grep -i -E '(java|jdk|jre)'
declare -x JRE_HOME="/usr/lib64/jvm/java-21-openjdk-21"

Was fällt Euch ein?
Was ist das Besondere an Z.u.L.?
Wo kann ich noch gucken?
Was kann ich noch versuchen?

Ergänzungen:

gunnersson@tulicube:~/Schreibtisch> cat font.properties 
# Project JPackage java font preferences
# http://www.jpackage.org/

serif.0=-Liberation-Liberation Serif-medium-r-normal--*-%d-*-*-p-*-iso8859-1
serif.italic.0=-Liberation-Liberation Serif-medium-i-normal--*-%d-*-*-p-*-iso8859-1
serif.bold.0=-Liberation-Liberation Serif-bold-r-normal--*-%d-*-*-p-*-iso8859-1
serif.bolditalic.0=-Liberation-Liberation Serif-bold-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.0=-Liberation-Liberation Sans-medium-r-normal--*-%d-*-*-p-*-iso8859-1
sansserif.italic.0=-Liberation-Liberation Sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.bold.0=-Liberation-Liberation Sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.0=-Liberation-Liberation Sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1
monospaced.0=-Liberation-Liberation Mono-medium-r-normal--*-%d-*-*-p-*-iso8859-1
monospaced.italic.0=-Liberation-Liberation Mono-medium-i-normal--*-%d-*-*-p-*-iso8859-1
monospaced.bold.0=-Liberation-Liberation Mono-bold-r-normal--*-%d-*-*-p-*-iso8859-1
monospaced.bolditalic.0=-Liberation-Liberation Mono-bold-i-normal--*-%d-*-*-p-*-iso8859-1
dialog.0=-Liberation-Liberation Mono-medium-r-normal--*-%d-*-*-p-*-iso8859-1
dialog.italic.0=-Liberation-Liberation Mono-medium-i-normal--*-%d-*-*-p-*-iso8859-1
dialog.bold.0=-Liberation-Liberation Mono-bold-r-normal--*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.0=-Liberation-Liberation Mono-bold-i-normal--*-%d-*-*-p-*-iso8859-1
dialoginput.0=-Liberation-Liberation Mono-medium-r-normal--*-%d-*-*-p-*-iso8859-1
dialoginput.italic.0=-Liberation-Liberation Mono-medium-i-normal--*-%d-*-*-p-*-iso8859-1
dialoginput.bold.0=-Liberation-Liberation Mono-bold-r-normal--*-%d-*-*-p-*-iso8859-1
dialoginput.bolditalic.0=-Liberation-Liberation Mono-bold-i-normal--*-%d-*-*-p-*-iso8859-1

fontset.default=-Liberation-Liberation Sans-medium-r-normal--*-%d-*-*-p-*-iso8859-1

# serif.0=-b&h-Lucida Bright-medium-r-normal--*-%d-*-*-p-*-iso10646-1
# serif.1=-monotype-Times New Roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
# serif.2=-microsoft-Georgia-medium-r-normal--*-%d-*-*-p-*-iso10646-1
# serif.3=-b&h-Luxi Serif-medium-r-normal--*-%d-*-*-p-*-iso10646-1
# serif.4=-URW-Nimbus Roman No9 L-medium-r-normal--*-%d-*-*-p-*-iso8859-1
# serif.5=-URW-Times-medium-r-normal--*-%d-*-*-p-*-iso8859-1
# serif.6=-Bitstream-Bitstream Vera Serif-medium-r-normal--*-%d-*-*-p-*-iso10646-1
# serif.7=-URW-Symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific

…
gunnersson@tulicube:~/Schreibtisch> fc-list 
/usr/share/fonts/truetype/URWChanceryL-MediItal.ttf: URW Chancery L:style=Medium Italic
/usr/share/fonts/truetype/NimbusSanL-BoldCond.ttf: Nimbus Sans L:style=Bold Condensed
/usr/share/fonts/truetype/NotoSans-DisplaySemiCondensedExtraLightItalic.ttf: Noto Sans,Noto Sans SemiCondensed ExtraLight:style=Display SemiCondensed ExtraLight Italic,Italic
/usr/share/fonts/truetype/NotoSans-DisplaySemiCondensedMediumItalic.ttf: Noto Sans,Noto Sans SemiCondensed Medium:style=Display SemiCondensed Medium Italic,Italic
/usr/share/fonts/misc/5x7.pcf.gz: Misc Fixed:style=Regular
/usr/share/fonts/ghostscript/putbi.pfa: Utopia:style=Bold Italic
/usr/share/fonts/truetype/NotoSans-DisplaySemiCondensedLightItalic.ttf: Noto Sans,Noto Sans SemiCondensed Light:style=Display SemiCondensed Light Italic,Italic
/usr/share/fonts/truetype/CenturySchL-Bold.ttf: Century Schoolbook L:style=Bold
/usr/share/fonts/ghostscript/b018035l.pfb: URW Bookman L:style=Demi Bold Italic
/usr/share/fonts/ghostscript/d050000l.pfb: Dingbats:style=Regular
/usr/share/fonts/truetype/NotoSans-DisplayCondensedItalic.ttf: Noto Sans,Noto Sans Condensed:style=Display Condensed Italic,Italic
/usr/share/fonts/truetype/NotoSans-ExtraCondensedThinItalic.ttf: Noto Sans,Noto Sans ExtraCondensed Thin:style=ExtraCondensed Thin Italic,Italic
/usr/share/fonts/truetype/NotoSans-SemiCondensedExtraLightItalic.ttf: Noto Sans,Noto Sans SemiCondensed ExtraLight:style=SemiCondensed ExtraLight Italic,Italic
/usr/share/fonts/truetype/SourceSansPro-BoldIt.otf: Source Sans Pro:style=Bold Italic
/usr/share/fonts/truetype/SourceSerifPro-LightIt.otf: Source Serif Pro,Source Serif Pro Light:style=Light Italic,Italic
/usr/share/fonts/truetype/luxisr.ttf: Luxi Sans:style=Regular
/usr/share/fonts/truetype/NotoSans-Regular.ttf: Noto Sans:style=Regular
/usr/share/fonts/truetype/OpenSans-CondLightItalic.ttf: Open Sans,Open Sans Condensed Light:style=Condensed Light Italic,Italic
/usr/share/fonts/ghostscript/n022003l.pfb: Nimbus Mono L:style=Regular
/usr/share/fonts/truetype/LiberationMono-Regular.ttf: Liberation Mono:style=Regular
/usr/share/fonts/truetype/SourceCodePro-Medium.otf: Source Code Pro,Source Code Pro Medium:style=Medium,Regular
/usr/share/fonts/truetype/SourceCodePro-Regular.otf: Source Code Pro:style=Regular
/usr/share/fonts/truetype/SyrCOMCtesiphon.otf: East Syriac Ctesiphon:style=Regular
/usr/share/fonts/truetype/SourceCodePro-Bold.otf: Source Code Pro:style=Bold
/usr/share/fonts/truetype/STIXGeneral-BoldItalic.otf: STIXGeneral:style=Bold Italic
/usr/share/fonts/truetype/NotoSans-SemiCondensedMedium.ttf: Noto Sans,Noto Sans SemiCondensed Medium:style=SemiCondensed Medium,Regular
/usr/share/fonts/truetype/SyrCOMJerusalemItalic.otf: Serto Jerusalem:style=Italic
/usr/share/fonts/truetype/NotoSans-DisplayExtraCondensedSemiBold.ttf: Noto Sans,Noto Sans Display ExtraCondensed SemiBold:style=Display ExtraCondensed SemiBold,Regular
/usr/share/fonts/truetype/NotoSans-DisplaySemiCondensedExtraLight.ttf: Noto Sans,Noto Sans Display SemiCondensed ExtraLight:style=Display SemiCondensed ExtraLight,Regular
/usr/share/fonts/truetype/STIXGeneral-Regular.otf: STIXGeneral:style=Regular
/usr/share/fonts/truetype/NimbusSanL-BoldCondItal.ttf: Nimbus Sans L:style=Bold Condensed Italic
/usr/share/fonts/truetype/SyrCOMMalankara.otf: Serto Malankara:style=Regular
/usr/share/fonts/truetype/VeraSeBd.ttf: Bitstream Vera Serif:style=Bold
/usr/share/fonts/ghostscript/n022004l.pfb: Nimbus Mono L:style=Bold
/usr/share/fonts/truetype/Poppins-Italic.ttf: Poppins:style=Italic
/usr/share/fonts/truetype/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
/usr/share/fonts/truetype/NotoSans-DisplayItalic.ttf: Noto Sans,Noto Sans Display:style=Display Italic,Italic
/usr/share/fonts/misc/6x13O-ISO8859-1.pcf.gz: Misc Fixed:style=Oblique SemiCondensed
/usr/share/fonts/truetype/OpenMoji-Black.ttf: OpenMoji:style=Black
/usr/share/fonts/truetype/NotoSans-DisplayCondensedSemiBold.ttf: Noto Sans,Noto Sans Display Condensed SemiBold:style=Display Condensed SemiBold,Regular
/usr/share/fonts/truetype/URWBookmanL-LighItal.ttf: URW Bookman L:style=Light Italic
/usr/share/fonts/ghostscript/a010015l.pfb: URW Gothic L:style=Demi
/usr/share/fonts/truetype/SourceCodePro-Black.otf: Source Code Pro,Source Code Pro Black:style=Black,Regular
/usr/share/fonts/truetype/luxisb.ttf: Luxi Sans:style=Bold
/usr/share/fonts/truetype/NotoSans-ExtraCondensedMedium.ttf: Noto Sans,Noto Sans ExtraCondensed Medium:style=ExtraCondensed Medium,Regular
/usr/share/fonts/truetype/luxirr.ttf: Luxi Serif:style=Regular
/usr/share/fonts/truetype/OpenSans-ExtraBoldItalic.ttf: Open Sans,Open Sans Extrabold:style=Extrabold Italic,Italic
/usr/share/fonts/truetype/SourceSerifPro-ExtraLight.otf: Source Serif Pro,Source Serif Pro ExtraLight:style=ExtraLight,Regular
…
gunnersson@tulicube:~/Schreibtisch> fc-list | grep -i 'Liberation'
/usr/share/fonts/truetype/LiberationMono-Regular.ttf: Liberation Mono:style=Regular
/usr/share/fonts/truetype/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
/usr/share/fonts/truetype/LiberationSerif-Bold.ttf: Liberation Serif:style=Bold
/usr/share/fonts/truetype/LiberationSerif-Italic.ttf: Liberation Serif:style=Italic
/usr/share/fonts/truetype/LiberationMono-BoldItalic.ttf: Liberation Mono:style=Bold Italic
/usr/share/fonts/truetype/LiberationMono-Italic.ttf: Liberation Mono:style=Italic
/usr/share/fonts/truetype/LiberationMono-Bold.ttf: Liberation Mono:style=Bold
/usr/share/fonts/truetype/LiberationSans-Regular.ttf: Liberation Sans:style=Regular
/usr/share/fonts/truetype/LiberationSansNarrow-Bold.ttf: Liberation Sans Narrow:style=Bold
/usr/share/fonts/truetype/LiberationSans-BoldItalic.ttf: Liberation Sans:style=Bold Italic
/usr/share/fonts/truetype/LiberationSansNarrow-Italic.ttf: Liberation Sans Narrow:style=Italic
/usr/share/fonts/truetype/LiberationSerif-Regular.ttf: Liberation Serif:style=Regular
/usr/share/fonts/truetype/LiberationSans-Italic.ttf: Liberation Sans:style=Italic
/usr/share/fonts/truetype/LiberationSansNarrow-BoldItalic.ttf: Liberation Sans Narrow:style=Bold Italic
/usr/share/fonts/truetype/LiberationSansNarrow-Regular.ttf: Liberation Sans Narrow:style=Regular
/usr/share/fonts/truetype/LiberationSerif-BoldItalic.ttf: Liberation Serif:style=Bold Italic

Ich verstehe ehrlich gesagt das Problem nicht so ganz. Was passiert, wenn Du statt monospaced in ZUL z. B. SansSerif-Schrift wählst?

Gut, ich glaube, ich habe es jetzt verstanden: Es geht dir darum, dass die Schriften in den Menüs usw. ausgefranst sind. Lösungsvorschlag: Leider keiner!

In beiden Einstellungspunkten ( Font einstellen … sowie Font für Menüs einstellen … ) kann ich von den möglichen Vorgaben wählen, was immer ich will: es ist an bestimmten Stellen immer pixelig. Es gibt lediglich bestimmte Möglichkeiten, dass man es wenigstens halbwegs gut erkennen kann.

Genau: ich habe ja im Screenshot bestimmte Bereiche mit Grün markiert, die OK sind — aber welche mit Rot, die pixelig sind. An bestimmten Stellen sehen die Fonts hässlich aus…

Das wundert mich aus mehreren Gründen:

  • Innerhalb von Z.u.L. sehen ja nicht alle Fonts hässlich aus, sondern nur an bestimmten Stellen.
  • Ich habe wie bereits noch zwei andere Java-Applikationen, bei denen alles OK ist. (Soweit ich das bisher überblicke. Eins davon per AppImage, naja (wer weiß, was da intern alles konfiguriert ist). Aber das andere auch per java -jar <Java_App.jar>.

Vielleicht wurden in dieser Anwendung AWT und Swing-Elemente gemischt. Was passiert denn wenn du folgendes versuchst:

java -jar <Java_App.jar> -Dswing.aatext=true -Dawt.useSystemAAFontSettings=on

Dass Mediathekview eine Java-Anwendung ist, wusste ich ehrlich gesagt nicht. Hier sind selbstverständlich alle Schriften bei mir einwandfrei. Es ist m. E. ein reines ZUL-Problem, dass Dir hier keiner lösen kann. Du solltest Grothmann als Programmierer anschreiben, auf dass dieser das Problem löst!

Liegt an der von dem Programm benutzten Schrift, ist bei mir auch bei zirkel.jar der Fall.

MediathekView/JDownloader/RailWorld hat eine bessere Schrift.

java --version
openjdk 11.0.23 2024-04-16
OpenJDK Runtime Environment (build 11.0.23+9-suse-150000.3.113.1-x8664)
OpenJDK 64-Bit Server VM (build 11.0.23+9-suse-150000.3.113.1-x8664, mixed mode)

Vielen Dank für den Vorschlag!

Korrekt musste es

java  -Dswing.aatext=true -Dawt.useSystemAAFontSettings=on -jar zirkel.jar

heißen, d.h. die Parameter zu den Fonts vor -jar.

Aber das brachte leider kenne erkennbare Änderung.

Ich habe sogar mal alle 4 Kombinationen von true/falsesowie on/offdurchprobiert. Entweder ich sehe es mittlerweile nicht mehr, weil ich schon selbst die Details (im AA) nicht mehr erkennen kann oder es war tatsächlich kein Unterschied — trotz der explizit gesetzten Parameter.

Ja, genau. Ich bin mittlerweile in Kontakt mit Professor Grothmann. Seine erste Antwort war, dass er sich auch keinen rechten Rat weiß. Aber er will noch einmal nachgucken.

Ich bringe das hier zu einem vorläufigen Abschluss und warte die Kommunikation mit Professor Grothmann ab. Sollte sich etwas Entscheidendes ergeben, kann ich es ja hier schreiben.

OK, also ähnlich wie bei mir. Vielen Dank für den Test!

Ich habe jetzt ein Setting, mit dem ich persönlich einigermaßen leben kann.

Die Hinweise zu meinem Screenshot gelten allerdings nach wie vor: Es gibt mit Grün markierte Bereiche, wo die Schrift “hübsch” aussieht und offensichtlich Anti-Aliasing nutzt. Und es gibt gleichzeitig Bereiche mit Rot markiert, wo die Schrift “hässlich” aussieht und offensichtlich kein Anti-Aliasing unterstützt.

Naja, mal gucken, ob Professor Grothmann noch etwas dazu einfällt.

Ist bei mir einfach zu lange her, dass ich Java außerhalb einer IDE genutzt hab. :wink:

Es gibt drei Kategorien von Schriften: Serifen-Schriften, serifenlose Schriften und nichtproportionale Schriften.

Wenn die Anwendung keine explizite Schriftart für die Darstellung des Texts anfordert, wird entweder die Voreinstellung für:

serif => Serifen-Schrift
sans-serif => Serifenlose Schrift
monospace => Nichtproportionale Schrift

verwendet. Hier wurde versäumt, auf dem Linux-Rechner eine ordentliche nichtproportionale Schrift zu installieren (monospace font). Nachkontrollieren mit:

# fc-match serif
=> Liberation Serif Regular

# fc-match sans-serif
=> Liberation Sans Regular

# fc-match monospace
=> Liberation Mono

Ordentliche Nichtproportionale Schriften sind:
Liberation Mono
Source Code Pro
Droid Sans Mono

Allen im Screenshot rot markierten Texten fehlt die Kantenglättung. Sehr einfach ersichtlich bei starker Vergrösserung in einem Bildbetrachter.

Einmal wird die Kantenglättung der Texten mit Graustufen durchgeführt, einmal mit den Subpixel vom LCD-Bildschirm und einmal fehlt die Kantenglättung komplett.

Mit fehlenden Fonts hat das Problem überhaupt nichts zu tun. Die von Dir genannten Fonts sind bei mir alle installiert und können unter ZUL auch ausgewählt werden. Das Entscheidende ist, dass die Kantenglättung nur auf den Buttons, nicht aber in den Menüs funktioniert. Weshalb das der Fall ist, ist gegenwärtig nicht ersichtlich.

Naja, jedenfalls nicht bei mir…

Hast Du oben mein fc-list und insbesondere fc-list | grep -i 'Liberation' gesehen? Wenn ich fc-match Serif oder entsprechende aufrufe, bekomme ich entsprechende Treffer!

So…

Ich habe übers Wochenende mal einen Freund und früheren Studienkollegen, der sich recht gut mit Java auskennt, gefragt. Dies hat er geantwortet:

MediathekView kenne ich. Das verwendet genauso wie auch meine
Simulatoren FlatLaF. Damit bekommt man ein schönes, konsistentes,
plattformunabhängiges Look&Feel hin. Auf der Zirkel-Homepage steht was
von “ab Java 1.4”, d.h. das Programm ist vom Kern her uralt und
verwendet sicher einige (früher übliche) GUI-Hacks, die heute einfach
nur noch Probleme machen. Auch vermute ich, dass es eben kein
plattform-unabhängiges Look&Feel verwendet, sondern (wie früher üblich)
versucht hat, das Aussehen der jeweiligen Plattform möglichst gut
nachzustellen. Das klappte unter Windows immer gut, unter Linux eher so
lala.

Der Autor von Z.u.L. hat dies anschließend im Wesentlichen bestätigt. Z.u.L. selbst ist schon recht alt, es ist historisch gewachsen, insbesondere die GUI (und sie benutzt tatsächlich keine aktuellen und modernen Techniken), und der Autor als Mathematiker hat sich natürlich vornehmlich um einwandfreie Mathematik gekümmert. Er will sich eventuell an seinem Lebabend mal um eine Modernisierung bemühen. Allerdings hat dies nicht oberste Priorität (das Programm funktioniert technisch, insbesondere die Mathematik), weil es nicht so viele Anwender hat. Ich selbst mag es aber sehr. Wenn man dynamische Geometrie betreiben möchte, finde ich es super (und besser als die verfügbaren Alternativen).

Vielen Dank an alle Beteiligten fürs Rätselraten! (Sorry, dass es so gelaufen ist — aber wenigstens hat es sich aufgeklärt.)