fontmetrics must be obtained after font change
authoramwaterhouse <Andrew Waterhouse>
Fri, 15 Apr 2005 14:59:24 +0000 (14:59 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 15 Apr 2005 14:59:24 +0000 (14:59 +0000)
src/jalview/gui/AnnotationPanel.java

index 7b0fa67..77f557b 100755 (executable)
@@ -345,8 +345,9 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio
       gg = (Graphics2D) image.getGraphics();\r
       gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
                           RenderingHints.VALUE_ANTIALIAS_ON);\r
-      fm = gg.getFontMetrics();\r
+\r
       gg.setFont(av.getFont());\r
+      fm = gg.getFontMetrics();\r
 \r
     drawComponent( gg, av.startRes, av.endRes+1);\r
     g.drawImage( image, 0, 0, this);\r
@@ -454,9 +455,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio
 \r
        if(validRes && row.annotations[j].displayCharacter.length()>0)\r
        {\r
-         int charOffset = (av.charWidth -\r
-                            fm.charWidth(row.annotations[j].displayCharacter.\r
-                                         charAt(0))) / 2;\r
+         int charOffset = (av.charWidth - fm.charWidth(row.annotations[j].displayCharacter.charAt(0)))/2;\r
          g.setColor( row.annotations[j].colour);\r
           if(j==0)\r
           {\r