https://bugs.winehq.org/show_bug.cgi?id=42739
Bug ID: 42739 Summary: CUPS PDF creation, font encoding, garbled / glibberish text Product: Wine Version: 2.4 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wineps.drv Assignee: wine-bugs@winehq.org Reporter: quatze@t-online.de Distribution: ---
Created attachment 57734 --> https://bugs.winehq.org/attachment.cgi?id=57734 Original docx file
This has originally been posted in the forum, see here: https://forum.winehq.org/viewtopic.php?f=8&t=28673
I am running MSOffice 2007 on Wine 2.4 on Arch. It is running very well and I am using it to prepare PDF files from various office files in the background. The PDF files look very good and are searchable. However, they contain text, which is malformed. This depends on the font encoding, I suppose.
As a test setup I copied my Fonts directory from my windows machine to the respectuive wine prefeix/drive_c/windows/Fonts and also installed them in the truetype fonts directory on the linux machine (/usr/share/fonts/TTF + fc-cache and fc-cache-32). So the PDF printing picks up all necessary fonts.
Printing is done via cups-pdf. Currently at 3.0.1, but I have tried several versions starting from 2.6 inclduding and not indcluding several patches found on the internet:
https://github.com/alexivkin/CUPS-PDF-to-PDF http://www.linuxquestions.org/questions ... 175440557/ https://launchpadlibrarian.net/15378121 ... port.patch
It seems that the cups-pdf driver is not the culprit here, as the result is always the same.
My test.docx is attached and contains two lines ('test') the first one in Calibri, the second one in Arial. When I print this docx with wine 2.4, Word 2007 and cups-pdf, a pdf file is created, which looks fine (s. attached), but when I copy and paste the text, I get:
'[garbled text] test'
So apparently, the Calibri-font part is somehow problematic.
pdffonts test_wine.pdf OQHKQC+ArialMT Type 1C WinAnsi yes yes no 10 0 YIGKZZ+Calibri Type 1C Custom yes yes no 8 0
I know I can directly save the docx as a pdf in word and I can also automate this via a makro, but I also would like to print from Outlook, which is not as easy to automate as Word via makros, but easily prints via tjhe /p command line switch.
When I directly save the docx as pdf, I get:
'Test test'
pdffonts test_wine_savepdf.pdf ABCDEE+Calibri TrueType WinAnsi yes yes no 5 0 Arial TrueType WinAnsi no no no 7 0
The difference is that the Calibri font is encoded WinAnsi and not custom.
I checked whether the cups-pdf driver might be the culprit by opening and printing the test.docx file with a native copy of libreoffice and I get:
'Test test'
pdffonts test_lo.pdf BAAAAA+Calibri TrueType WinAnsi yes yes yes 14 0 CAAAAA+ArialMT TrueType WinAnsi yes yes yes 9 0
So, basically, both the cups-pdf driver and wine/word are able to encode WinAnsi, but printing via Word apparently forces the cups-pdf driver to include custom-encoded font-subsets. I somewhere read that ghostscript cannot do anything related to reencoding fonts, so I assume that there is something wrong before cups-pdf starts.
Further observations:
If I use the 'print to file' option in Word (wine) and Word (Windows machine) to produce a PS file, further processing with ghostscript produces a PDF with garbled copied text and Type 1C, Custom encoding Calibri, whilst the same command produces a PDF with copiable text and TrueType, WinAnsi encoding Calibri.