<div>Hi Mario and Dalibor,</div><div><br></div><div>Thanks for you feedback. Let me give more information to reproduce it.</div><div><br></div><div>1. Get OpenJDK 1.8 code from http://download.java.net/openjdk/jdk8/</div><div><br></div><div><div>[root@localhost rong]# ls -l openjdk-8-src-b132-03_mar_2014.zip</div><div>-rwxr--r-- 1 root root 124099402 5月   9 15:34 openjdk-8-src-b132-03_mar_2014.zip</div></div><div><br></div><div>2. Build OpenJDK 1.8, and my build OS is CentOS 6.6, </div><div><br></div><div><div>[root@localhost rong]# cat /etc/redhat-release</div><div>CentOS release 6.6 (Final)</div><div>[root@localhost rong]# uname -a</div><div>Linux localhost.localdomain 2.6.32-504.el6.i686 #1 SMP Wed Oct 15 03:02:07 UTC 2014 i686 i686 i386 GNU/Linux</div></div><div><br></div><div>and we will get j2re-image and j2sdk-image folder</div><div><div>[root@localhost rong]# ls openjdk/build/linux-x86-normal-server-release/images/j2*</div><div>openjdk/build/linux-x86-normal-server-release/images/j2re-image:</div><div>ASSEMBLY_EXCEPTION  bin  lib  LICENSE  man  release  THIRD_PARTY_README</div><div><br></div><div>openjdk/build/linux-x86-normal-server-release/images/j2sdk-image:</div><div>ASSEMBLY_EXCEPTION  bin  demo  include  jre  lib  LICENSE  man  release  sample  src.zip  THIRD_PARTY_README</div></div><div><br></div><div>Yes, you are right, now there is no fonts folder in jre/lib.</div><div><br></div><div><div>[root@localhost openjdk]# build/linux-x86-normal-server-release/images/j2re-image/bin/java -version</div><div>openjdk version "1.8.0-internal"</div><div>OpenJDK Runtime Environment (build 1.8.0-internal-root_2016_05_09_10_59-b00)</div><div>OpenJDK Server VM (build 25.0-b70, mixed mode)</div><div>[root@localhost openjdk]# build/linux-x86-normal-server-release/images/j2sdk-image/bin/java -version</div><div>openjdk version "1.8.0-internal"</div><div>OpenJDK Runtime Environment (build 1.8.0-internal-root_2016_05_09_10_59-b00)</div><div>OpenJDK Server VM (build 25.0-b70, mixed mode)</div></div><div><br></div><div>3. Packge j2re-image folder and copied to another Cent OS, this is simple Cent OS installation and without any font files. Suppose naming the jre folder "javaJRE"</div><div><br></div><div>Another CentOS machine information:</div><div><div><span style="line-height: 1.5;">[root@va91 UI]# uname -a</span></div><div>Linux va91.openjre 2.6.32-573.3.1.el6.x86_64 #1 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux</div></div><div><br></div><div>JRE Infomation:</div><div><div>[root@va91 UI]# ls javaJRE</div><div>ASSEMBLY_EXCEPTION  bin  lib  LICENSE  man  release  THIRD_PARTY_README</div><div>[root@va91 UI]# javaJRE/bin/java -version</div><div>openjdk version "1.8.0-internal"</div><div>OpenJDK Runtime Environment (build 1.8.0-internal-root_2016_05_09_10_59-b00)</div><div>OpenJDK Server VM (build 25.0-b70, mixed mode)</div></div><div><br></div><div>4. Actually most Java codes runs well in this jre environment, but following codes (actually 3rd line) will cause NullPointer exception.  </div><div><br></div><div><div><span style="white-space: pre-wrap;">        </span>        BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);</div><div><div style="line-height: 21px;"><span style="white-space: pre-wrap;">        </span>        Graphics2D g2 = image.createGraphics();</div><div style="line-height: 21px;"><span style="white-space: pre-wrap;">  </span>        FontMetrics fm = g2.getFontMetrics();</div></div><div><br></div><div>Some articles said that's because OpenJRE depends on font files, so I copied some font files, and there are two ways:</div><div><br></div><div>1) copied font files into /usr/share/fonts folder, that's good and easy, and exception vanishes and app runs well.</div><div>2) By referring to oracle JRE, I copied font files into openjre/lib/fonts folder, and wrote fontconfig.properties. I'm not sure if OpenJRE will parse it but it's worty trying. </div><div>[root@va91 javaJRE]# ls lib/font*</div><div>lib/fontconfig.properties  lib/fontconfig.properties.src  lib/fontconfig.RedHat.6.properties.src</div><div><br></div><div>lib/fonts:</div><div>fonts.dir                 LucidaBrightDemiItalic.ttf  LucidaBrightRegular.ttf  LucidaSansRegular.ttf     LucidaTypewriterRegular.ttf</div><div>LucidaBrightDemiBold.ttf  LucidaBrightItalic.ttf      LucidaSansDemiBold.ttf   LucidaTypewriterBold.ttf</div><div><br></div><div>The expecption still disappeared, but FontMetrics fm has some odd values and cause subsequent codes wrong. After further study, I found even I removed all fontconfig* files this problem still existed. That means as long as jre/lib/fonts folder has font files FontMetrics will have wrong value.</div><div><br></div><div>I don't understand why openjre has this behavior and hope to get answer here. Will OpenJRE read fontconfig.properties and read font from jre/lib/fonts?</div><div>Thanks for you patience and time. </div><div><br></div><div>Regards,</div><div>Rong</div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "Mario Torre";<neugens.limasoftware@gmail.com>;</div><div><b>发送时间:</b> 2016年5月20日(星期五) 晚上10:24</div><div><b>收件人:</b> ""<31731705@qq.com>; <wbr></div><div><b>抄送:</b> "dalibor topic"<dalibor.topic@oracle.com>; "awt-dev"<awt-dev@openjdk.java.net>; <wbr></div><div><b>主题:</b> Re: <AWT Dev> An issue of OpenJRE</div></div><div><br></div><div>It's very difficult to understand your issue, beside, it seems that you are manually copying around libraries and it's clear that this only has the effect of destabilizing the platform.</div><div><br></div><div>I suggest to start with a clear description of what the problem is, what is the expected behavior, what is the environment and how to reproduce it, in a simple, possibly self contained way.</div><div><br></div>Then you should file a bug report.<div><br><div>Cheers,</div><div>Mario</div><div><br>On Friday, 20 May 2016, 31731705 <<a href="mailto:31731705@qq.com">31731705@qq.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="line-height:21px">Hi Dalibor,</div><div style="line-height:21px"><br></div><div style="line-height:21px">Actually this time I download OpenJDK source code and build it myself, but I still met this issue. I wonder why font files in jre/lib/fonts folder impact openjre.</div><div style="line-height:21px"><br></div><div style="line-height:21px">Here is a brief of this problem, I try to decribe it clearly.</div><div style="line-height:21px"><br></div><div style="line-height:21px">I build OpenJDK, and copy j2re-image to my folder such as /home/rong/jre, and use this jre to run my java applicaton. In further study I have found following codes, fm will have wrong value as long as jre/lib/fonts has font files (some ttf files).</div><div style="line-height:21px"><br></div><div style="line-height:21px"><div style=""><span style="white-space:pre-wrap">  </span>        BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);</div><div style=""><span style="white-space:pre-wrap">       </span>        Graphics2D g2 = image.createGraphics();</div><div style=""><span style="white-space:pre-wrap">      </span>        FontMetrics fm = g2.getFontMetrics();</div><div style=""><br></div><div style="">But if I moved these font files into /usr/share/fonts folder, the problems goes away. I'm not sure why these font files impact open jre run time.</div><div style="">I don't think this problem is related to centos.</div><div style=""><br></div><div style="">BTW, I have installed freetype and fontconfig package.</div><div style=""><br></div></div><div style="line-height:21px">Regards,</div><div style="line-height:21px">Rong</div></div><div><div><br></div><div><br></div><div style="font-size:12px;font-family:Arial Narrow;padding:2px 0 2px 0">------------------ Original ------------------</div><div style="font-size:12px;background:#efefef;padding:8px"><div><b>From: </b> "dalibor topic";<<a target="_blank">dalibor.topic@oracle.com</a>>;</div><div><b>Date: </b> Fri, May 20, 2016 08:33 PM</div><div><b>To: </b> "awt-dev"<<a target="_blank">awt-dev@openjdk.java.net</a>>; </div><div></div><div><b>Subject: </b> Re: <AWT Dev> An issue of OpenJRE</div></div><div><br></div>On 20.05.2016 10:45, 31731705 wrote:<br>><br>> Can someboday tell me the differences<br><br>If you have encountered problems with binaries provided by CentOS, <br>you'll need to contact CentOS for support.<br><br>cheers,<br>dalibor topic<br>-- <br><<a href="http://www.oracle.com" target="_blank">http://www.oracle.com</a>> Dalibor Topic | Principal Product Manager<br>Phone: +494089091214 <tel:+494089091214> | Mobile: +491737185961<br><tel:+491737185961><br><br>ORACLE Deutschland B.V. & Co. KG | Kühnehöfe 5 | 22761 Hamburg<br><br>ORACLE Deutschland B.V. & Co. KG<br>Hauptverwaltung: Riesstr. 25, D-80992 München<br>Registergericht: Amtsgericht München, HRA 95603<br><br>Komplementärin: ORACLE Deutschland Verwaltung B.V.<br>Hertogswetering 163/167, 3543 AS Utrecht, Niederlande<br>Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697<br>Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher<br><br><<a href="http://www.oracle.com/commitment" target="_blank">http://www.oracle.com/commitment</a>> Oracle is committed to developing<br>practices and products that help protect the environment</div></blockquote></div></div><br><br>-- <br>pgp key: <a href="http://subkeys.pgp.net/" target="_blank">http://subkeys.pgp.net/</a> PGP Key ID: 80F240CF<br>Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF<br><br>Java Champion - Blog: <a href="http://neugens.wordpress.com" target="_blank">http://neugens.wordpress.com</a> - Twitter: @neugens<br>Proud GNU Classpath developer: <a href="http://www.classpath.org/" target="_blank">http://www.classpath.org/</a><br>OpenJDK: <a href="http://openjdk.java.net/projects/caciocavallo/" target="_blank">http://openjdk.java.net/projects/caciocavallo/</a><br><br>Please, support open standards:<br><a href="http://endsoftpatents.org/" target="_blank">http://endsoftpatents.org/</a><br><br></div>