/// <summary> /// Add font object definition to CSS file /// </summary> /// <param name="font"></param> public void AddFont(CssFontDefinition font) { if (!_fonts.Contains(font)) { _fonts.Add(font); } }
private void AddFontsToCSS(Dictionary<string, ICSSFontFamily> fontsFamilies) { // Add the fonts to CSS foreach (var cssFontFamily in fontsFamilies) { foreach (var subFont in cssFontFamily.Value.Fonts) { var cssFont = new CssFontDefinition { Family = cssFontFamily.Key, FontStyle = CssFontDefinition.FromStyle(subFont.FontStyle), FontWidth = CssFontDefinition.FromWidth(subFont.FontWidth) }; var sources = subFont.Sources.Select(fontSource => CssFontDefinition.ConvertToSourceString(fontSource, _commonSettings)).ToList(); cssFont.FontSrcs = sources; _mainCss.AddFont(cssFont); } } }