diff --git a/app/src/main/java/io/xpipe/app/core/AppFont.java b/app/src/main/java/io/xpipe/app/core/AppFont.java index 12d28268..13a15932 100644 --- a/app/src/main/java/io/xpipe/app/core/AppFont.java +++ b/app/src/main/java/io/xpipe/app/core/AppFont.java @@ -58,14 +58,6 @@ public class AppFont { node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;"); } - public static void verifyFontLoadingFunctional() { - try { - Font.getDefault(); - } catch (Throwable t) { - throw new IllegalStateException("Unable to load any fonts. Check whether your system is properly configured with fontconfig", t); - } - } - public static void init() { TrackEvent.info("Loading fonts ..."); AppResources.with( @@ -75,7 +67,7 @@ public class AppFont { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { try (var in = Files.newInputStream(file)) { - Font.loadFont(in, 12); + Font.loadFont(in, OsType.getLocal() == OsType.LINUX ? 11 : 12); } catch (Throwable t) { // Font loading can fail in rare cases. This is however not important, so we can just ignore it } diff --git a/app/src/main/java/io/xpipe/app/core/AppProperties.java b/app/src/main/java/io/xpipe/app/core/AppProperties.java index d498da87..c6efaecd 100644 --- a/app/src/main/java/io/xpipe/app/core/AppProperties.java +++ b/app/src/main/java/io/xpipe/app/core/AppProperties.java @@ -68,6 +68,10 @@ public class AppProperties { } } + public static void setDynamicProperties() { + System.setProperty("prism.fontdir", XPipeInstallation.getBundledFontsPath().toString()); + } + public static void logArguments(String[] args) { TrackEvent.withInfo("Detected arguments") .tag("list", Arrays.asList(args)) diff --git a/app/src/main/java/io/xpipe/app/core/check/AppFontCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppFontCheck.java new file mode 100644 index 00000000..c771d228 --- /dev/null +++ b/app/src/main/java/io/xpipe/app/core/check/AppFontCheck.java @@ -0,0 +1,15 @@ +package io.xpipe.app.core.check; + +import javafx.scene.text.Font; + +public class AppFontCheck { + + public static void check() { + try { + Font.getDefault(); + } catch (Throwable t) { + throw new IllegalStateException("Unable to load any fonts. Check whether your system is properly configured with fontconfig", t); + } + } + +} diff --git a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java index 98e8e18b..6995ee9f 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java @@ -1,6 +1,7 @@ package io.xpipe.app.core.mode; import io.xpipe.app.core.*; +import io.xpipe.app.core.check.AppFontCheck; import io.xpipe.app.core.check.AppTempCheck; import io.xpipe.app.core.check.AppUserDirectoryCheck; import io.xpipe.app.ext.DataStoreProviders; @@ -103,8 +104,9 @@ public abstract class OperationMode { AppProperties.logArguments(args); AppProperties.logSystemProperties(); AppProperties.logPassedProperties(); + AppProperties.setDynamicProperties(); XPipeSystemId.init(); - AppFont.verifyFontLoadingFunctional(); + AppFontCheck.check(); TrackEvent.info("mode", "Finished initial setup"); } catch (Throwable ex) { ErrorEvent.fromThrowable(ex).term().handle(); diff --git a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java index 4d25e523..9985f897 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java @@ -282,6 +282,18 @@ public class XPipeInstallation { return path; } + public static Path getBundledFontsPath() { + var install = getCurrentInstallationBasePath(); + var type = OsType.getLocal(); + if (type.equals(OsType.WINDOWS)) { + return install.resolve("app").resolve("fonts"); + } else if (type.equals(OsType.LINUX)) { + return install.resolve("app").resolve("fonts"); + } else { + return install.resolve("Contents").resolve("Resources").resolve("fonts"); + } + } + public static String getDaemonDebugScriptPath(OsType type) { if (type.equals(OsType.WINDOWS)) { return FileNames.join("app", "scripts", "xpiped_debug.bat"); diff --git a/dist/base.gradle b/dist/base.gradle index 75e3bc78..f2a24549 100644 --- a/dist/base.gradle +++ b/dist/base.gradle @@ -26,6 +26,10 @@ if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { from "$projectDir/logo/logo.ico" into "$distDir/base/app" } + copy { + from "$projectDir/fonts" + into "$distDir/base/app/fonts" + } def debugArguments = file("$projectDir/debug/debug_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(Collectors.joining( ' ')) @@ -79,6 +83,10 @@ if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { from "$projectDir/logo/logo.png" into "$distDir/base/" } + copy { + from "$projectDir/fonts" + into "$distDir/base/app/fonts" + } // Fixes a JPackage bug copy { @@ -159,6 +167,10 @@ if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { from "$distDir/cli/xpipe_completion" into "$distDir/$app/Contents/Resources/cli/" } + copy { + from "$projectDir/fonts" + into "$distDir/$app/Contents/Resources/fonts" + } copy { from "$projectDir/PkgInstaller/darwin/Resources/uninstall.sh" diff --git a/dist/changelogs/1.7.13.md b/dist/changelogs/1.7.13.md index 1b27c218..da8ab4c6 100644 --- a/dist/changelogs/1.7.13.md +++ b/dist/changelogs/1.7.13.md @@ -12,7 +12,7 @@ ## Changes - The SSH config importer now supports include statements. Included files are automatically resolved and joined -- Improve performance mode appearance setting gains by removing more styling +- Improve performance mode speedup by removing more styling. You can find the mode under Settings -> Appearance - Change layout of connection names and status to better handle very long connection names across all window sizes - Make any connection quickly renameable in the edit window without verifying whether we can actually connect diff --git a/dist/fonts/Roboto-Regular.ttf b/dist/fonts/Roboto-Regular.ttf new file mode 100644 index 00000000..3d6861b4 Binary files /dev/null and b/dist/fonts/Roboto-Regular.ttf differ diff --git a/dist/fonts/allfonts.properties b/dist/fonts/allfonts.properties new file mode 100644 index 00000000..0ee690d1 --- /dev/null +++ b/dist/fonts/allfonts.properties @@ -0,0 +1,3 @@ +family.0=Roboto +font.0=Roboto Regular +file.0=Roboto-Regular.ttf \ No newline at end of file