``` PdfMemDocument doc; PdfPainter painter; painter.SetPage(doc.CreatePage(PdfRect(0, 0, 500, 800)));
painter.SetFont(doc.CreateFont("Helvetica")); painter.DrawText(0, 780, "Text 1"); PdfWin1250Encoding(); painter.SetFont(doc.CreateFont("Helvetica", false, false, false, PdfEncodingFactory::GlobalWin1250EncodingInstance())); painter.DrawText(0, 760, "Text 2"); painter.FinishPage(); doc.Write("a.pdf"); return 0; ``` In output pdf is only this font "6 0 obj<</Type/Font/BaseFont/Helvetica/Encoding/WinAnsiEncoding/FirstChar 0/LastChar 255/Subtype/Type1/Widths 7 0 R>>". If I change second font for example to bold then there is also second font with 1250 encoding "8 0 obj<</Type/Font/BaseFont/Helvetica/Encoding<</BaseEncoding/WinAnsiEncoding/Differences[ 131/.notdef 136/.notdef 140/Sacute 141/Tcaron 143/Zacute". When is podofo creating new font it first checks whether is font already not present in its font cache comparing parameters family, bold, italic, symbol and encoding so theoretically different encodings should be supported but PdfWin1250Encoding compares equal to PdfWinAnsiEncoding because PdfWin1250Encoding has parent PdfWinAnsiEncoding and so inherits its GetID. If GetID is used only for encoding comparisons (which seems so) then it should implement own GetID. I would rather not change PdfSimpleEncoding::m_name as it is used as BaseEncoding key and so it should stay WinAnsiEncoding for derived encodings. Same also for PdfIso88592Encoding. Proposed patch attached.
patch_1250_88592.diff
Description: Binary data
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users