When calling function "PdfFont* PdfMemDocument::GetFont( PdfObject* pObject
)" to get existing font from pdf it marks some objects like font object and
"widths" as dirty so in updating mode are overwritten even when there is no
change. What is worse it breaks font using difference encoding by setting
encoding of font to "0 0 R" thus producing invalid pdf.

6 0 obj<</Type/Font/BaseFont/Helvetica/Encoding 0 0 R/FirstChar 0/LastChar
255/Subtype/Type1/Widths 8 0 R>>

Reduced test case:
```
PdfMemDocument doc;
PdfPainter painter;
painter.SetPage(doc.CreatePage(PdfRect(0, 0, 500, 800)));
PdfFont *font = doc.CreateFont("Helvetica", false, false, false,
PdfEncodingFactory::GlobalWin1250EncodingInstance());
painter.SetFont(font);
painter.DrawText(0, 780, (pdf_utf8*)"aČb");
painter.FinishPage();
doc.Write("a.pdf");

PdfMemDocument doc1("a.pdf", true);
doc1.GetFont(doc1.GetPage(0)->GetFromResources("Font",
font->GetIdentifier()));
doc1.WriteUpdate("b.pdf");
```

Text in "b.pdf" becomes broken.

Attachment: a.pdf
Description: Adobe PDF document

Attachment: b.pdf
Description: Adobe PDF document

_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to