Text wrapping in svg
843838May 18 2006 — edited Jan 5 2007Hi everyone,
I need some help with the text wrapping in svg.
This is my code:
public void graph(int sequenceLength, String PepSequence){
try{
OutputStream fout= new FileOutputStream("C:/Documents and Settings/goli/workspace/CoverageViewer/web/svg/sequence.svg");
OutputStream bout= new BufferedOutputStream(fout);
OutputStreamWriter out = new OutputStreamWriter(bout,"UTF-8");
out.write("<?xml version='1.0' standalone='no'?>\n");
out.write("<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN'\n");
out.write("http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>\n");
out.write("<svg width='100%' height='100%' version='1.1'");
out.write(" xmlns='http://www.w3.org/2000/svg'>\n");
out.write("<g>");
out.write("<rect width ='" + sequenceLength + "' height='15' x='100' y='200' ");
out.write("style='fill:white;stroke-width:1;stroke:rgb(0,0,0)'/>\n");
out.write("</g>");
out.write("<g>");
out.write(svgString);
out.write("</g>");
out.write("<g>");
out.write("<text x='50' y='350' font-family='Verdana' font-size='15' text-anchor='middle'> '" + PepSequence + "' </text>\n");
out.write("</g>");
out.write("</svg>");
out.flush(); // Don't forget to flush!
out.close();
}
catch (IOException e) {
System.out.println(e.getMessage());
}
}
And string PepSequence is like this:
LPLGVFGVA LGTVILPAL ARHHVKTDR SAFSGALDW GFRTTLLIA PAMLGLLL LAEPLVATL FQYRQFTAF DTRMTAMSV YGLSFGLPA YAMLKVLLP YARQDTR TPVRAGVAA LIANMVFNF ALLAVVYQI MVPPELKAQ GVMQALGKQ PG
I need to warp text into mutiple lines. i have tried using <text:wrap..blah..blah...></text:wrap>, but it didn't work.
Any help would be appreciated.