Linux font fixes

This commit is contained in:
crschnick 2023-06-20 12:10:21 +00:00
parent 3180694f1b
commit f50582f35c
2 changed files with 4 additions and 5 deletions

View file

@ -2,6 +2,7 @@ package io.xpipe.app.core;
import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.core.process.OsType;
import javafx.css.Size; import javafx.css.Size;
import javafx.css.SizeUnits; import javafx.css.SizeUnits;
import javafx.scene.Node; import javafx.scene.Node;
@ -25,7 +26,7 @@ public class AppFont {
} }
public static double getPixelSize(int off) { public static double getPixelSize(int off) {
var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12; var baseSize = OsType.getLocal() == OsType.LINUX ? 11 : 12;
return new Size(baseSize + off, SizeUnits.PT).pixels(); return new Size(baseSize + off, SizeUnits.PT).pixels();
} }
@ -54,7 +55,8 @@ public class AppFont {
return; return;
} }
var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12; // Somehow the font is bigger on Linux
var baseSize = OsType.getLocal() == OsType.LINUX ? 11 : 12;
node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;"); node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;");
} }

View file

@ -98,9 +98,6 @@ public class AppPrefs {
public final ReadOnlyBooleanProperty useSystemFont = useSystemFontInternal; public final ReadOnlyBooleanProperty useSystemFont = useSystemFontInternal;
private final IntegerProperty tooltipDelayInternal = typed(new SimpleIntegerProperty(1000), Integer.class); private final IntegerProperty tooltipDelayInternal = typed(new SimpleIntegerProperty(1000), Integer.class);
private final IntegerProperty fontSizeInternal = typed(new SimpleIntegerProperty(12), Integer.class);
public final ReadOnlyIntegerProperty fontSize = fontSizeInternal;
private final BooleanProperty saveWindowLocationInternal = typed(new SimpleBooleanProperty(false), Boolean.class); private final BooleanProperty saveWindowLocationInternal = typed(new SimpleBooleanProperty(false), Boolean.class);
public final ReadOnlyBooleanProperty saveWindowLocation = saveWindowLocationInternal; public final ReadOnlyBooleanProperty saveWindowLocation = saveWindowLocationInternal;