sharedContext = newSharedContext(dotsPerPixel, userAgent);
layoutContext = newLayoutContext();
}
private SharedContext newSharedContext(int dotsPerPixel, UserAgentCallback userAgent) {
SharedContext context = new SharedContext(userAgent);
AWTFontResolver fontResolver = new AWTFontResolver();
context.setFontResolver(fontResolver);
SwingReplacedElementFactory replacedElementFactory = new SwingReplacedElementFactory();
context.setReplacedElementFactory(replacedElementFactory);
context.setTextRenderer(new Java2DTextRenderer());
context.setDPI(72 * this.dotsPerPoint);
context.setDotsPerPixel(dotsPerPixel);
context.setPrint(false);
context.setInteractive(false);
return context;
}