Apache OpenOffice (AOO) Bugzilla – Issue 76854
PDF conversion problem with Matlab figures.
Last modified: 2017-05-20 11:29:19 UTC
There seems to be some problem with fonts when I export a document to PDF format. This appears only in figures generated with Matlab and pasted as a metafile. The fonts appear very narrow in these figures when I open the PDF file. It all looks fine in the original document and I can also print without any problem. This seems to be common to all applications (text, draw, impress and calc). I can supply example files if necessary.
Created attachment 44805 [details] Original document with a Matlab figure.
Created attachment 44806 [details] PDF file generated from MatlabFigure.odt
I have attached two files (odt and pdf) which illustrate the problem.
confirm
pl->hdu: One can see the same behaviour displaying the document on a Unix version independent of display, print or PDF export. I suspect that the problem lies in the font being neither embeddable nor subsettable, so that a substituted font gets used. The characters seem to be positioned individually in the metafile, so there is not much we could do but pick a font that fits the metrics better. The font seems to be originally monospaced I think.
I have done some more testing and it seems like something is missing in Matlab generated metafiles. Matlab uses Arial Font by default not a mono spaced font. I just wanted to check this and went into text properties in Matlab and confirmed Arial. After copying the Figure again into OO the problem has disappeared, i.e. generated PDF is fine. I am attaching two more files (odt and pdf) with two identical Figures, one pasted directly after plotting in Matlab and the other after confirming Arial Font using text properties of all elements. The font information seems to be there in the original figure too as you can see these figures look the same in the OO document but the PDF conversion somehow does it differently. I am not a programmer so cannot say where the problem is, only writing my observations. I noticed that I had to confirm text properties individually for each text component (x label, y label and axes numbers) in order to fix the whole figure. This is rather tedious so it would be great if it could be fixed somehow.
Created attachment 44827 [details] Original document with a 2 Matlab figures.
Created attachment 44828 [details] PDF file generated from MatlabFigure1.odt
I'll try to fix it for OOo3.
Created attachment 46172 [details] OO2 document with Equation 3 object from MS Word.
Created attachment 46173 [details] PDF file generated from Equation.odt using PDF export
Created attachment 46174 [details] PDF file generated from Equation.odt using CutePDF printer driver
I have attached 3 more files. It appears that the same effect (narrow fonts in PDF exports) can be seen in Equation objects created in Word. I assume this is the same issue so I posted it here. However, when I print to PDF using a PDF printer driver everything is OK. It seems this is not Matlab specific problem. I hope this is useful.
hdu reminder: does vcl/source/gdi/cvtsvm.cxx GDI_FONT_ACTION needs to adjust the absolute font width to the system specific relative font width? This would explain the original problem, but this doesn't explain the PDF-exported formula... maybe PDFWriterImpl::emitEmbeddedFont() needs some map-mode adjustment too.
retargeting
Created attachment 54301 [details] Matlab Figure in Word.
I have recently installed Ubuntu 8.04 on my laptop and can provide a few more comments: 1. When I open the attached OO documents MatlabFigure.odt and MatlabFigure1.odt in Linux they already look wrong, i.e. the same a the exported PDF. I didn't know this as in Windows they will open fine (but the exported PDF is not OK as I said before). 2. The Equation.odt document opens fine in Linux and also looks OK when export it to PDF (unlike Windows system). 3. When I paste a Matlab figure into Word as an Enhanced Metafile and save it (see my last attachment) then it opens fine (in Linux and in Windows) and converts fine to PDF (in Linux but not in Windows!) Does it make any sense? I am not sure... maybe this is something to do with pasting. In word you have a choice of metafile or enhanced metafile.
Reset assigne to the default "issues@openoffice.apache.org".