I am using MigraDoc to create a PDF using the provided data to my method in C#. The PDF is getting generated just fine for most fonts but I have installed a new font on the system called "Dancing Script". This font is available on the system and I can use it with MS Word. I have also seen other entries similar to my query on SO but they don't solve my problem:
One example is this: MigraDoc: Setting font for a document
I am using the correct name, my font is installed and useable in Word. It is a TTF font. MigraDoc recognises the font as available in the system but when rendering the PDF it renders it like a san serif font.
The font I am using can be found here: http://www.impallari.com/dancing
My original code was this:
if (MigraDoc.DocumentObjectModel.Font.Exists(letter.fontName))
{
paragraph.Format.Font = new MigraDoc.DocumentObjectModel.Font(letter.fontName);
}
else
{
paragraph.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial");
}
I have also tried this:
Document document = new Document();
Section section = document.AddSection();
TextFrame tf;
Paragraph paragraph;
if (letter.fontName.ToLower().Equals("courier"))
{
letter.fontName = "Courier New";
}
MigraDoc.DocumentObjectModel.Style style = document.Styles["Normal"];
if (MigraDoc.DocumentObjectModel.Font.Exists(letter.fontName))
{
style.Font.Name = letter.fontName;
style.Font.Name = "Fineliner Script Regular";
}
But in both cases I am unable to get the font rendered on to the PDF. And I get the response:
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ---- Value differs from information retrieved from font image. ---- Assert Long Message ----