When a java GUI program tries to display Asian characters (e.g. Chinese) without specifying the exact font, they show as rectangles, even though I have suitable fonts installed.
A workaround is to create the $JDK_HOME/jre/lib/fonts/fallback directory, and copy/symlink a font file that should be used as a fallback, such as Cyberbit.ttf (which has a wide range of unicode characters).
But I think a proper solution should involve fixing the fontconfig files from $JDK_HOME/jre/lib - first, it's not clear which ones are being used; second, I checked all fontconfig*properties.src, and none of them has any correct path for a big5 font (for example). Most of them try to reference ukai.ttc, uming.ttc or bsmi00lp.ttf but the paths are wrong. All these files are in /usr/share/fonts/arphicfonts (and come from the arphicfonts package) but the fontconfig files try to find them in /usr/share/fonts/cjkuni* or /usr/share/fonts/chinese/TrueType or /usr/share/fonts/truetype/arphic. And I'm sure the other Asian fonts (Japanese, Korean etc) have the same kind of problem.
Even after fixing the fontconfig files, I think setting up a fallback font could still be useful, in case some fonts are not installed.
Steps to Reproduce:
Will attach a test program
# emerge --info
Portage 188.8.131.52 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.12.2-r0, 2.6.39-gentoo-r3 x86_64)
System uname: Linux-2.6.39-gentoo-r3-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8500_@_3.16GHz-with-gentoo-2.0.3
Timestamp of tree: Sun, 13 Nov 2011 14:00:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
dev-lang/python: 2.7.2-r3, 3.1.4-r3
sys-devel/autoconf: 2.13, 2.68
sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/gcc: 4.4.5, 4.5.3-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
Repositories: gentoo kde aditsu
ACCEPT_LICENSE="* -@EULA googleearth skype-eula"
CFLAGS="-O2 -pipe -march=core2"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=core2"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
LINGUAS="en en_US en_GB"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="X a52 aac acl acpi alsa amd64 amr apng berkdb bittorrent bzip2 cairo cdda cddb cjk cli cracklib crypt cuda cups cxx dbus declarative dri dv dvd dvdr encode exif faac ffmpeg fontconfig fortran gdbm gimp gnutls gphoto2 gpm gstreamer gtk iconv icu imagemagick ipv6 jack java jbig jpeg jpeg2k kde kipi lame mad mdadm midi mikmod mjpeg mmx mng modules mp3 mpeg mplayer mudflap multilib ncurses nls nptl nptlonly ocr ogg opengl openmp pam pcre png policykit postproc pppd qt3support qt4 quicktime rdesktop readline rtsp samba scanner sdl semantic-desktop session sndfile snmp speex sql sqlite sse sse2 ssl ssse3 subtitles subversion svg symlink sysfs tcpd theora threads tiff truetype unicode usb v4l v4l2 vcd vhosts vnc vorbis webkit x264 xine xml xorg xv xvid zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US en_GB" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Created attachment 292685 [details]
To compile and run it:
javac Test.java;java Test
Note: the file uses UTF-8 encoding.
This should be fixed in icedtea-bin-184.108.40.206-r1.ebuild icedtea-bin-7.2.0-r2.ebuild icedtea-220.127.116.11-r2 and icedtea-7.2.0-r2
Thanks for the report.
Same problem with dev-java/icedtea-18.104.22.168-r3
Still the same with icedtea-bin-22.214.171.124, why? It should be a simple fix.
If it's a simple fix, why don't you provide a patch?
To clarify, I can confirm that it still doesn't work on 6 but it does work on 7. Andrew would know better than anyone whether this is a simple fix so unless you can prove any different, I'm going to close this as fixed given that it works on 7 and we're planning to phase out 6.
(In reply to Andrew John Hughes from comment #5)
> If it's a simple fix, why don't you provide a patch?
Mainly because I'm not familiar with the fontconfig files in the jre - which ones are editable and how they are structured, and which ones are generated and how to generate them. The fix would be simple for somebody who knows these things.
By the way, I currently have 4 jvm's installed on this computer:
- icedtea-126.96.36.199-r1 - buggy
- icedtea-bin-188.8.131.52 - buggy
- icedtea-bin-184.108.40.206 - ok
- oracle-jdk-bin-220.127.116.11 - ok
I can accept that the bug is fixed because icedtea-bin:7 is fiiinaly stable (I guess you had to wait for java 7 to be officially declared dead first?)
I wonder if the fontconfig files can be copied from icedtea 7 to icedtea 6.
(In reply to aditsu from comment #7)
> I can accept that the bug is fixed because icedtea-bin:7 is fiiinaly stable
> (I guess you had to wait for java 7 to be officially declared dead first?)
More like you had to wait for the Gentoo Java team to come back from the dead. Vital signs are still bad.
> I wonder if the fontconfig files can be copied from icedtea 7 to icedtea 6.
The fontconfig.Gentoo.properties files from icedtea-bin 6 and 7 are exactly the same. Andrew tells me that 7 doesn't actually need these files but we install them anyway.
Yeah, 7 uses fontconfig as it should. The files are just for fallback if there is an issue with fontconfig, I believe.
I'm not really that up on these files either. I thought you might have an advantage over me in having a better understanding of the problem, as I don't tend to make use of characters outside Latin-1.
Looking at fontconfig.Gentoo.properties.src, I'm guessing lines like:
just need fixing with the right path. Files like this have to be maintained in step with the font files they reference and this file probably hasn't been updated in years.
It should actually really be in the JDK itself, but it's easier to maintain it in Gentoo itself, I'd say.
Figured it out. In my case, I didn't have arphicfonts installed as I hadn't enabled the cjk flag. 7 must have used some other font. But even after installing that, I realised that the paths for this font package was wrong:
Now it works. I'm about to commit a new version of icedtea so I will include this fix and the next icedtea-bin will reprefixify the file installed by icedtea rather than maintaining a separate copy.