1 29 30 package com.caucho.xtpdoc; 31 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.XMLStreamWriter; 34 import java.io.IOException ; 35 import java.io.PrintWriter ; 36 37 public class Font extends FormattedTextWithAnchors { 38 private String _color; 39 40 public Font(Document document) 41 { 42 super(document); 43 } 44 45 public void setColor(String color) 46 { 47 _color = color; 48 } 49 50 public void writeHtml(XMLStreamWriter out) 51 throws XMLStreamException 52 { 53 out.writeStartElement("font"); 54 55 if (_color != null) 56 out.writeAttribute("color", _color); 57 58 super.writeHtml(out); 59 60 out.writeEndElement(); 61 } 62 63 public void writeLaTeX(PrintWriter out) 64 throws IOException 65 { 66 out.print("\\textcolor{" + _color + "}{"); 67 68 super.writeLaTeX(out); 69 70 out.print("} "); 71 } 72 } 73 | Popular Tags |