Using private fonts with PDFsharp 1.50 beta 2/3 or MigraDoc

Note: The FontResolver interface has changed between PDFsharp 1.50 beta 1 and PDFsharp 1.50 beta 2. This post describes the new solution for PDFsharp 1.50 beta 2 and later versions.

PDFsharp 1.50 implements a new mechanism for private fonts (fonts that are not installed on the system). You simply implement IFontResolver and assign this to a global property:

// That's all it takes to register your own fontresolver
GlobalFontSettings.FontResolver = new DemoFontResolver();

The interesting part is IFontResolver and how you implement it.
Continue reading Using private fonts with PDFsharp 1.50 beta 2/3 or MigraDoc