pdf import and font names

Post questions on how to use or achieve an effect in Inkscape.
fresta
Posts: 6
Joined: Fri Feb 20, 2009 8:06 pm

pdf import and font names

Postby fresta » Fri Feb 20, 2009 8:10 pm

I have a problem with fonts not being identified when importing pdf files.

Background: I have lots of old projects done in Freehand on the mac. I have found that exporting them to eps, converting to pdf with ps2pdf on my Ubuntu linux box and importing into Inkscape works really well, even for complex rasterized fills. The only problem that is that many fonts are not identified properly.

Here is a simple test case:

1. Create a ps file with contents

Code: Select all

/LibertyBT-Regular findfont
48 scalefont
setfont
newpath
100 500 moveto
(Test font) show


2. Convert to pdf with ps2pdf.

3. Open with Inkscape.

The font is not displayed correctly, and using the text tool on it gives the message
** (inkscape:26959): WARNING **: Family name LibertyBT-Regular does not have an entry in the font lister.


Is this the pdf import bug https://bugs.launchpad.net/inkscape/+bug/179589? Is it possible to work around it somehow?

fresta
Posts: 6
Joined: Fri Feb 20, 2009 8:06 pm

Re: pdf import and font names

Postby fresta » Fri Mar 13, 2009 6:27 pm

I'm replying to my own post with some news.

A more direct way to see the problem is the following:

1. Create an Inkscape document with some fonts, say Syntax and Syntax Bold.
2. Save as pdf. The pdf displays ok (of course, since the fonts are embedded).
3. Both fonts appear in the pdf file with the same name "Syntax", the weight suffix has been removed.
4. Importing the pdf back into Inkscape maps both fonts to Syntax, so the weight information is lost.

I haven't found a way to prepare a pdf so that Inkscape identifies all the fonts properly. However, it is possible to fix the fonts after opening the pdf in Inkscape and saving as an svg by simply replacing the font names in the svg file. It can be done with your favourite text tool, under linux I used

sed file1.svg -f svgfontmap.sed > file2.svg

where the svgfontmap.sed file contains, e.g.,

Code: Select all

s/-inkscape-font-specification:Syntax-Roman/-inkscape-font-specification:Syntax/
s/-inkscape-font-specification:Syntax-Bold/-inkscape-font-specification:Syntax Bold/
s/font-family:LibertyBT;/font-family:Liberty;/
s/-inkscape-font-specification:LibertyBT-Regular/-inkscape-font-specification:Liberty/
s/font-family:Kuenstler480BT/font-family:Kuenstler 480/
s/-inkscape-font-specification:Kuenstler480BT-Black/-inkscape-font-specification:Kuenstler 480 Heavy/


Unfortunately there seems to be no simple way to find out how the names should be changed. I guess that this is the heart of the problem, as discussed in bug 179589. I think there will always be a need for human interaction. So a higher level interface to font replacement when opening pdf files would be very useful. It would not be so hard to link font names in a dialog where one could see the names in the document and the names available to Inkscape directly.


Return to “Help with using Inkscape”