From db828a80af30619c8d46259c700be89c4731b700 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 12 Dec 2005 12:24:24 +0000 Subject: [PATCH] Font changes on export png/eps --- src/jalview/gui/AlignmentPanel.java | 21 +++++++++++++++------ src/jalview/gui/AnnotationLabels.java | 1 + src/jalview/gui/IdCanvas.java | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index af24c9f..c7fccfe 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -657,6 +657,9 @@ public class AlignmentPanel extends GAlignmentPanel Color currentColor = null; Color currentTextColor = null; + pg.setFont(new Font(av.getFont().getName(), + Font.ITALIC, + av.getFont().getSize())); for (int i = startSeq; i < endSeq; i++) { if ( (av.getSelectionGroup() != null) && @@ -686,6 +689,8 @@ public class AlignmentPanel extends GAlignmentPanel (av.getCharHeight() / 5)); } + pg.setFont(av.getFont()); + // draw main sequence panel pg.translate(idWidth, 0); seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, @@ -693,9 +698,9 @@ public class AlignmentPanel extends GAlignmentPanel if (av.showAnnotation && (endSeq == av.alignment.getHeight())) { - pg.translate( -idWidth, (endSeq - startSeq) * av.charHeight + 3); + pg.translate( -idWidth-3, (endSeq - startSeq) * av.charHeight + 3); alabels.drawComponent( (Graphics2D) pg, idWidth); - pg.translate(idWidth, 0); + pg.translate(idWidth+3, 0); annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes + 1); } @@ -773,14 +778,14 @@ public class AlignmentPanel extends GAlignmentPanel } if (labels != null) { - pg.translate(0, + pg.translate(-3, ypos + (av.getAlignment().getHeight() * av.charHeight)); pg.setFont(av.getFont()); labels.drawComponent(pg, idWidth); pg.setFont(italic); - pg.translate(0, + pg.translate(+3, -ypos - (av.getAlignment().getHeight() * av.charHeight)); } @@ -841,15 +846,19 @@ public class AlignmentPanel extends GAlignmentPanel if (av.getWrapAlignment()) { if(im.getGraphics()!=null) + { printWrappedAlignment(im.getGraphics(), width, height, 0); + im.writeImage(); + } } else { if(im.getGraphics()!=null) + { printUnwrapped(im.getGraphics(), width, height, 0); + im.writeImage(); + } } - - im.writeImage(); } catch (OutOfMemoryError err) { diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 8561e64..5eb5af5 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -376,6 +376,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, */ public void drawComponent(Graphics g, int width) { + g.setFont(new Font("Arial", Font.PLAIN, av.getFont().getSize()-2)); FontMetrics fm = g.getFontMetrics(g.getFont()); g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 0c6da36..f4c7380 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -238,16 +238,16 @@ public class IdCanvas extends JPanel for (int i = starty; i < av.alignment.getHeight(); i++) { SequenceI s = av.alignment.getSequenceAt(i); + gg.setFont(italic); drawIdString(gg, s, i, 0, ypos); } if(labels!=null) { - gg.setFont(av.getFont()); gg.translate(0, ypos+(av.getAlignment().getHeight() * av.charHeight)); labels.drawComponent(gg, getWidth()); gg.translate(0, -ypos-(av.getAlignment().getHeight() * av.charHeight)); - gg.setFont(italic); + } } } -- 1.7.10.2