table.Rows[0].Cells[4].AddParagraph("0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ")
.Format.Font.ApplyFont(new Font("barcode", 36));
...
var documentRenderer = new DocumentRenderer(_document);
documentRenderer.PrepareDocument(); //<--- crash here
It comes through my custom font resolver ResolveTypeface("barcode", false, false)
and GetFont("barcode.ttf")
as expected.
It then comes through with ResolveTypeface("New", false, false)
. I don't know where "New" is coming from.
If I change new Font("barcode", 36) to new Font("Arial", 36) all is well and it never askes for a fontface of "New". I've tried another font, just in case something was messed up there. I've looked through the MigraDoc / PdfSharpCore source but see no reference to a hardcoded "New" string.
My best guess is that MigraDoc to PDF conversion looks up the FontFamily from the font that it used to resolve and then uses that font family (not the original one) when generating the PDF.
This means 2 things: