Bug solved for style font Bold, Italic and BoldItalic!!!
File: PdfFontTable.cs
Class: PdfSharp.Pdf.Advanced.PdfFontTable.FontSelector
Method: Constructor
Line: 208
UPDATED
Code:
public FontSelector(XFont font)
{
this.name = font.Name;
// Ignore Strikeout and Underline
if (font.FontFamily.IsStyleAvailable(XFontStyle.Bold & XFontStyle.Italic))
this.style = XFontStyle.Regular;
else if (font.FontFamily.IsStyleAvailable(XFontStyle.Bold))
this.style = XFontStyle.Bold;
else if (font.FontFamily.IsStyleAvailable(XFontStyle.Italic))
this.style = XFontStyle.Italic;
else
this.style = XFontStyle.BoldItalic;
this.fontType = font.Unicode ? FontType.Type0 : FontType.TrueType;
}
ORIGINAL WITH BUG
Code:
public FontSelector(XFont font)
{
this.name = font.Name;
// Ignore Strikeout and Underline
this.style = font.Style & (XFontStyle.Bold | XFontStyle.Italic);
// Clear styles that are not available to prevent embedding of identical font files
if ((this.style & XFontStyle.Bold) == XFontStyle.Bold && !font.FontFamily.IsStyleAvailable(XFontStyle.Bold))
this.style &= ~XFontStyle.Bold;
if ((this.style & XFontStyle.Italic) == XFontStyle.Italic && !font.FontFamily.IsStyleAvailable(XFontStyle.Italic))
this.style &= ~XFontStyle.Italic;
this.fontType = font.Unicode ? FontType.Type0 : FontType.TrueType;
}