private void RegisterLocalFont(string filename) { string psName; FontInfo fontInfo; lock (FontRegistry) { try { psName = FontRegistry.Add(filename); } catch (Exception e) { Logger.Warning(string.Format("Unable to load custom font {0}", filename), e); return; } fontInfo = FontRegistry.Fonts.First(fi => fi.PostscriptName == psName); } IList <FontData> familyFonts; if (!LocalFonts.TryGetValue(fontInfo.Family, out familyFonts)) { familyFonts = LocalFonts[fontInfo.Family] = new List <FontData>(); } var fontData = familyFonts.FirstOrDefault(f => f.PostScriptName.Equals(psName, StringComparison.InvariantCultureIgnoreCase) && f.Style.Equals(psName, StringComparison.InvariantCultureIgnoreCase)); if (fontData == null) { fontData = new FontData { PostScriptName = psName, Style = fontInfo.Style, Family = fontInfo.Family, FullName = fontInfo.FullName } } ; fontData.FileNames.Add(filename); familyFonts.Add(fontData); }