printing to file (PDF) with KPrinter

James Richard Tyrer tyrerj at
Fri Jul 23 23:55:03 BST 2004

Marc Heyvaert wrote:
> Hello,
> I know this thing has come up before, but looking in the archives of this 
> list (and some others) I couldn't really find an answer... So here I go.
> I have SuSE linux 8.2, with KDE upgraded to 3.2.2
> gs --version gives 7.05.6
> I have tons of truetype fonts installed. They came from my original Windows 
> instal (my system is dual boot) and most of them are from Corel Draw 7.0 so I
>  think they are good quality.
> When I produce a document using KWord and print it to PDF, my fonts are 
> embedded as Type 3.

Unfortunately, the Qt PostScript driver will not embed TrueType fonts as Type42
so if you embed TrueType fonts with any KDE application and make a PDF, the
TrueType fonts will not be scalable and will look BAD.

> I also loose the names. I used Arial and Times New Roman (I though I would be
>  safe with those!) and some Luxi Sans (regular and italic), but in my 
> document the fonts are embedded as "font A - Type 3 and font B - Type 3).

Since it doesn't embed the fonts as Type42, it isn't all that relevant that it
doesn't use the correct names.

> I included the fonts using KDE Control Center and all the fonts show up 
> nicely on screen, etc. When I look in the font directories I see that Fontmap
>  files were created in all directories, including the /truetype directory.
> I have been reading this webpage:
> And then, this morning I did someadditional tests. I found that I didn't seem
>  to have GS_FONTPATH set,

Tell them that they are wrong.  You should set the GS_LIB if the directories
have a Fontmap file in them.

> so I added that to the .bashrc file in my home dir

That should probably work, but it should really be in a: "/etc/profile.d/*.sh"
script (for Linux and anything that supports 'profile.d' scripts).

> and tried again cramming about 10 fonts in one documents, 8 TT and 2 Type 1 
> (the Luxi's). Again in my PDF I only see font A and B, both Type 3.

As long as the fonts are embedded, in the PostScript file passed to GhostScript,
it is going to use the embedded fonts -- it will only look for them on your
system if they are not embedded.

> On a windows machine, using Acrobat Reader 6, the document looks ok, actually
>  the two type 3's look worse than the 'invisible' fonts. Although when I zoom
>  in very close, I can see the characteristic 'staircase' look at the 
> diagonals.

That is because they are embedded as bitmaps rather than scalable fonts.

> I just had another look at the one directory that gs surely has to know 
> about: /usr/share/ghostscript/fonts
> (although I get this output... kdevelop at linux:~/usr/bin> echo $GS_FONTPATH 
> /usr/share/ghostscript/fonts:/usr/X11R6/lib/X11/fonts/Type1:/usr/X11R6/lib/X11/fonts/truetype)
It is probably better to use:

	gs -h

to check the search path.

> There are surely some fonts in that directory, a whole family of 'Nimbus' 
> fonts. And they are visible in KWord too, although a bit hidden in between 
> the 800 or so other fonts...
> New test and now it works: In document properties I get NimbusRomL9-Regular 
> Type1 Built-in Embedded Subset Type1, The other fonts are still invisible or
>  marked font A, etc.
> So I have a lot of questions here. I really want to understand this. Perhaps
>  I don't understand this concept of embedding?

Well there are two embeddings here.  There is embedding done by the Qt
PostScript driver and embedding done by GhostScript when it makes the PDF file.

> I often get PDF documents with embedded (subsets of) TT fonts. These are 
> probably made by Acrobat distiller or some other pdf generator. Can the same 
> result be obtained by KPrinter/gs?


> Or should I walk the other path of converting my TT fonts to Type 1. On
> second thoughts there must be a problem somewhere because the Type 1 fonts
> that I have in /usr/X11R6/lib/X11/fonts/Type1 are not treated as they should
> be, as the fonts in /usr/share/ghostscript/fonts

The file: "/usr/share/ghostscript/7.05.6/lib/Fontmap.GS" may also contain some 
aliases.  If you install fonts with the same name as the aliases, you must edit 
it to remove the aliases.  Also, as I said, these directories need to be added 
to GS_LIB because that is searched first.

However, this is not used by the Qt PostScript driver when it embeds fonts.  It 
uses FontConfig.  To see if FontConfig is finding the fonts, run [as root]:

	fc-cache -vf

> I have also looked in each font directory that I have and there is a Fontmap
>  file in each of these.

Doesn't matter if the fonts are embedded.

> So that is all the info for the moment. If you need more, just give me a 
> shout :)

What you need to do is to disable font embedding with Qt -- GhostScript will 
still embed the fonts when it makes the PDF.  You can do this with the qtconfig 
program.  Uncheck the box on the "Printer" tab.

However, you will then find that the Qt PostScript driver will get some of the 
PostScript font name wrong.

There is a patch for this problem, but you must patch the Qt code and build it 
from source:

But I can not guarantee that it will work.

Then if you try to print to your printer with the fonts NOT embedded you will 
probably find that they are not found.  If you are using CUPS, you must have 
your fonts in one of the directories built into CUPS or the GhostScript that 
comes with it.  Otherwise the fonts will not be found.  To see this:

	gs -h

and check the "search path".  There are fixes for this problem as well.  If you 
use LPR, GNUlpr, LPRng or something similar (that is you don't use CUPS) there 
is a fix for the problem which appears to be exacerbated by a bug in Bash:

This will NOT work with CUPS.  Be sure to read the README:

and have your GS paths set with a 'profile.d' script.

This message is from the kde mailing list.
Account management:
More info:

More information about the kde mailing list