use of uk.ac.ed.ph.snuggletex.SnuggleInput in project xwiki-platform by xwiki.
the class SnuggleTexFormulaRenderer method renderImage.
@Override
protected ImageData renderImage(String formula, boolean inline, FormulaRenderer.FontSize size, FormulaRenderer.Type type) throws IllegalArgumentException, IOException {
SnuggleSession session = this.engine.createSession();
SnuggleInput input = new SnuggleInput(wrapFormula(formula, inline));
session.parseInput(input);
ByteArrayOutputStream output = new ByteArrayOutputStream();
CustomMathMLImageSavingCallback callback = new CustomMathMLImageSavingCallback(output, size.getSize());
WebPageOutputOptions options = JEuclidUtilities.createWebPageOptions(false, callback);
session.writeWebPage(options, new NullOutputStream());
return new ImageData(output.toByteArray(), type);
}
Aggregations