From 2c6c43ab475868971209564e23d7e406d2e2068b Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 15 Apr 2005 14:59:24 +0000 Subject: [PATCH] fontmetrics must be obtained after font change --- src/jalview/gui/AnnotationPanel.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 7b0fa67..77f557b 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -345,8 +345,9 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio gg = (Graphics2D) image.getGraphics(); gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - fm = gg.getFontMetrics(); + gg.setFont(av.getFont()); + fm = gg.getFontMetrics(); drawComponent( gg, av.startRes, av.endRes+1); g.drawImage( image, 0, 0, this); @@ -454,9 +455,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio if(validRes && row.annotations[j].displayCharacter.length()>0) { - int charOffset = (av.charWidth - - fm.charWidth(row.annotations[j].displayCharacter. - charAt(0))) / 2; + int charOffset = (av.charWidth - fm.charWidth(row.annotations[j].displayCharacter.charAt(0)))/2; g.setColor( row.annotations[j].colour); if(j==0) { -- 1.7.10.2