wrong metric for Chinese font in OpenJDK applications

Bug #472845 reported by Qianqian Fang
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
openjdk-6 (Ubuntu)
Fix Released
Undecided
Unassigned
Jaunty
Fix Released
Undecided
Unassigned
Karmic
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned

Bug Description

OpenJDK does not display Chinese (or CJK) characters correctly. It appears that all Han glyphs were displayed using wrong metric, and is only half to 1/3 of the actual EM width.

A screenshot is attached to illustrate the problem. To reproduce, select "OpenJDK Java 6 policy Tool" from the setting sub-menu, then select menu File\Open and navigate into a folder with Chinese name.

Notice that the Chinese folder name "中文目录" in the top file name box is only half-width, but the Chinese subfolder names in the left panel are fine.

This was also reported previously in Ubuntu Chinese forum (in Chinese), see http://forum.ubuntu.org.cn/viewtopic.php?f=8&t=221482

Creating a link in /usr/lib/jvm/java-6-openjdk/jre/lib/fonts/fallback folder does not solve the problem. Also, OpenJDK does not follow the fontconfig settings.

Update: as pointed out by Man Yuan in Comment#4, the font paths for wqy-zenhei in fontconfig.propertie sneeds to be updated as well. The font file suffix has been changed to ttc after the upgrade to 0.8.34 last year.

Revision history for this message
Qianqian Fang (fangq) wrote :
Revision history for this message
Matthias Klose (doko) wrote : Re: [Openjdk] [Bug 472845] [NEW] wrong metric for Chinese font in OpenJDK applications

On 03.11.2009 16:30, Qianqian Fang wrote:
> Creating a link in /usr/lib/jvm/java-6-openjdk/jre/lib/fonts/fallback
> folder does not solve the problem. Also, OpenJDK does not follow the
> fontconfig settings.

openjdk has it's own idea about fontconfig, and a separate config file in

   /etc/java-6-openjdk/fontconfig.properties

Aron Xu (happyaron)
tags: added: fonts
removed: chinese cjk
Revision history for this message
Matthias Klose (doko) wrote :

please could you recheck this with openjdk-6 in current lucid?

Changed in openjdk-6 (Ubuntu):
status: New → Incomplete
Revision history for this message
Man Yuan (epsilonyuan) wrote :

in Lucid it happens too!! But can be hacked!

Ubuntu 10.04 LTS, i386 and amd64, openjdk-6-jre 6b18-1.8-0ubuntu1

the hack method is :
env _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on' java something

And there is an obvious bug about the fontconfig.properties file
that is, ttc and ttf file confusions:
after installing the zh_cn language support, we only get
/usr/share/fonts/truetype/arphic/uming.ttf #a very basic and default Chinese font
/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc #a more beautiful and popular Chinese sans-serif font

but in fontconfig.properties there are some sentences with paths below:
/usr/share/fonts/truetype/arphic/uming.ttc
/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf

and beware, the ttf-wqy-zenhei package is a suggested package when installing openjdk-6-jre but I can only find wqy-zenhei.ttc in the directory even I installed it.Same problem is found in the ttf-wqy-microhei package,too. I can't find the wqy-microhei.ttf but only wqy-microhei.ttc!!!
And maybe that's a bug for ttf-wqy-zenhei and ttf-wqy-microhei ?

But, even the ttf ttc mismatch is corrected in fontproperties, the problem of wrong metric for Chinese font in OpenJDK applications still happens.

Qianqian Fang (fangq)
description: updated
Revision history for this message
Qianqian Fang (fangq) wrote :

I am pretty sure this is related, someone had reported a test in Ubuntu Chinese forum, OpenJDK behaves differently when hard-coding different Chinese fonts in the fontconfig.properties file. The full report (in Chinese) can be seen here:
http://forum.ubuntu.com.cn/viewtopic.php?f=8&t=270097&sid=c14bc70002ab07beb8786498467c8f5a

the test screenshot is shown from this link:
http://forum.ubuntu.com.cn/download/file.php?id=102213&sid=c14bc70002ab07beb8786498467c8f5a&mode=view/test.png

The broken one at the bottom is "WenQuanYi Zen Hei". The one next to it is "WenQuanYi Zen Hei Mono". I suspect that the wrong metrics is related to the embedded bitmaps.

Revision history for this message
Man Yuan (epsilonyuan) wrote :

Oh~ the test.png above is reported by me…

I should confirm that even for the normal-like fonts in the test.png, the font displaying is a bit strange. There still some colorful pixels around the characters.

Revision history for this message
Tao Wang (dancefire) wrote :

The problem is still in 10.04 Lucid, and it can be fixed by using font 'WenQuanYi Micro Hei' instead of others.

I created a patch, which adds font 'WenQuanYi Micro Hei' and rearrange the search sequence in 'fontconfig.properties'.

The patch also fix the problem of wrong extension for 'uming' and 'wqy-zenhei', which should be '.ttc', not '.ttf'

One thing need to be noticed by package maintainer of 'openjdk-6-jre-headless', this patch requires the dependency on package 'ttf-wqy-microhei', the level should be same as 'ttf-wqy-zenhei', which is 'sug'.

Tao Wang (dancefire)
Changed in openjdk-6 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
muzuiget (muzuiget) wrote :

The patch in #7 work fine for me. The java program's Chinese font problem has annoying Chinese users for a long time. And package "ttf-wqy-microhei" already installed in 10.04 by default. So please fix this, it is simple.

Matthias Klose (doko)
Changed in openjdk-6 (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted openjdk-6 into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in openjdk-6 (Ubuntu Lucid):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-6 - 6b20~pre1-1ubuntu1

---------------
openjdk-6 (6b20~pre1-1ubuntu1) maverick; urgency=low

  * Include docs in the -doc package. LP: #600834.
  * Update from the IcedTea6 trunk.
    - Plugin and netx fixes.
    - Don't link the plugin against the libxul libraries. Closes: #576361.
    - More plugin cpu usage fixes. Closes: #584335, #587049.
    - Plugin: fixes AppletContext.getApplets().
  * Fix Vcs-Bzr location. Closes: #530883.
  * Search for unversioned llvm-config tool.
  * Don't set XFILESEARCHPATH and NLSPATH on startup. LP: #586641.
  * Fix chinese font metrics and prefer using 'WenQuanYi Micro Hei' font.
    LP: #472845.
  * Strip libjvm.so with --strip-debug instead of --strip-unneeded.
    LP: #574997.
 -- Matthias Klose <email address hidden> Thu, 15 Jul 2010 12:40:10 +0200

Changed in openjdk-6 (Ubuntu Maverick):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (17.9 KiB)

This bug was fixed in the package openjdk-6 - 6b18-1.8-4ubuntu3~9.04.2

---------------
openjdk-6 (6b18-1.8-4ubuntu3~9.04.2) jaunty-security; urgency=low

  * Upload to Jaunty

openjdk-6 (6b18-1.8-4ubuntu3) lucid-proposed; urgency=low

  * Update from the 1.8 branch.
  * Rebuild with fixed ant.
  * Disable building the shark based VM on armel.
  * Always build the ARM assembler interpreter in arm mode.

openjdk-6 (6b18-1.8-4) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin and netx fixes.
    - Don't link the plugin against the libxul libraries. Closes: #576361.
    - More plugin cpu usage fixes. Closes: #584335, #587049.
    - Plugin: fixes AppletContext.getApplets().
    - Fix race conditions in plugin initialization code that were causing
      hangs when loading multiple applets in parallel.
  * Fix Vcs-Bzr location. Closes: #530883.
  * Search for unversioned llvm-config tool.
  * Don't set XFILESEARCHPATH and NLSPATH on startup. LP: #586641.
  * Fix chinese font metrics and prefer using 'WenQuanYi Micro Hei' font.
    LP: #472845.
  * Strip libjvm.so with --strip-debug instead of --strip-unneeded.
    LP: #574997.
  * Don't turn on the ARM assembler interpreter when building the shark
    VM.

openjdk-6 (6b18-1.8-3) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin fixes. LP: #597714.
  * Add powerpcspe build fixes (Sebastian Andrzej Siewior). Closes: #586359.
  * Work around build failure on buildds configured with low ARG_MAX
    (Giovanni Mascellani). Closes: #575254.

openjdk-6 (6b18-1.8-2ubuntu2) maverick; urgency=low

  * Search for unversioned llvm-config tool.

openjdk-6 (6b18-1.8-2ubuntu1) maverick; urgency=low

  * Upload to maverick.

openjdk-6 (6b18-1.8-2) unstable; urgency=low

  * Update from the 1.8 branch.
    - Fix build on Hitachi SH. Closes: #575346.
    - Shark and Zero fixes.
  * Build shark using llvm-2.7.
  * Don't use shark to run the test harness when testing the shark build.
  * README.Debian: Add paragraph about debugging the IcedTea NPPlugin.

openjdk-6 (6b18-1.8-1) unstable; urgency=low

  * Upload to unstable.

openjdk-6 (6b18-1.8-0ubuntu1) lucid; urgency=low

  * Update IcedTea6 to the icedtea6-1.8 release.
  * Fix builds on Ubuntu/dapper and Debian/lenny.
  * On hppa, configure --without-rhino --disable-plugin.
  * Fix Hitachi SH configury. Closes: #575346.
  * Start a window manager when running the tests. Prefer metacity,
    as more tests pass with it.
  * Let XToolkit.isTraySupported() return true, if Compiz is running.
    Works around sun#6438179. LP: #300948.
  * Make <java_home>/jre/lib/security/nss.cfg a config file.
  * Fail in the configuration of the packages, if /proc is not mounted.
    java currently uses tricks to find its own shared libraries depending
    on the path of the binary. Will be changed in OpenJDK7. Closes: #576453.
  * Fix PR icedtea/469, testsuite failures with the NSS based security
    provider. LP: #556549.
  * Do not pass LD_LIBRARY_PATH from the plugin to the java process.
    While libnss3.so gets loaded from /usr/lib, the dependent libraries
    are loaded from MOZILLA_FIVE_HOME (See #561216 for the wrong firefox
    config). LP: ...

Changed in openjdk-6 (Ubuntu Jaunty):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (11.3 KiB)

This bug was fixed in the package openjdk-6 - 6b18-1.8-4ubuntu3~9.10.2

---------------
openjdk-6 (6b18-1.8-4ubuntu3~9.10.2) karmic-security; urgency=low

  * Upload to Karmic

openjdk-6 (6b18-1.8-4ubuntu3) lucid-proposed; urgency=low

  * Update from the 1.8 branch.
  * Rebuild with fixed ant.
  * Disable building the shark based VM on armel.
  * Always build the ARM assembler interpreter in arm mode.

openjdk-6 (6b18-1.8-4) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin and netx fixes.
    - Don't link the plugin against the libxul libraries. Closes: #576361.
    - More plugin cpu usage fixes. Closes: #584335, #587049.
    - Plugin: fixes AppletContext.getApplets().
    - Fix race conditions in plugin initialization code that were causing
      hangs when loading multiple applets in parallel.
  * Fix Vcs-Bzr location. Closes: #530883.
  * Search for unversioned llvm-config tool.
  * Don't set XFILESEARCHPATH and NLSPATH on startup. LP: #586641.
  * Fix chinese font metrics and prefer using 'WenQuanYi Micro Hei' font.
    LP: #472845.
  * Strip libjvm.so with --strip-debug instead of --strip-unneeded.
    LP: #574997.
  * Don't turn on the ARM assembler interpreter when building the shark
    VM.

openjdk-6 (6b18-1.8-3) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin fixes. LP: #597714.
  * Add powerpcspe build fixes (Sebastian Andrzej Siewior). Closes: #586359.
  * Work around build failure on buildds configured with low ARG_MAX
    (Giovanni Mascellani). Closes: #575254.

openjdk-6 (6b18-1.8-2ubuntu2) maverick; urgency=low

  * Search for unversioned llvm-config tool.

openjdk-6 (6b18-1.8-2ubuntu1) maverick; urgency=low

  * Upload to maverick.

openjdk-6 (6b18-1.8-2) unstable; urgency=low

  * Update from the 1.8 branch.
    - Fix build on Hitachi SH. Closes: #575346.
    - Shark and Zero fixes.
  * Build shark using llvm-2.7.
  * Don't use shark to run the test harness when testing the shark build.
  * README.Debian: Add paragraph about debugging the IcedTea NPPlugin.

openjdk-6 (6b18-1.8-1) unstable; urgency=low

  * Upload to unstable.

openjdk-6 (6b18-1.8-0ubuntu1) lucid; urgency=low

  * Update IcedTea6 to the icedtea6-1.8 release.
  * Fix builds on Ubuntu/dapper and Debian/lenny.
  * On hppa, configure --without-rhino --disable-plugin.
  * Fix Hitachi SH configury. Closes: #575346.
  * Start a window manager when running the tests. Prefer metacity,
    as more tests pass with it.
  * Let XToolkit.isTraySupported() return true, if Compiz is running.
    Works around sun#6438179. LP: #300948.
  * Make <java_home>/jre/lib/security/nss.cfg a config file.
  * Fail in the configuration of the packages, if /proc is not mounted.
    java currently uses tricks to find its own shared libraries depending
    on the path of the binary. Will be changed in OpenJDK7. Closes: #576453.
  * Fix PR icedtea/469, testsuite failures with the NSS based security
    provider. LP: #556549.
  * Do not pass LD_LIBRARY_PATH from the plugin to the java process.
    While libnss3.so gets loaded from /usr/lib, the dependent libraries
    are loaded from MOZILLA_FIVE_HOME (See #561216 for the wrong firefox
    config). LP: ...

Changed in openjdk-6 (Ubuntu Karmic):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-6 - 6b18-1.8-4ubuntu3

---------------
openjdk-6 (6b18-1.8-4ubuntu3) lucid-proposed; urgency=low

  * Update from the 1.8 branch.
  * Rebuild with fixed ant.
  * Disable building the shark based VM on armel.
  * Always build the ARM assembler interpreter in arm mode.

openjdk-6 (6b18-1.8-4) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin and netx fixes.
    - Don't link the plugin against the libxul libraries. Closes: #576361.
    - More plugin cpu usage fixes. Closes: #584335, #587049.
    - Plugin: fixes AppletContext.getApplets().
    - Fix race conditions in plugin initialization code that were causing
      hangs when loading multiple applets in parallel.
  * Fix Vcs-Bzr location. Closes: #530883.
  * Search for unversioned llvm-config tool.
  * Don't set XFILESEARCHPATH and NLSPATH on startup. LP: #586641.
  * Fix chinese font metrics and prefer using 'WenQuanYi Micro Hei' font.
    LP: #472845.
  * Strip libjvm.so with --strip-debug instead of --strip-unneeded.
    LP: #574997.
  * Don't turn on the ARM assembler interpreter when building the shark
    VM.

openjdk-6 (6b18-1.8-3) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin fixes. LP: #597714.
  * Add powerpcspe build fixes (Sebastian Andrzej Siewior). Closes: #586359.
  * Work around build failure on buildds configured with low ARG_MAX
    (Giovanni Mascellani). Closes: #575254.
 -- Matthias Klose <email address hidden> Fri, 16 Jul 2010 18:46:47 +0200

Changed in openjdk-6 (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.