Bugzilla – Bug 157630
KDE/qt3 cannot embed .ttc fonts when printing.
Last modified: 2007-05-11 10:54:59 UTC
This bug existed already in SuSE Linux 10.0 and still exists in STABLE.
Created attachment 72602 [details] kwrite-test.txt Test file to help reproducing the bug.
Procedure how to reproduce the bug: Install the Novell-ricoh-fonts package (/dist/full/full-i386/suse/noarch/Novell-ricoh-fonts.rpm). Then: export LC_ALL=ja_JP.UTF-8 kwrite Documents/kwrite-test.txt & In the setup of kwrite, choose HGGothicB as the font to use both for display on screen and for printing: mfabian@magellan:~$ grep -i gothic .kde/share/config/* .kde/share/config/kateschemarc:Font=HGGothicB,10,-1,5,50,0,0,0,0,0 .kde/share/config/kateschemarc:Font=HGGothicB,10,-1,5,50,0,0,0,0,0 mfabian@magellan:~$ Now print the buffer to a .ps file. Try to show the .ps file with "gs": mfabian@magellan:~$ gs print.ps ESP Ghostscript 8.15 (2005-09-22) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. This software comes with NO WARRANTY: see the file COPYING for details. Scanning /usr/X11R6/lib/X11/fonts/ for fonts... 24 files, 24 scanned, 0 new fonts. Scanning /usr/share/fonts/ for fonts... 3 files, 3 scanned, 0 new fonts. Can't find (or can't open) font file /usr/share/ghostscript/Resource/Font/Hggothicb-H. Can't find (or can't open) font file Hggothicb-H. Querying operating system for font files... Didn't find this font on the system! Substituting font Courier for Hggothicb-H. Loading NimbusMonL-Regu font from /usr/share/ghostscript/fonts/n022003l.pfb... 3608256 1932913 2218456 902118 1 done. Loading a TT font from /usr/X11R6/lib/X11/fonts/truetype/msmincho.ttc to emulate a CID font Ryumin-Light ... Done. >>showpage, press <return> to continue<< mfabian@magellan:~$ You see that HGGothicB has not been embedded because gs is still trying to load external fonts. First it tries to load Hggothicb-H but fails as such a font doesn't exist. The correct name would be one of HGGothicB-UniJIS-UTF8-H HGGothicB-EUC-H HGGothicB-H (depending on the encoding). PostScript font names are case sensitive! Then gs falls back to the standard Japanese PostScript font name "Ryumin-Light", which works because the scripts in ghostscript-cjk setup our Ghostscript so that "Ryumin-Light" always works if Japanese fonts is installed ("Ryumin-Light" is made an alias for the "best" installed Japanese Mincho style font). This is of course not perfect because the style of font in the printout is very different from the style of the font on the screen.
Further evidence that HGGothicB was not embedded: mfabian@magellan:~$ grep %%BeginFont print.ps %%BeginFont: Arial %%BeginFont: ArialMT mfabian@magellan:~$
Now setup kwrite to use any Japanese .ttf font instead of a .ttc font, for example "Sazanami Gothic": mfabian@magellan:~$ grep -i gothic .kde/share/config/* .kde/share/config/kateschemarc:Font=Sazanami Gothic,10,-1,5,50,0,0,0,0,0 .kde/share/config/kateschemarc:Font=Sazanami Gothic,10,-1,5,50,0,0,0,0,0 mfabian@magellan:~$ mfabian@magellan:~$ fc-list "HGGothicB" file | grep truetype /usr/X11R6/lib/X11/fonts/truetype/hgjgbbmp.ttc: mfabian@magellan:~$ fc-list "Sazanami Gothic" file | grep truetype /usr/X11R6/lib/X11/fonts/truetype/sazanami-gothic.ttf: mfabian@magellan:~$ Print the same kwrite-test.txt from kwrite again. View the result with "gs": mfabian@magellan:~$ gs print.ps ESP Ghostscript 8.15 (2005-09-22) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. This software comes with NO WARRANTY: see the file COPYING for details. >>showpage, press <return> to continue<< mfabian@magellan:~$ gs doesn't load *any* fonts, i.e. *all* fonts are already embedded in the .ps file. This can also be seen with: mfabian@magellan:~$ grep %%BeginFont print.ps %%BeginFont: Sazanami Gothic Regular %%BeginFont: Sazanami-Gothic-Regular %%BeginFont: Arial %%BeginFont: ArialMT mfabian@magellan:~$
Mike Fabian> PostScript font names are case sensitive! If qt3 used HGGothicB instead of Hggothicb, gs could at least find the correct font. After editing the .ps output: mfabian@magellan:~$ diff print.ps.old print.ps 8c8 < %%DocumentFonts: ArialMT Hggothicb-H --- > %%DocumentFonts: ArialMT HGGothicB-H 105,107c105,107 < % Asian postscript font requested. Using Hggothicb-H < /Hggothicb-HList [ < [ /Hggothicb-H 1.0 0.0 ] --- > % Asian postscript font requested. Using HGGothicB-H > /HGGothicB-HList [ > [ /HGGothicB-H 1.0 0.0 ] 808c808 < /F2 false Hggothicb-HList MF --- > /F2 false HGGothicB-HList MF 866c866 < %%DocumentFonts: ArialMT Hggothicb-H --- > %%DocumentFonts: ArialMT HGGothicB-H mfabian@magellan:~$ gs loads the correct font instead of falling back to "Ryumin-Light": mfabian@magellan:~$ gs print.ps ESP Ghostscript 8.15 (2005-09-22) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. This software comes with NO WARRANTY: see the file COPYING for details. Scanning /usr/X11R6/lib/X11/fonts/ for fonts... 24 files, 24 scanned, 0 new fonts. Scanning /usr/share/fonts/ for fonts... 3 files, 3 scanned, 0 new fonts. Loading a TT font from /usr/X11R6/lib/X11/fonts/truetype/hgjgbbmp.ttc to emulate a CID font HGGothicB ... Done. >>showpage, press <return> to continue<< mfabian@magellan:~$ Of course embedding the font is better, but probably the problem with the wrong case in PostScript font names should be fixed as well.
No reaction from the KDE team on this. Is the case sensitive thing something we still want/can fix at this time? If not I would appreciate a suggestion where to move this bug, e.g. 10.2, SP1 or CODE11.
The problem is unchanged in SLES10 build 1356 (as expected).
The problem still exists in openSUSE 10.2 and STABLE.
I have just tested this with Qt4 in STABLE (libqt4-4.2.2-23) using the /usr/lib64/qt4/demos/textedit/textedit from the libqt4-devel-doc package as the test case. It works! Apparently all .ttc fonts can be embedded.
I don't think anybody has time to fix this in Qt3. As it works in Qt4 already, it will work in KDE as well as soon as we have a Qt4 based KDE. It is probably better to concentrate to have a Qt4 based KDE as soon as possible instead of fixing bugs in Qt3. Therefore I'll close this as WONTFIX.
By the way, it is the same with embedding of .otf fonts: it works with qt4 but doesn't work with qt4.