SvgFontProcessor { public void addFontFaceFonts(ICssResolver cssResolver) { if (cssResolver instanceof SvgStyleResolver) { for (CssFontFaceRule fontFace : ((SvgStyleResolver) cssResolver).getFonts()) { boolean findSupportedSrc = false; CssFontFace ff = CssFontFace.create(fontFace.getProperties()); if (ff != null) { for (CssFontFace.CssFontFaceSrc src : ff.getSources()) { if (createFont(ff.getFontFamily(), src, fontFace.resolveUnicodeRange())) { findSupportedSrc = true; break; } } } if (!findSupportedSrc) { LoggerFactory.getLogger(SvgFontProcessor.class) .error(MessageFormatUtil.format(LogMessageConstant.UNABLE_TO_RETRIEVE_FONT, fontFace)); } } } } SvgFontProcessor(SvgProcessorContext context); void addFontFaceFonts(ICssResolver cssResolver);  }
@Test public void addFontFaceFontsTest() { Element styleTag = new Element(Tag.valueOf("style"), ""); TextNode styleContents = new TextNode("\n" + "\t@font-face{\n" + "\t\tfont-family:Courier;\n" + "\t\tsrc:local(Courier);\n" + "\t}\n" + " ", ""); JsoupElementNode jSoupStyle = new JsoupElementNode(styleTag); jSoupStyle.addChild(new JsoupTextNode(styleContents)); SvgProcessorContext context = new SvgProcessorContext(new SvgConverterProperties()); ICssResolver cssResolver = new SvgStyleResolver(jSoupStyle, context); SvgFontProcessor svgFontProcessor = new SvgFontProcessor(context); svgFontProcessor.addFontFaceFonts(cssResolver); FontInfo info = (FontInfo) context.getTempFonts().getFonts().toArray()[0]; Assert.assertEquals("Courier", info.getFontName()); }