Answer the question
In order to leave comments, you need to log in
How to change (replace) the default Dialog font in Java?
There is Arch Linux, JDK / JRE versions 1.6 and 1.7 are installed on it.
I noticed such a feature - the standard Dialog font in 1.6 corresponds to Lucida Sans, and in 1.7 - DejaVu Sans.
I want 1.7 to have Lucida too. It was useful to look at the fontconfig * files in / opt / java - Lucida is registered everywhere there, and DejaVu, on the contrary, is never found. But the system-wide fc-match command with the Dialog parameter produces just DejaVu Sans. Those. it seems that instead of the "Dialog" alias, Java 7 takes the system "Dialog" from its configs? Is this a bug or a feature?
And how can I still make it so that in the JRE the Dialog font would be considered Lucida Sans?
Answer the question
In order to leave comments, you need to log in
In short, I figured it out myself. I had to look at the OpenJDK sources.
It turned out that, at least under Linux, JRE ignores fontconfig* files in /opt/java (one wonders why they are there at all). Instead, it looks at the Fontconfig system configuration, i.e., for example, the font that the command issues is taken as the Dialog font. fc-match sans
Thus, by replacing this font by shamanism with files from the /etc/fonts/conf.d directory, we will change the font Dialog in Java. One problem - in other programs, the default font will also change. I changed to Arimo - it looks, to put it mildly, not very good.
But there is a way out. There is a fonts.conf file in the /etc/fonts/ directory, we create a copy of it under the name /etc/fonts/fonts.conf.alt, we fix the line there
After that, we create the /etc/fonts/conf.d.alt directory, copy all the files and (or) symbolic links we need from /etc/fonts/conf.d into it and twist them as we please (only if these are symbolic links - do not forget that the corresponding "main" file will also change, so in this case it is better to copy, and not make a link).
Checking the result with the command
FONTCONFIG_FILE=/etc/fonts/fonts.conf.alt fc-match sans
FONTCONFIG_FILE=/etc/fonts/fonts.conf.alt netbeans
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question