}
public static Element createText(Document doc, Text text) {
Element elt = doc.createElement("text");
Location loc = text.getLocation();
Font font = text.getValue(DrawAttr.FONT);
Color fill = text.getValue(DrawAttr.FILL_COLOR);
Object halign = text.getValue(DrawAttr.ALIGNMENT);
elt.setAttribute("x", "" + loc.getX());
elt.setAttribute("y", "" + loc.getY());
if (!colorMatches(fill, Color.BLACK)) {
elt.setAttribute("fill", getColorString(fill));
}
if (showOpacity(fill)) {
elt.setAttribute("fill-opacity", getOpacityString(fill));
}
elt.setAttribute("font-family", font.getFamily());
elt.setAttribute("font-size", "" + font.getSize());
int style = font.getStyle();
if ((style & Font.ITALIC) != 0) {
elt.setAttribute("font-style", "italic");
}
if ((style & Font.BOLD) != 0) {
elt.setAttribute("font-weight", "bold");