/** Null safe copy of a single font */ protected Font copy(Font font) { if (font == null) return font; List<Expression> fontFamily = copyExpressions(font.getFamily()); Expression fontStyle = copy(font.getStyle()); Expression fontWeight = copy(font.getWeight()); Expression fontSize = copy(font.getSize()); Font copy = sf.font(fontFamily, fontStyle, fontWeight, fontSize); return copy; }
public void visit(Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor(copy(stroke.getColor())); copy.setDashArray(copyExpressions(stroke.dashArray())); copy.setDashOffset(copy(stroke.getDashOffset())); copy.setGraphicFill(copy(stroke.getGraphicFill())); copy.setGraphicStroke(copy(stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin(copy(stroke.getLineJoin())); copy.setOpacity(copy(stroke.getOpacity())); copy.setWidth(copy(stroke.getWidth())); if (STRICT && !copy.equals(stroke)) { throw new IllegalStateException("Was unable to duplicate provided Stroke:" + stroke); } pages.push(copy); }