Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 390663 - icedtea-bin-1.10.4 fails to use Asian fonts automatically
Summary: icedtea-bin-1.10.4 fails to use Asian fonts automatically
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 21:22 UTC by aditsu
Modified: 2015-05-06 20:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Test program (Test.java,375 bytes, text/plain)
2011-11-15 21:30 UTC, aditsu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aditsu 2011-11-15 21:22:47 UTC
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.

Reproducible: Always

Steps to Reproduce:
Will attach a test program



# emerge --info
Portage 2.1.10.11 (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]
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.1.4-r3
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.5, 4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo kde aditsu
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA googleearth skype-eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=core2"
CHOST="x86_64-pc-linux-gnu"
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"
DISTDIR="/usr/portage/distfiles"
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"
FFLAGS=""
GENTOO_MIRRORS="http://gentoo.aditsu.net/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/mnt/md3/portage-tmp/"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/kde /home/aditsu/ebuilds"
SYNC="rsync://beta/gentoo-portage"
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
Comment 1 aditsu 2011-11-15 21:30:58 UTC
Created attachment 292685 [details]
Test program

To compile and run it:
javac Test.java;java Test

Note: the file uses UTF-8 encoding.
Comment 2 Ralph Sennhauser (RETIRED) gentoo-dev 2011-11-28 15:50:33 UTC
This should be fixed in icedtea-bin-6.1.10.4-r1.ebuild icedtea-bin-7.2.0-r2.ebuild icedtea-6.1.10.4-r2 and icedtea-7.2.0-r2

Thanks for the report.
Comment 3 aditsu 2012-01-10 19:16:30 UTC
Same problem with dev-java/icedtea-6.1.10.4-r3
Comment 4 aditsu 2013-04-16 00:23:15 UTC
Still the same with icedtea-bin-6.1.12.4, why? It should be a simple fix.
Comment 5 Andrew John Hughes 2015-05-06 16:29:53 UTC
If it's a simple fix, why don't you provide a patch?
Comment 6 James Le Cuirot gentoo-dev 2015-05-06 16:45:41 UTC
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.
Comment 7 aditsu 2015-05-06 17:22:04 UTC
(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-6.1.13.5-r1 - buggy
- icedtea-bin-6.1.13.5 - buggy
- icedtea-bin-7.2.5.3 - ok
- oracle-jdk-bin-1.8.0.25 - 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.
Comment 8 James Le Cuirot gentoo-dev 2015-05-06 18:51:34 UTC
(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.
Comment 9 Andrew John Hughes 2015-05-06 19:30:24 UTC
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:

filename.AR_PL_ShanHeiSun_Uni=@GENTOO_PORTAGE_EPREFIX@/usr/share/fonts/uming.ttc
filename.AR_PL_ZenKai_Uni=@GENTOO_PORTAGE_EPREFIX@/usr/share/fonts/ukai.ttc

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.
Comment 10 James Le Cuirot gentoo-dev 2015-05-06 20:31:07 UTC
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:

# media-fonts/arphicfonts
filename.AR_PL_ShanHeiSun_Uni=/usr/share/fonts/uming.ttc
filename.AR_PL_ZenKai_Uni=/usr/share/fonts/ukai.ttc

Should be:

# media-fonts/arphicfonts
filename.AR_PL_ShanHeiSun_Uni=/usr/share/fonts/arphicfonts/uming.ttc
filename.AR_PL_ZenKai_Uni=/usr/share/fonts/arphicfonts/ukai.ttc

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.