if (extents.width == 0 && extents.height == 0) { extents = new Rectangle(0, 0, 1, 1); }
    protected LayoutContext newLayoutContext(Graphics2D g) {        XRLog.layout(Level.FINEST, "new context begin");        getSharedContext().setCanvas(this);        Rectangle extents = getScreenExtents();        XRLog.layout(Level.FINEST, "new context end");        LayoutContext result = getSharedContext().newLayoutContextInstance(extents);        result.setGraphics(g.getDeviceConfiguration().createCompatibleImage(1, 1).createGraphics());                if (result.isPrint()) {            PageBox first = Layer.createPageBox(result, "first");            extents = new Rectangle(0, 0,                     first.getContentWidth(result), first.getContentHeight(result));            result.setExtents(extents);        }                return result;    }