From: gmungoc Date: Tue, 28 Aug 2018 15:55:58 +0000 (+0100) Subject: JAL-3055 corrected logo drawing in JS X-Git-Tag: Release_2_11_4_0~45^2~18^2~453 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7dd4345867987ee35d061be13ca3ad37bc179b94;p=jalview.git JAL-3055 corrected logo drawing in JS --- 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);