blob: a553b1689bc6481bd94af5a714aa8f29952be5a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
diff --git a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
index 0ea741c..53d1f4d 100644
--- a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
+++ b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
@@ -368,7 +368,29 @@ public class FcFontConfiguration extends FontConfiguration {
String userDir = System.getProperty("user.home");
String version = System.getProperty("java.version");
String fs = File.separator;
- String dir = userDir+fs+".java"+fs+"fonts"+fs+version;
+ String dir;
+
+ /* On Linux systems, put the font config into
+ * ${XDG_CONFIG_HOME:-$HOME/.config}/java/fonts in order to follow
+ * the XDG Base Directory Specification.
+ */
+ if (System.getProperty("os.name").equals("Linux")) {
+ /* assume homedir can be found, which the jvm already does */
+ String xdgDefaultConfigHome = System.getenv("HOME")+"/.config";
+ String xdgConfigHomeEnvVar = "XDG_CONFIG_HOME";
+ String xdgConfigDir;
+
+ String xdgSetConfigDir = System.getenv(xdgConfigHomeEnvVar);
+
+ if (xdgSetConfigDir == null)
+ xdgConfigDir = xdgDefaultConfigHome;
+ else
+ xdgConfigDir = xdgSetConfigDir;
+
+ dir = xdgConfigDir+"/java/fonts/"+version;
+ } else {
+ dir = userDir+fs+".java"+fs+"fonts"+fs+version;
+ }
Locale locale = SunToolkit.getStartupLocale();
String lang = locale.getLanguage();
String country = locale.getCountry();
|