PS/EPS/PDF export wrong font name

Bug #167151 reported by Wilsonronl
2
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Undecided
Unassigned

Bug Description

Inkscape 0.43, Linux
Mandriva 2006.0, locale = default, US

Text elements in drawing created specifying font as
Helvetica. Upon export to PDF, font name in PDF file
was not recognized. Decide to try export to Postscript.
Examed file and found that instead of Helvetica, the
font family name was NimbusSansL. Verified that SVG
file had specified Helvetica.

Export to EPS has same error.

Work around is to edit PS/EPS file to correct font
family name, then manually convert to PDF.

Revision history for this message
Richard Hughes (cyreve) wrote :

Do you actually have a font called Helvetica? If not,
Inkscape will pick something appropriate and load the font
that is being used and then will query it for its PostScript
name, to ensure a match between screen and printer as close
as possible.

Revision history for this message
Bug Importer (bug-importer) wrote :

Yes, Helvetica.ttf is installed.

Also, there is no font with Nimbus in the name installed.

Further, both GhostView and Adobe Reader find the Helvetica
font, but not the NimbusSansL (or any other Nimbus) font.

Revision history for this message
Richard Hughes (cyreve) wrote :

Can you attach that font here?

Revision history for this message
Bug Importer (bug-importer) wrote :

Font file attached as requested. Were you notified?

Revision history for this message
Richard Hughes (cyreve) wrote :

Yeah, but I'm just about to go offline for Christmas, so
it's going to be a while before anything happens.

Revision history for this message
Richard Hughes (cyreve) wrote :

I don't know where you got that font file, but it has
serious issues. Windows can't load it at all, and internally
it describes itself as Arial Regular.

Inkscape will use the internal name of a font, not the
filename so I wouldn't expect it to work at all and my
original reply would seem to apply.

Can you get it to work in any other applications?

Revision history for this message
Bug Importer (bug-importer) wrote :

It was installed when I installed Mandriva 2006-0
(Linux localhost 2.6.12-12mdk #1 Fri Sep 9 18:15:22 CEST
2005 i686 Pentium III)

Adobe Reader, GhostView/GhostScript and OpenOffice have no
problem using Helvetica.

Also, as I previously said, the SVG file has Helvetica in
it. It only the PS/EPS/PDF file generated by Inkscape (0.43)
that has the font name changed.

An Inkscape SVG file of mine is at:
hamjudo.com/~rlw/HotelMap.svg

Revision history for this message
Richard Hughes (cyreve) wrote :

I think I've tracked down where that font came from. It
seems to be compiled in to the source code for Doxygen in
order to get spat out by the LaTeX backend for the sole
purpose of generating LaTeX files. I can only presume that
it was knocked together for this sole purpose and hence was
never designed to be used as a general-purpose font.

Acrobat and GhostScript will have their own internal fonts
which they will use when asked for a font called 'Helvetica'
since it is pretty much a part of the PostScript spec. I
don't know about OpenOffice but I really doubt that it is
using this font.

Does the Inkscape UI (text & font dialog) actually offer
'Helvetica' as an option?

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Yes, it does offer Helvetica as a font family choice.

I just created another Inkscape SVG file and verified it has
Helvetica in the style attribute of the text element.

I have attached this file for your convenience.

Revision history for this message
Richard Hughes (cyreve) wrote :

Can you attach: "/etc/fonts/fonts.conf" and "fonts.cache-1"
from "/usr/share/fonts" and all its subdirectories (find /
usr/share/fonts -name fonts.cache-1|xargs tar -czf caches.
tar.gz)

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Attaching files asrequested plus one extra.

After reading /etc/fonts/fonts.conf, my first thought was,
ok, looks like I might be able to control the name of the
font family used in the substitution. Unfortunately, the
obvious change did not help - even after a full shutdown and
boot up. fonts.conf.new represents my attempt. Appearently,
a more complex change is needed.

Regardless, it seems to me this font substition is a
rendering concern, not file export (other than the optional
text-to-path conversion).

If I understand your last comment, this substitution was
done by a 3rd party conversion filter that Inkscape uses to
generate PS/EPS output, so this is really a bug in that tool.

I can work around the problem for PDF generation by
modifying ps2pdf.sh. However, I see no "ps_out.inx" file (or
similar) to use as a hook for automatic correction of PS/EPS
files (though there is a epsi_output.inx/ps2epsi.sh pair for
hooking EPSI generation). Is there a way to hook into PS/EPS
generation?

Revision history for this message
Wilsonronl (wilsonronl) wrote :

For some reason, unable to upload gzip'ed tar file of
/usr/share/fonts

Will attempt to transfer to my website. Will send URL when
successful.

Other 2 files uploaded. (see my previous comment)

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Tried several more times and still can't upload the big
(gzip'ed) tar file. I assume it's just too big, even though
the error reported is "invalid file name".

The gzinp'ed tar file of /usr/share/fonts is at:
http:/www.hamjudo.com/~rlw/fonts.tar

(sorry for the delay. Was ill, then had to catch up on work
and other things)

Revision history for this message
Richard Hughes (cyreve) wrote :

Try deleting Helvetica.ttf. In the file I downloaded afms/
adobe/phvr8a.afm is called Helvetica as well, and fontconfig
might be getting confused.

Revision history for this message
Wilsonronl (wilsonronl) wrote :

I removed Helvetica.ttf, then shutdown the PC completely and
rebooted. No change. The generated PS file still has
NimbusSansL instead of Helvetica.

Also, since I have successfully imported SVG files created
under Windows, I manually edited my test SVG to create a 2nd
test, ArialTest.svg, that uses Arial instead of Helvetica.

Upon saving as PS, NimbusSansL was substituted in place of
Arial.

I have not yet tried creating tests with font families
other than Helvetica/Arial.

Revision history for this message
Wilsonronl (wilsonronl) wrote : generated PS file showing font substitution

Other attachments

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Other attachments

Revision history for this message
Richard Hughes (cyreve) wrote :

I think you might need to rebuild some sort of cache or
index or something. There's fc-cache, but I think there
ought to be a distribution-specific way of doing it which
probably does a bit more as well (and that bit more might be
important).

Some Google searching refers to a Mandriva Font Installer
application which probably does the rebuild for you, but you
might need to use it to add or remove a font in order to
persuade this to happen.

Revision history for this message
Wilsonronl (wilsonronl) wrote : generated PS after Nimbus fonts uninsstalled

Other attachments

Revision history for this message
Wilsonronl (wilsonronl) wrote : SVG showing substitution of Sans after Nimbus fonts removed

Other attachments

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Undid removal of Helvetica.ttf, then used Mandriva Font
Installer to review installed fonts. Only one set of
Helvetica fonts was present - Postscript Halvetica (aka
Adobe Helvetica).

Retested Save As to Postscript; results were same.

Then used Font Installed to uninstall the Nimbus Sans fonts.

Retested; font was substituted again, but with Bitstream
Vera Sans.

Further experiment: Created a new test page from scratch,
HSTest.svg. The Inkscape font selector allowed me to select
Helvetica, however, font in SVG file was Sans. (file
attached) Generated PS file, HSTest.ps, still had Bitstream
Vera Sans.

Revision history for this message
Richard Hughes (cyreve) wrote :

1) Does Inkscape show Postscript Helvetica/Adobe Helvetica
in its list?

2) Please post the output of running fc-list

Revision history for this message
Wilsonronl (wilsonronl) wrote : output of fc-list

Other attachments

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Yes, the font dialog does list Helvetica. (though only the
font installer shows that it is a Postscript font)

Output of fc-list attached.

Revision history for this message
Richard Hughes (cyreve) wrote :

Can you run fc-list again, this time with

"FC_DEBUG=2147483647 fc-list > debugfontslist.txt"

This will be a much larger file.

Revision history for this message
Wilsonronl (wilsonronl) wrote :

Ok. Done. File attached as per request.

Forgive me for being impertanent, but as long asInkscape
allows selecting font X, why is there any reason it would
substitute font Y when generating a PS file?

BTW, the same problem occures when I select Times.

Revision history for this message
Richard Hughes (cyreve) wrote :

This bit looks suspicious (line 107):

Add Subst match
        pattern any family Equal "Helvetica"
        pattern any foundry Equal "Adobe"
edit
        Edit family Prepend "Nimbus Sans L";
        Edit foundry Prepend "URW";

But then if you look around line 6606 you see that that
substitution is there for a good reason, because the font
named Helvetica is actually coming from /usr/X11R6/lib/X11/
fonts/75dpi/helvR08-ISO8859-1.pcf.gz (and others for
different character sets) and is thus a bitmap font.

Freetype does not appear to be capable of loading the Adobe
AFMs you have, nor is Helvetica.ttf a valid font file, thus
it's stuck with the ugly bitmaps which it's been told not to
use, so it doesn't.

I've never fully understood the logic behind having
different names for fonts when they're on-screen versus
printed, but the fact is that every font has two names which
frequently differ (usually the postscript name doesn't have
any spaces) and are never interchangeable. I explained
earlier how it would break WYSIWYG to silently use a
different font for printing as opposed to editing, not to
mention the difficulty of actually querying the printer for
what fonts it has available.

So, in summary, I think I'm happy that we've (finally) got
to the bottom of this bug, and it's not really anybody's
fault. I think if you want to point the finger of blame at
anybody it should be fontconfig (bug tracker at bugs.
freedesktop.org if you're interested) for reporting fonts to
applications which its configuration ensures will never
actually be used.

Are you satisfied with this answer?

Revision history for this message
Wilsonronl (wilsonronl) wrote :

At least the underlying cause is known. I will post a report
to freedesktop.org as you suggest.

Still don't understand why uninstalling the "Nimbus Sans"
font family causes Inkscape to substitute "Sans" in place of
"Helvetica" when I select "Helvetica".

When I can, I will try to reinstall "Nimbus Sans" and see
what Inkscape does.

Revision history for this message
Richard Hughes (cyreve) wrote :

Good.

I'm not sure I can explain the Sans thing. It might be a
panic measure for when it really doesn't know what to do. A
lot of your configuration seems to assume the existence of
the Nimbus family.

Thank you for your patience with me during this
investigation. It's been a learning experience for both of
us.

To post a comment you must log in.