From 7dd4345867987ee35d061be13ca3ad37bc179b94 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 28 Aug 2018 16:55:58 +0100 Subject: [PATCH] JAL-3055 corrected logo drawing in JS --- src/jalview/renderer/AnnotationRenderer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index eb998bb..0aeb45a 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -1468,12 +1468,12 @@ public class AnnotationRenderer double sy = newHeight / asc; double newAsc = asc * sy; double newDec = dec * sy; - // it is not necessary to recalculated lm for the new font. + // it is not necessary to recalculate lm for the new font. // note: lm.getBaselineOffsets()[lm.getBaselineIndex()]) must be 0 // by definition. Was: - // int hght = (int) (ht + (newAsc - newDec - lm.getBaselineOffsets()[lm.getBaselineIndex()])); + // int hght = (int) (ht + (newAsc - newDec); + // - lm.getBaselineOffsets()[lm.getBaselineIndex()])); - final int hght = (int) (ht + (newAsc - newDec)); if (Jalview.isJS()) { /* @@ -1481,17 +1481,19 @@ public class AnnotationRenderer * so use a scaling transform to draw instead, * this is off by a very small amount */ + final int hght = (int) (ht2 + (newAsc - newDec)); Graphics2D gg = (Graphics2D) g.create(); gg.setFont(ofont); - gg.translate(x*charWidth, hght); + int xShift = (int) (x * charWidth / sx); + int yShift = (int) (hght / sy); gg.transform(AffineTransform.getScaleInstance(sx, sy)); - gg.drawString(s, 0, 0); - gg.translate(-x*charWidth, -hght); + gg.drawString(s, xShift, yShift); gg.dispose(); ht2 += newHeight; } else { + final int hght = (int) (ht + (newAsc - newDec)); Font font = ofont .deriveFont(AffineTransform.getScaleInstance(sx, sy)); g.setFont(font); -- 1.7.10.2