Bug #43492 Latest MEM displays garbled characters for japanese caption of graph on CentOS 4
Submitted: 9 Mar 2009 8:32 Modified: 9 Apr 2010 3:59
Reporter: Meiji KIMURA Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Localization Severity:S3 (Non-critical)
Version:2.0.x, 2.1.x OS:Linux
Assigned to: Darren Oldag CPU Architecture:Any

[9 Mar 2009 8:32] Meiji KIMURA
Description:
I used MEM 1.3.2 on CentOS4.5. At that time all japanese caption works well.
But I installed latest MEM(2.0.4) into the same machine, japanese caption of graph 
become garbled characters (white squares appears instead of japanese characters).

I guess the behavior come from the diffrence version of Java between MEM1.3.2 and MEM2.0.4. MEM use the japanese font is specified by fontconfig.properties(provided by 
each OS) under java/lib(or java/jre/lib) directory.

fontconfig.RedHat.bfc used by CentOS is different between MEM 1.3.2 and MEM2.0.4, 
so under combination of MEM2.0.4 and CentOS 4.5, it specify invalid PATH. Thus, 
MEM 2.0.4 can not use proper japanese fonts for graphs.

How to repeat:
Install MEM 2.0.4 service manager onto CentOS 4.x.

Suggested fix:
[Workaround]

Rename "fontconfig.RedHat.bfc" mentioned above, copy "fontconfig.RedHat.4.properties.src" as "fontconfig.RedHat.properties".

So it specify proper path for japanese font and proper character for cation display.

[Suggested fix]

MEM should not depends on OS japanese fonts environment.
[10 Mar 2009 7:53] Meiji KIMURA
I looked into this issue in detail.

MEM set JRE_HOME to /opt/mysql/enterprise/monitor/java, so the font of MEM selected by /opt/mysql/enterprise/monitor/java/lib/fontconfig.*.

Java application (including MEM) use fontconfig like this,
http://java.sun.com/javase/6/docs/technotes/guides/intl/fontconfig.html

Based on this definition, fontconfig.RedHat.4.bfc is used for CentOS4.x.
But fontconfig.RedHat.bfc is used for CentOS4.x.

I read fontconfig.RedHat.properties.src instead of fontconfig.RedHat.bfc(because it is undocumented binary).
It is not good for CentOS4.x. For example, it uses /usr/share/fonts/japanese/TrueType for japanese fonts, but CentOS4.x don't have this directory '/usr/share/fonts/japanese'. (CentOS5.x have it).

CentOS4.x only have '/usr/share/fonts/jan/' for it.

fontconfig.RedHat.4.properties.src looks fine for CentOS4.x.

[Workaround] In /opt/mysql/enterprise/monitor/java/lib/

shell> cp fontconfig.RedHat.4.properties.src fontconfig.RedHat.properties

It will be work well.

[Suggest to fix]
I think that MEM should read fontconfig.RedHat.4.bfc instead of fontconfig.RedHat.bfc under CentOS 4.x.
[10 Mar 2009 7:59] Meiji KIMURA
Or prepare for CentOS specific fontconfigs.
[10 Mar 2009 16:24] Gary Whizin
Cannot reproduce yet but will try some more. Question: Is this new to 2.0 or did it also occur with 1.3?
[11 Mar 2009 23:28] Sloan Childers
patches pushed to trunk and 2.0.x branch
[12 Mar 2009 2:27] Keith Russell
Patch installed in version 2.0.5.7152.
[30 Mar 2009 15:30] Sloan Childers
- added a user override property called "graph.font" so auser can 
        specify a graph font override for problematic systems
      
      INSERT INTO map_entries VALUES (1,'Helvetica','graph.font');
      
      - if no user override is set, our default is still Arial
      - if no user override is set and Arial is not present on the system,
        use the JFreeChart default of SansSerif
[1 Apr 2009 15:08] Sloan Childers
Okay, we have a couple things to test to try to get this working...

1)  Does the machine have Japanese font support?  The MEM server machine *must* have Japanese fonts installed for use to display Japanese fonts on the graphs.  Graphs are generated on the MEM server side.

2)  If you do have Japanese fonts installed, look in the graph logs to see if there are any errors reported that have to do with selecting a font.

3)  If all else fails, you can manually pick a Japanese font to use by setting a server property and restarting the MEM server.

INSERT INTO map_entries VALUES (1,'Some Japanese Font','graph.font');
[10 Jun 2009 20:16] Sloan Childers
Moving to documenting so customers can have the workaround documented for the upcoming 2.1 release.

- added a user override property called "graph.font" so a user can 
        specify a graph font override for problematic systems
      
      INSERT INTO map_entries VALUES (1,'Helvetica','graph.font');
      
      - if no user override is set, our default is still Arial
      - if no user override is set and Arial is not present on the system,
        use the JFreeChart default of SansSerif
[21 Aug 2009 9:19] MC Brown
I've added a note and instructions to the limitation section of the reference appendix.
[9 Apr 2010 3:59] Meiji KIMURA
This problem can reproduce with MEM/agent 2.1.1.1142 on CentOS 4.7 64-bit.

So re-opened it.