<AWT Dev> An issue of OpenJRE

31731705 31731705 at qq.com
Fri May 20 08:45:12 UTC 2016


After some days study I have found the reason.

I know jfreechart issue is caused by font, so I copied some font files into jre/lib/fonts/ folder and wrote fontconfig.properties file, seem it took effect but FontMetrics has got strange value. 

And if I moved thses fonts files into /usr/share/fonts, everything runs well. After further test, as long as jre/lib/fonts folder has font files even without fontconfig.properties FontMetrics will get error value. 

Can someboday tell me the differences between these two folders? Why openjre read font from jre/lib/fonts folder but give wrong value?


------------------ Original ------------------
From:  "AAAA";<31731705 at qq.com>;
Date:  Mon, May 9, 2016 04:19 PM
To:  ""<31731705 at qq.com>; "awt-dev"<awt-dev at openjdk.java.net>; 

Subject:  Re: <AWT Dev> An issue of OpenJRE

Hi,I'd like to update some findings.

My compouter runs CentOS 6.4 x64, and I install openjdk 1.8 x86_64, then I find the problem went away. :) 
The former openJRE is from another computer which runs CentOS 6.6 x86, and I installed openjdk 1.8 and copied the jre folder to my project as part of installation. 

I hope this jre folder can runs everywhere, and I don't know if it loses some libraries. Actually I copied following 3 libraries to jre i386 directory in order make it runs.

1. libfreetype.so
2. libfontconfig.so
3. libexpat.so

Indeed it runs well most time except this jfreechart issue. I guess it still miss some libraries. But I'm not sure. Who can help with it ?
As to why I copy existing jre foler rather than install a new openjre because Oracle JRE is a tar file and I like it. I used to embed all necessary parts into project and so I won't ask customer to install this or that dependency part.

------------------ Original ------------------
From:  "AAAA";<31731705 at qq.com>;
Date:  Sat, May 7, 2016 12:19 PM
To:  "awt-dev"<awt-dev at openjdk.java.net>; 

Subject:  <AWT Dev> An issue of OpenJRE

If this mail distrub you please ignore that, sorry for inconveniences. I really hope to get your help.

Recently I'm porting a project form oracle jdk to open jdk, and compile process is smooth and most parts runs well, but jfreechart cannot work. I have submitted a question to jfreechart forum (http://www.jfree.org/forum/viewtopic.php?f=3&t=117569&p=179724#p179724).

However after sometime troubleshooting, I find the problem is related with open jre. That means jfreechart works fine in oracle jre but fails in open jre.
Again I find more details, when I run following codes I will get wrong result, which causes jfreechart not to work.

	        BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
	        Graphics2D g2 = image.createGraphics();
	        FontMetrics fm = g2.getFontMetrics();

The fm includes strange value, if I switch to oracle jre fm has right value. I don't know why. Can somebody help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20160520/7c059d16/attachment.html>

More information about the awt-dev mailing list