HTML ouput is now identical to onscreen view
authoramwaterhouse <Andrew Waterhouse>
Tue, 14 Dec 2004 17:35:55 +0000 (17:35 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 14 Dec 2004 17:35:55 +0000 (17:35 +0000)
src/jalview/io/HTMLOutput.java

index b238383..a37d8a2 100755 (executable)
@@ -11,10 +11,11 @@ import java.util.*;
 \r
 public class HTMLOutput\r
 {\r
-  SequenceRenderer sr = new SequenceRenderer(null);\r
+\r
 \r
   public HTMLOutput(AlignViewport av)\r
   {\r
+    SequenceRenderer sr = new SequenceRenderer(av);\r
     Color color;\r
     JFileChooser chooser = new JFileChooser(jalview.bin.Cache.LAST_DIRECTORY);\r
     chooser.setDialogTitle("Save as HTML");\r
@@ -29,7 +30,18 @@ public class HTMLOutput
         out.println("<HTML>");\r
         out.println("<style type=\"text/css\">");\r
         out.println("<!--");\r
-        out.println("td {font-family: \"Courier New\", Courier, mono;; font-size: medium; text-align: center; }");\r
+        out.print("td {font-family: \""+av.getFont().getFamily()+"\", \""+av.getFont().getName()+ "\", mono; "\r
+                   +"font-size: "+av.getFont().getSize()+"px; ");\r
+\r
+\r
+        if (av.getFont().getStyle() == Font.BOLD)\r
+           out.print("font-weight: BOLD; ");\r
+\r
+        if (av.getFont().getStyle() == Font.ITALIC)\r
+           out.print("font-style: italic; ");\r
+\r
+        out.println("text-align: center; }");\r
+\r
         out.println("-->");\r
         out.println("</style>");\r
         out.println("<BODY>");\r
@@ -55,6 +67,7 @@ public class HTMLOutput
             else\r
               cs = av.getGlobalColourScheme();\r
 \r
+\r
             color = sr.getResidueBoxColour(cs, seq, res);\r
 \r
             if(color.getRGB()<-1)\r
@@ -85,7 +98,7 @@ public class HTMLOutput
 \r
         jalview.util.BrowserLauncher.openURL( choice );\r
       }\r
-      catch(Exception ex){}\r
+      catch(Exception ex){ex.printStackTrace();}\r
     }\r
   }\r
 \r