Default fontconfig uses very ugly fonts for some programs

Asked by André on 2011-08-30

Some Java programs use the Dialog font, but the default fontconfig of Ubuntu maps to it the so very ugly "lucidasans" font, from the "b&h" foundry. I would like to suggest that, at least, be used the "helvetica" font. Is this someting reasonable? Is this possible?

For me, I wrote the following script to be run as root:

mv /usr/lib/jvm/java-6-sun/jre/lib/fontconfig.Ubuntu.bfc /usr/lib/jvm/java-6-sun/jre/lib/fontconfig.Ubuntu.bfc.orig
sed -r -i.orig -e "s/^(dialog\..+\.latin-1=)-b&h-lucidasans-(.+-.-normal-).*(-\*-%d-\*-\*-p-\*-iso8859-1)/\1-*-helvetica-\2\3/" /etc/java-6-sun/

For some reason, the fontconfig.Ubuntu.bfc takes precedence over the It appears to be some binary form of the properties file, but I couldn't find any way of compiling the text file into the binary one. So I renamed the binary file and then Java started reading the one I changed.

I would like some feedback about this, and about how can I help to implement this, in case the community finds it reasonable.

Thank you!

Question information

English Edit question
Ubuntu sun-java6 Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
marcus aurelius (adbiz) said : #1

what's ugly to you may not be ugly to others.

André (aedgsilva) said : #2

That answer doesn't help to much. There's objective reasons why the font is ugly: the metrics are totally different from common sans-serif fonts like Helvetica. Many softwares (like Oracle SQL Developer, for example) have metrics in mind while defining the sizes of the prompts and windows, and "lucidasans" exceeds those metrics so much that the result is trimmed text when compared with the same application running in Windows, for example.

Best mycae (mycae) said : #3

Helvetica although common, is not a free font and cannot be legally included in a free software program. Usually you have to use a replacement font that looks similar (maybe bitstream vera). Alternatively you can purchase a licence for it from the font foundry for your own use.

As for the binary file format, this is a java thing, and it is an undocumented format, according to:

Use the compilefontconfig jar to perform the bfc compilation:
java -jar /usr/lib/jvm/java-6-openjdk/jre/lib/compilefontconfig.jar /etc/java-6-openjdk/ /etc/java-6-openjdk/fontconfig.bfc

You could probably determine the full file format yourself by studying the compilefontconfig source.

mycae (mycae) said : #4

oh, I would recommend opening a bug, if you find a font that you feel resolves the issue, and submit a new fontconfig file as a patch.

mycae (mycae) said : #5

Last point:

I notice you are using sun-java 1.6 -- the sun-java package's redistribution licence has been discontinued by Oracle, so there will be no further debian (and thus ubuntu) packaging of sun-java, unless some other agreement is reached -- so it is unlikely that any patch can be integrated into future releases. However, if the same applies to openJDK, then perhaps you should look there.

André (aedgsilva) said : #6

Thanks mycae, that solved my question.