Currently, ttmkfdir does not correctly identify the encoding of some/all(?) multibyte fonts. The arphicfonts.ebuild simply calls ttmkfdir which only makes an ascii-0 encoding entry in fonts.scale. Consequently, the font server does not recognise the arphicfonts as providing big5 and gb encodings. The attached patch adds the correct encodings (shamelessly taken from the RedHat 7.3 rpm of Arphicfonts) to the fonts.scale file. The following description might also describes some configuration issues for X and xfs: I like the Arphic TrueType fonts (I use them on my other box under RedHat) with xcin. The ebuild for arphicfonts installs them under /usr/X11R6/lib/X11/fonts/truetype/ and postinstall runs ttmkfdir to recreate fonts.scale. Neither fonts.dir nor fonts.scale includes a big5 entry for the Arphic fonts; they are only listed as ascii-0 fonts. This is the normal, inadequate, behaviour of ttmkfdir. Running ttmkfdir with the '-c' option at least also generates the iso8859-1 encoding, but no big5/gb. I think that that is why RedHat provides customised fonts.scale fonts.dir for all their multibyte ttf rpms. I therefore append the RedHat fonts.scale for Arphic fonts to the gentoo fonts.scale in /usr/X11R6/lib/X11/fonts/truetype. $ ssh redhat-machine Print out the entries in fonts.scale for Arphic big5 fonts stripping out number of entries (line 1) $ sed -n '2,$p' /usr/share/fonts/zh_TW/TrueType/fonts.scale > arphic-fonts.scale $ sed -n '2,$p' /usr/share/fonts/zh_CN/TrueType/fonts.scale >> arphic-fonts.scale $ cat arphic-fonts.scale gkai00mp.ttf -arphic-ar pl kaitim gb-medium-r-normal--0-0-0-0-p-0-iso8859-1 gkai00mp.ttf -arphic-ar pl kaitim gb-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0 gbsn00lp.ttf -arphic-ar pl sungtil gb-medium-r-normal--0-0-0-0-p-0-iso8859-1 gbsn00lp.ttf -arphic-ar pl sungtil gb-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-ascii-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5.cp950-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5.eten-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-ascii-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5.cp950-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5.eten-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1 These are the listings that should be added to the fonts.scale file under gentoo. $ exit $ su # cat <<EOF >> /usr/X11R6/lib/X11/fonts/truetype/fonts.scale bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-ascii-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5.cp950-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5.eten-0 bkai00mp.ttf -Arphic Technology Co.-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-ascii-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5.cp950-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5.eten-0 bsmi00lp.ttf -Arphic Technology Co.-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1 gkai00mp.ttf -arphic-ar pl kaitim gb-medium-r-normal--0-0-0-0-p-0-iso8859-1 gkai00mp.ttf -arphic-ar pl kaitim gb-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0 gbsn00lp.ttf -arphic-ar pl sungtil gb-medium-r-normal--0-0-0-0-p-0-iso8859-1 gbsn00lp.ttf -arphic-ar pl sungtil gb-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0 EOF # cat/usr/X11R6/lib/X11/fonts/truetype/fonts.scale|sed -n '2,$p'|sort|uniq > fonts.scale.tmp # FONT_NO=`cat fonts.scale.tmp|wc -l` # echo $FONT_NO > /usr/X11R6/lib/X11/fonts/truetype/fonts.scale # cat fonts.scale.tmp >> /usr/X11R6/lib/X11/fonts/truetype/fonts.scale # mkfontdir Now you can restart the font server. # kill -HUP `/sbin/pidof xfs` At this point I realised that I didn't have xfs running at all! All my fonts were those listed in the fontpath in /etc/X11/XF86Config. There are some advantages to using xfs (apart from the ability to restart the font server without killing X, I can't think of any but would love to hear what others have to say on this subject...), so edit /etc/X11/XF86Config so that the ONLY fontpath statement is FontPath "unix/:-1" This FontPath has the advantage over the fontpath 7100 that xfs only listens on unix sockets and NOT on the less safe tcp port 7100. Make sure that /etc/conf.d/xfs contains the line XFS_PORT="-1" Also make sure that /etc/X11/fs/config contains entries for the appropriate font paths. The default compiled by gentoo is ok. You may also want to add a "-nolisten tcp" option to the line that starts your X server. If you run xdm, it is the last line of /etc/X11/xdm/Xservers. This way your X server will not accept any connections over tcp but only from the local machine. You then have to make sure that xfs is started for the X server to find its fonts... I use xdm and edit the dependency section /etc/init.d/xdm to read # Start X Font Server before X depend() { need xfs use hotplug } NB: I use emacs for editing text files. Make sure you don't autosave backup files (foo~) in the /etc/init.d/ directory, or delete them. Otherwise the system will try to start up the service foo~ at the next boot. That should be it.
Created attachment 2955 [details, diff] A patch to arphicfonts-0.1.ebuild adding correct encodings for big5/gb. It's ugly and I don't know what to do about unmerging the ebuild.
Created attachment 2961 [details, diff] Added check to see if fonts.scale exists; enclosed variable in braces. Obsoletes 2955.
Unfortunately, my corrections included a nice typo. Here it is tidied up.
Created attachment 3124 [details] Tidied up the ebuild.
Firstly, thanks for your investigative work to sort out this problem. I'm also worried about what happens when we unmerge. Would it perhaps be better to follow RedHat's example and move the fonts to their own folder? THat way we could copy over the font.scale file ans not have to worr about what happens when other ttf fonts are installed after this ebuild is installed ie what happens to our nicely patched font.scale if ttmkdir is run again? What do you think about the seperate dir idea?
I think separate directories would be a good idea. Incidentally, the /etc/X11/XftConfig file already includes paths to /usr/share/fonts/ttf/{western,big5,gb2312,japanese,korean}etc. so it might be best to use these paths. Tomorrow I'll rewrite the ebuild accordingly. By the way, after much experimenting I found that the truetype multibyte fonts only properly work without xfs and with xtt not freetype as the X module. RedHat must have patched their xfs server as it works on RH 7.3
Created attachment 3252 [details] Updated to create separate directories for Chinese fonts.
I have now rewritten the ebuild so that it will install big5 fonts in /usr/share/fonts/ttf/zh_TW and gb2312 fonts in /usr/share/fonts/ttf/zh_CN. It was my intention to write an install script that would check if those font paths are listed in the config files and insert them with appropriate comments in case they are not. However, I have been struggling with the various permutations of font server (X or xfs) and library (freetype or xtt) that a user could possibly have and found that a single script checking which of the four options was active and, indeed, in working order, was too complicated. It currently checks if the font paths are listed in /etc/X11/XF86Config and warns the user to manually adjust this. mkfontdir also creates encodings.dir files in the font directories. This is a precaution for users using the freetype module. The xtt module does not require them.
Marko, Thanks again for all the hard work. I've made a couple of changes to the ebuild. Mainly just to clean it up a little and get rid of src_unpack() now that portage can deal with gzipped files properly. I also took the fonts.scale files and added them to arphicfonts/files dir - this just makes things a little easier to follow in the ebuild I think. I've added the ebuild to cvs and masked till I hear back on the changes I made.If everything works for you (does here so I don't expect any problem) I'll unmask it. The ebuild has been bumped to -r1 as users should remerge to take advantage of your hard work and investigative skills Stuart
Thanks very much. I have just unmasked arphicfonts r1 and it installs perfectly! All the best Marko
Thank you for your contribuiton. I'll unmask it now