Hello Michal, hello all,
> On 15 October 2019 at 19:00 Michal Sudolsky <[email protected]> wrote: 
> 
> Hi,
> How it looks with this bug?

I'm sorry I did only look cursorily at the issue (yet): I'm no expert for
fonts in PDF and for this reason, but also because other bugs caused crashes,
output data loss in the PoDoFo tool podofoimpose or memory leaking, prioritized
those, i.e. issues (in order of working on them) #49, #56, #57, #45 (only for
infinite recursion, excessive-but-finite recursion prevention outstanding), #58
and #64, #65, #66 and #67, recently also #61 (I've listed only those I think I
was successful in fixing on the platforms I regularly use), scheduled for the
future is #62 (after getting PdfRecursionGuard in its own file and using it on
fully fixing issue #45, this I'd like to get svn r2001 and svn r2002, after the
special revision 2000, which will be about the past, present and future plans
for the PoDoFo project).

Best regards, mabri

> On Sat, Jun 1, 2019 at 9:22 PM Michal Sudolsky < [email protected]> wrote: 
> > I am sending test case:
> > ```
> > 
> > PdfMemDocument doc;
> > PdfPage *page = doc.CreatePage({0, 0, 500, 800});
> > PdfFont *font = doc.CreateFont("Verdana", false, false, false, 
> > PdfEncodingFactory::GlobalWin1250EncodingInstance());
> > PdfPainter p;
> > p.SetPage(page);
> > p.SetFont(font);
> > p.DrawText(10, 780, (const pdf_utf8*)"ČŘĎ");
> > p.FinishPage();
> > doc.Write("doc.pdf");
> > printf("Width of 'ČŘĎ' using newly created font is: %f\n", 
> > font->GetFontMetrics()->StringWidth((const pdf_utf8*)"ČŘĎ"));
> > 
> > PdfMemDocument doc2("doc.pdf");
> > PdfPage *page2 = doc2.GetPage(0);
> > PdfFont *font2 = doc2.GetFont(page2->GetFromResources("Font", 
> > font->GetIdentifier()));
> > PdfPainter p2;
> > p2.SetPage(page2);
> > p2.SetFont(font2);
> > p2.DrawText(10, 760, (const pdf_utf8*)"ČŘĎ");
> > p2.FinishPage();
> > doc2.Write("doc2.pdf");
> > printf("Width of 'ČŘĎ' using loaded font is: %f\n", 
> > font2->GetFontMetrics()->StringWidth((const pdf_utf8*)"ČŘĎ"));
> > 
> > 
> > ```
> > 
> > 
> > This gives incorrect width and also doc2.pdf does not contain second text.
> > 
> > Width of 'ČŘĎ' using newly created font is: 25.968750 
> > Width of 'ČŘĎ' using loaded font is: 36.000000
> > On Tue, May 7, 2019 at 4:56 PM Matthias Brinke < [email protected]> wrote: 
> > > [typos & wrapping fixed in quoted text] 
> > > Hello Michal, hello all, 
> > > 
> > > > On 09 December 2018 at 17:19 Michal Sudolsky < [email protected]> 
> > > > wrote: 
> > > > 
> > > > Hi, 
> > > > Yes, it is usable rather with non-subset fonts. Whether a font is 
> > > > subset or 
> > > > not can be detected. Also it should be possible to check which 
> > > > characters are 
> > > > in a subset for example from weights (at worst from the embedded font 
> > > > file). 
> > > > 
> > > 
> > > I think this detection could be implemented later, i.e. I don't think 
> > > it's 
> > > necessary for acceptance of the patch. 
> > > 
> > > > One use case of this is to fill existing acroforms and construct 
> > > > appearance 
> > > > streams. It looks better and more uniform across viewers than to use 
> > > > "NeedAppearances". It would not be very reasonable to use a subset font 
> > > > for 
> > > > editable text fields. 
> > > > Also the StringWidth function will probably not work due to this bug. 
> > > > Let's 
> > > > say you want to extend the podofo text extraction utility to print also 
> > > > the 
> > > > bounding box of text elements in addition to position. You will get 
> > > > wrong 
> > > > string widths and bounding boxes due to this bug. This use case is 
> > > > reasonable 
> > > > also for subset fonts. 
> > > 
> > > This sounds very interesting, even though I don't think it'll be 
> > > implemented 
> > > in PoDoFo before next release (it's a new feature and there are still 
> > > bugs to 
> > > fix before). 
> > > 
> > > > All bug reports which I sent are based on some real use case. 
> > > 
> > > Could you please post such a test case, ideally minimal, as an attachment 
> > > to 
> > > answer this? 
> > > 
> > > > This is a bug and should be fixed. There is a function which lazily 
> > > > initialises the data structure which it uses and another function which 
> > > > does 
> > > > not. It can be fixed also by lazy initialisation in that other 
> > > > function. 
> > > > I just proposed a fix which I supposed is a better and simpler option. 
> > > 
> > > I also think that the simpler fix should be preferred and apologize for 
> > > only 
> > > coming around to this now. I'll test this and if all checks out, accept 
> > > it, 
> > > shortly after getting a (more or less) minimal test case. Thanks in 
> > > advance. 
> > > 
> > > Best regards, mabri 
> > > 
> > > > 
> > > > On Sat, Dec 8, 2018 at 7:13 AM zyx < [email protected]> wrote: 
> > > > > On Mon, 2018-12-03 at 23:06 +0100, Michal Sudolsky wrote: 
> > > > > > The best is to initialise it during creation of 
> > > > > > PdfDifferenceEncoding. And only place which creates 
> > > > > > PdfDifferenceEncoding is "PdfFont* PdfMemDocument::GetFont( 
> > > > > > PdfObject* pObject )". 
> > > > > 
> > > > >         Hi, 
> > > > > this would not help with subset fonts, because they do not contain 
> > > > > all 
> > > > > the characters of the original font, right? I'm wondering how much 
> > > > > sense that would make to reuse partial font of the existing file. I 
> > > > > mean, there are situations where it does make sense, but also those 
> > > > > where not. It might be up to the library user to decide, while there 
> > > > > is 
> > > > > not much way to give a hint to the user when it makes (or rather does 
> > > > > not make) sense to do it. Or am I missing anything here? 
> > > > >         Bye, 
> > > > >         zyx 
> > > > > 
> > > 
> > > 
> > > _______________________________________________ 
> > > Podofo-users mailing list 
> > > [email protected] 
> > > https://lists.sourceforge.net/lists/listinfo/podofo-users


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

Reply via email to