#1 Re: PDF Engine » Embedding and using font added with AddFontMemResourceEx » 2022-07-28 14:46:00

When using the TGDIPage report generator, we have no access to the pdf object created when the user clicks on "Export pdf".
So the only way to use embedded font is to modify mORMotReoprt.pas to add the call to the PDF.AddTrueTypeFont(...) like rvk did.

Do you think it is possible to either
a) add the AddTrueTypeFont() to the TGDIPage class, record the list of added font and later inject them in the PDF object created when user exports.
b) add a callback OnPdfExport()  called when user click on the export button with a reference to the newly created PDF object, to let the programmer a way to add the font to the PDF object before use ?

What solution do you prefer? I can try to submit a patch to solve this.

As a side note, I had to play with TGdiPage.ForceNoAntiAliased := true;   for the preview to render my memory loaded Font. I think the GDI+ that is created do not see the memory font. Maybe we need to call GdipPrivateAddMemoryFont() in the TGDIPlusFull instance  created in ExpectGDIPlusFull() ? But this is just speculation for now, I don't really know GDI+ internals...

Board footer

Powered by FluxBB