Bug 152343 - Export directly to PDF from Calc creates PDF with corrupt contents.
Summary: Export directly to PDF from Calc creates PDF with corrupt contents.
Status: RESOLVED FIXED
: 157003 (view as bug list)
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: OpenOffice.org (show other bugs)
Version: RC 1
Hardware: i686 Other
: P5 - None : Major (vote)
Target Milestone: ---
Assignee: Petr Mladek
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-21 01:33 UTC by Chad Groneman
Modified: 2006-04-21 15:17 UTC (History)
1 user (show)

See Also:
Found By: Beta-Customer
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
ODS file to "Export directly to PDF" (15.07 KB, application/octet-stream)
2006-02-21 01:36 UTC, Chad Groneman
Details
Corrupt PDF file generated by OOo Calc (149.73 KB, application/pdf)
2006-02-21 01:37 UTC, Chad Groneman
Details
ooo-dejavu.png (3.59 KB, image/png)
2006-02-21 16:18 UTC, Mike Fabian
Details
ooo-helvetica.png (1.12 KB, image/png)
2006-02-21 17:01 UTC, Mike Fabian
Details
awful: mingled letters with default font (152.95 KB, application/pdf)
2006-04-21 12:51 UTC, Silviu Marin-Caea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chad Groneman 2006-02-21 01:33:54 UTC
If you use the Export to PDF from OOo included with SUSE Linux 10.1 beta 4, the resulting PDF has mostly garbage contents.

I will attach a sample ods file and the resulting PDF.
Comment 1 Chad Groneman 2006-02-21 01:36:41 UTC
Created attachment 69408 [details]
ODS file to "Export directly to PDF"

Open this file and export directly to PDF through OOo.  It will be corrupt.
Comment 2 Chad Groneman 2006-02-21 01:37:43 UTC
Created attachment 69409 [details]
Corrupt PDF file generated by OOo Calc
Comment 3 Petr Mladek 2006-02-21 10:54:19 UTC
I have reproduced it.

Hmm, the problem is that ODS file uses the font Arial. It is not available on the system, so the font Nimbus Sans L is used instead.

I tested it with the upstream package and it worked. There difference is that
the upstream package substituted to Helvetica rather than to Nimbus Sans L.

I wonder if the font Nimbus Sans L has broken metric and we should rather use Helvetica.

Mike, what do you think about it?


Note1: I'll increase severity to crytical because OOo is important application on NLD10 and we should support transition from MS format smothly.

Note2: The following list of potential substitute fonts is currently defined for Arial in /usr/lib/ooo-2.0/share/registry/data/org/openoffice/VCL.xcu:

<node oor:name="arial" oor:op="replace">                                                                           
    <prop oor:name="SubstFonts">                                                                               
          <value>albanyamt;albany;arial;nimbussansl;helvetica;lucidasans;lucida;geneva;helmet;sansserif;nimbussansl;nimbussans;andalesansui;arialunicodems;lucidaunicode</value>
    </prop>

Comment 4 Mike Fabian 2006-02-21 11:23:12 UTC
Petr> I wonder if the font Nimbus Sans L has broken metric and we
Petr> should rather use Helvetica.

We don't have "Helvetica".

(Well, that's not completely true, we have "Adobe Helvetica" as a bitmap font,
but a bitmap font is certainly not usable for embedding into a PDF).
Comment 5 Mike Fabian 2006-02-21 14:08:21 UTC
It works if the package "agfa-fonts" is installed because "Albany AMT"
is used then.

I think the package "agfa-fonts" is a default package on NLD
→ reducing sevirity to "normal".
Comment 6 Mike Fabian 2006-02-21 14:49:36 UTC
I can reproduce the problem as well when I delete the Microsoft
Webfonts and the agfa-fonts.
Comment 7 Mike Fabian 2006-02-21 15:34:17 UTC
Looks like OpenOffice has a problem with embedding Type1 fonts.
"Nimbus Sans L" is a Type1 font:

mfabian@magellan:~$ fc-list "Nimbus Sans L" file
/usr/share/ghostscript/fonts/n019024l.pfb:
/usr/share/ghostscript/fonts/n019023l.pfb:
/usr/share/ghostscript/fonts/n019044l.pfb:
/usr/share/ghostscript/fonts/n019043l.pfb:
/usr/share/ghostscript/fonts/n019064l.pfb:
/usr/share/ghostscript/fonts/n019063l.pfb:
/usr/share/ghostscript/fonts/n019004l.pfb:
/usr/share/ghostscript/fonts/n019003l.pfb:
mfabian@magellan:~$

To prove that it is indeed a problem with Type1 fonts, I edited
/usr/lib/ooo-2.0/share/registry/data/org/openoffice/VCL.xcu like this:

			<node oor:name="arial" oor:op="replace">
				<prop oor:name="SubstFonts">
					<value>albanyamt;albany;arial;bitstreamcharter;nimbussansl;helvetica;lucidasans;lucida;geneva;helmet;sansserif;nimbussansl;nimbussans;andalesansui;arialunicodems;lucidaunicode</value>
				</prop>

I.e. I added "Bitstream Charter" in front of "Nimbus Sans L".
"Bitstream Charter" is a Type1 font as well (we also have some
"Bitstream Charter" bitmap fonts, but OOo ignores bitmap fonts
anyway):

mfabian@magellan:~$ fc-list "Bitstream Charter:outline=true" file
/usr/share/ghostscript/fonts/bchbi.pfa:
/usr/X11R6/lib/X11/fonts/Type1/c0632bt_.pfb:
/usr/share/ghostscript/fonts/bchri.pfa:
/usr/X11R6/lib/X11/fonts/Type1/c0648bt_.pfb:
/usr/X11R6/lib/X11/fonts/Type1/c0633bt_.pfb:
/usr/X11R6/lib/X11/fonts/Type1/c0649bt_.pfb:
/usr/share/ghostscript/fonts/bchr.pfa:
/usr/share/ghostscript/fonts/bchb.pfa:
mfabian@magellan:~$

Of course the test file looks already a bit wrong on screen because
"Bitstream Charter" is a serif font and the originally specified "Arial"
is a sans-serif font.

When exporting to PDF one gets "Bitstream Charter" embedded into the PDF:

mfabian@magellan:~$ pdffonts /tmp/foo.pdf
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
CharterBT-Bold                       Type 1       yes no  no      20  0
CAAAAA+OpenSymbol                    TrueType     yes yes yes     12  0
CharterBT-Roman                      Type 1       yes no  no      16  0
mfabian@magellan:~$

And when viewing the PDF file it looks equally wrong as when "Nimbus Sans L"
is used.

I.e. I guess OOo has this a problem with *all* Type1 fonts.
Comment 8 Mike Fabian 2006-02-21 15:37:20 UTC
Petr> I wonder if the font Nimbus Sans L has broken metric and we should
Petr> rather use Helvetica

I don't think Nimbus Sans L has a broken metric.

The following fonts are metric compatible to Helvetica:

    Arial, Albany AMT,Nimbus Sans L

I.e. "Nimbus Sans L" would be a very good replacement for "Arial"
or "Helvetica".

Other fonts which are not metric compatible to "Helvetica" are not a
good replacement for Arial.

Comment 9 Mike Fabian 2006-02-21 16:09:11 UTC
If you specify "Helvetica" in front of "Nimbus Sans L", OOo
uses bitmap fonts for the display and does *not* embed fonts
into the PDF output:

mfabian@magellan:~$ pdffonts /tmp/foo.pdf
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
Helvetica-Bold                       Type 1       no  no  no      14  0
CAAAAA+OpenSymbol                    TrueType     yes yes yes     12  0
Helvetica                            Type 1       no  no  no      13  0
mfabian@magellan:~$

Then the display with xpdf, kpdf, ghostview, ... works because
the PDF viewer or printing system uses some fallback for "Helvetica"
(which is usually "Nimbus Sans L" again but in the PDF viewer
or in Ghostscript this works contrary to OOo).

Comment 10 Mike Fabian 2006-02-21 16:13:31 UTC
If "dejavusans" is added to
/usr/lib/ooo-2.0/share/registry/data/org/openoffice/VCL.xcu like this
(and the "dejavu" package is installed of course):

			<node oor:name="arial" oor:op="replace">
				<prop oor:name="SubstFonts">
					<value>albanyamt;albany;arial;dejavusans;nimbussansl;helvetica;lucidasans;lucida;geneva;helmet;sansserif;nimbussansl;nimbussans;andalesansui;arialunicodems;lucidaunicode</value>
				</prop>

printing works because the DéjàVu fonts are TrueType fonts and
apparently OpenOffice has problems only with Type1 fonts.
Comment 11 Mike Fabian 2006-02-21 16:14:56 UTC
But, as I already wrote above, you cannot replace "Arial" by any
random sans-serif font, it should be metric compatible, otherwise
you will see problems in the screen display.
Comment 12 Mike Fabian 2006-02-21 16:18:12 UTC
Created attachment 69607 [details]
ooo-dejavu.png

screen shot which shows that "dejavusans" doesn't work well as a replacement
for "Arial". You can see overlapping glyphs due to the differences
in the metric.
Comment 13 Mike Fabian 2006-02-21 16:59:14 UTC
If "Helvetica" is specified in front of "Nimbus Sans L" as written
in comment #9, OOo apparently uses "Helvetica" via the X11 core
font system, not via fontconfig/Xft because the "Helvetica" fonts
cannot be found by looking into /proc/<pid-of-soffice>/maps.

Comment 14 Mike Fabian 2006-02-21 17:01:46 UTC
Created attachment 69612 [details]
ooo-helvetica.png

screen shot of the test file when using "Helvetica".

You can see that the "Helvetica" bitmap font is used on screen.

This will probably cause problems when using different font sizes
because the "Helvetica" bitmap fonts are only available in
a few discrete sizes.
Comment 15 Mike Fabian 2006-02-21 17:17:14 UTC
I'm not sure what is the best solution here.

It seems to be a bug in OpenOffice of course that it cannot
embed Type1 fonts correctly.

But if this cannot be fixed, maybe the only easy workaround
is to move helvetica in front of nimbussansl, i.e.:

			<node oor:name="arial" oor:op="replace">
				<prop oor:name="SubstFonts">
					<value>albanyamt;albany;arial;helvetica;nimbussansl;lucidasans;lucida;geneva;helmet;sansserif;nimbussansl;nimbussans;andalesansui;arialunicodems;lucidaunicode</value>
				</prop>

The bitmaps don't look nice on screen and will cause problems with scaling,
but maybe this is less bad as the broken printout.

Of course it is much better to make sure that the "agfa-fonts" package
is installed, then "Albany AMT" is available which is a perfect
replacement for "Arial".
Comment 16 Petr Mladek 2006-02-21 17:59:23 UTC
Great investigation! I have reproduced the bug with the upstream package and found that it is already reported as http://www.openoffice.org/issues/show_bug.cgi?id=61929.

(I am sorry that I did not find it earlier but it looked like a SUSE specific bug.)

The upstream bug is very fresh. I hope that they would want to fix it for OOo-2.0.2-final.

I would suggest to wait one week if there is a progress. If it is not fixed by upstream, we could prefer the bitmap fonts over the Type1 fonts as a temporary workaround for SL 10.1.

I would wait one week because I think that more fixes would be necessary:
    Helvetica vs. Nimbus Sans L
    Times vs. Nimbus Roman No9 L
    Courier vs. Nimbus Mono L
    ???
Comment 17 Petr Mladek 2006-03-02 19:53:05 UTC
It is fixed by upstream in OOo-2.0.2rc4. The fixed package should be available on NLD10-beta7/SL10.1-beta8.
Comment 18 Petr Mladek 2006-03-10 15:53:05 UTC
*** Bug 157003 has been marked as a duplicate of this bug. ***
Comment 19 Silviu Marin-Caea 2006-04-21 12:51:59 UTC
Created attachment 79419 [details]
awful: mingled letters with default font

Bug still present in RC1
Comment 20 Silviu Marin-Caea 2006-04-21 12:54:01 UTC
Reopening and changing severity to Major
Comment 21 Mike Fabian 2006-04-21 15:17:07 UTC
Embedding the Nimbus Type1 fonts works fine for me with
the OpenOffice_org rpm package where the last changelog entry is

mfabian@magellan:/tmp$ rpm -q --changelog  OpenOffice_org  |head 
* 金  4月 14 2006 - pmladek@suse.cz
- updated ooo-build to version 2.0.2.7:
  * better fix for crash when selecting email application [#154458]
  * avoids strange 2.6 specific hacks

I tried with the attachment from comment #1 and before testing
I removed the agfa-fonts package and the Microsoft webfonts.

The Nimbus Type1 fonts were embedded when testing like this:

mfabian@magellan:/tmp$ pdffonts test.pdf 
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
NimbusSanL-BoldCond                  Type 1       yes no  yes     22  0
CAAAAA+OpenSymbol                    TrueType     yes yes yes     12  0
NimbusSanL-Regu                      Type 1       yes no  yes     17  0
mfabian@magellan:/tmp$

And the created pdf file displayed correctly in xpdf.

Therefore I think this bug is fixed.

If you still think there are problems, please give an exact procedure
how to reproduce them.