PrivateFontCollection Terrible Quality

2019-09-15 10:48发布

问题:

I am trying to load a font from a file to use when printing for a C# application.

To do this I am loading the font into a PrivateFontCollection and the getting the font family from there. Here is a snippet:

public void Print(Graphics g)
{
   if (_fontCollection == null)
        LoadFonts();

   FontFamily fontFamily= _fontCollection.Where(f => f.Name == "MyFontName").First();
   Font font = new Font(fontFamily, 12);
   g.DrawString("MyString", font, 10,10);
}

private PrivateFontCollection _privateFontCollection;
private void LoadFonts()
{
    _privateFontCollection = new PrivateFontCollection();
    _privateFontCollection.AddFontFile(@"C:\PathTo\Font\...");
}

However the quality is terrible: a screenshot can be found here:

http://snag.gy/1pGWj.jpg

Any idea why this might be???