StimVinsh / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

no Polish letters in pdf generated via iText #59

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In an example odt file there is a phrase with Polish letters
Zażółć gęślą jaźń
But if we convert the file to pdf Polish letters are missing. The same problem 
occurs in docx->pdf converter

I was able to make a workaround overriding iText FontFactory but it is an ugly 
solution.

<pre>
FontFactory.setFontImp(new FontFactoryImpEx());
public static class FontFactoryImpEx extends FontFactoryImp {

        @Override
        public Font getFont(String fontname, String encoding, boolean embedded, float size, int style, Color color) {
            return super.getFont(fontname, "cp1250", embedded, size, style, color);
        }
    }
</pre>
Here I enforce font encoding to cp1250 instead of cp1252.

It seems that odf or docx converter always takes from iText font with encoding 
cp1252 which is incorrect.

There should be a parameter to the conversion process which would allow to set 
font encoding. Maybe this information is available somewhere in odf or docx 
file?

Regards, Leszek

Original issue reported on code.google.com by lesz...@safe-mail.net on 14 Dec 2011 at 10:37

Attachments:

GoogleCodeExporter commented 8 years ago
>There should be a parameter to the conversion process which would allow to set 
font >encoding. Maybe this information is available somewhere in odf or docx 
file?

If we can get this encoding information in the docx and odt, it should be very 
cool. Could you study that? Otherwise I will manage that with our Options 
converter.

Regards Angelo

Original comment by angelo.z...@gmail.com on 14 Dec 2011 at 1:12

GoogleCodeExporter commented 8 years ago

Original comment by angelo.z...@gmail.com on 14 Dec 2011 at 1:13

GoogleCodeExporter commented 8 years ago
I googled about this information (also unpacked an odt file and searched inside)
It seems that font encoding information is NOT written to a odt or docx file.

When a file is open font encoding is determined by language version of MsWord 
or OpenOfficeWriter. It also may be changed manually.

So it should be an option 'fontEncoding' to the conversion process. It may 
default to current locale.
Regards Leszek

Original comment by lesz...@safe-mail.net on 15 Dec 2011 at 8:49

GoogleCodeExporter commented 8 years ago
Ok thanks Leszek; I will do that.

Original comment by angelo.z...@gmail.com on 15 Dec 2011 at 8:58

GoogleCodeExporter commented 8 years ago

Original comment by angelo.z...@gmail.com on 10 Jan 2012 at 3:11