Skip to main content

Is Graphics2D or font changed in JDK7u1 on Linux64?

4 replies [Last post]
chaoliu
Offline
Joined: 2011-10-28
Points: 0

I am using Graphics2D to draw text, on Linux64 platform, the output image using font Arial look quite different between 1.6.0_01 and 1.7.0_01, is it because Graphics2D implenmentation changed or fonts changed, or both are changed from JDK6u1 to JDK7u1?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
philrace
Offline
Joined: 2003-06-09
Points: 0

I can't imagine why Arial would appear any different so you should start off by checking your assumption that you are in fact getting Arial.

Arial is a proprietary font and does not ship as standard with any Linux distro. You don't name your distro for some reason ..

My guess is you don't have Arial, so you are getting Dialog, and in the absence of a customised fontcontig.properties for

your distro and version, JDK 7 builds Dialog from OS installed fonts instead of the JDK's Lucida fonts.

So you may be seeing the difference between Lucida Sans (JDK 1.6) and something like "Deja Vu Sans" (1.7)

chaoliu
Offline
Joined: 2011-10-28
Points: 0

Hi Philrace, thanks a lot for you reply.

You are right, I am seeing "Deja Vu Sans" on Red Hat Enterprise Linux Server release 5 (Tikanga) with JDK7 update 1 x64 version. And I did remove all fontconfig.* from jre/lib, and have a fontconfig.properties as below, but still see the "Deja Vu Sans", other than "Lucida Sans", anything else I can try?

version=1
# Component Font Mappings
serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
serif.bold.latin-1=-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1
serif.italic.latin-1=-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1
serif.bolditalic.latin-1=-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
monospaced.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialog.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialoginput.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
# Search Sequences
sequence.allfonts=latin-1
philrace
Offline
Joined: 2003-06-09
Points: 0

If you are on RH.5 the file must be called fontconfig.RedHat.5.properties else it will be ignored.

Ie it must *EXACTLY* match your distro and its version.

And if you are on RH 5.4 then it must be called fontconfig.RedHat.5.4.properties

But big caution here .. you will now have a fontconfig file that will not support Chinese unless you start adding those fonts back in

chaoliu
Offline
Joined: 2011-10-28
Points: 0

Thanks so much Philrace, that really worked! It has to be fontconfig.RedHat.5.properties for my environment. Even though it's clumsy not to use a generic name, and it's weird that Oracle document says it search files in such order:

"The runtime uses the first of the following files it finds:

<i> JavaHome</i>[prettify]/lib/fontconfig.<i>OS.Version</i>.properties<i> JavaHome</i>/lib/fontconfig.<i>OS.Version</i>.bfc<i> JavaHome</i>/lib/fontconfig.<i>OS</i>.properties<i> JavaHome</i>/lib/fontconfig.<i>OS</i>.bfc<i> JavaHome</i>/lib/fontconfig.<i>Version</i>.properties<i> JavaHome</i>/lib/fontconfig.<i>Version</i>.bfc<i> JavaHome</i>/lib/fontconfig.properties<i> JavaHome</i>/lib/fontconfig.bfc &amp;quot;[/prettify]

http://download.oracle.com/javase/1.5.0/docs/guide/intl/fontconfig.html