JAL-3055 restore original deriveFont code for Java runtime
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 27 Aug 2018 14:30:25 +0000 (15:30 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 27 Aug 2018 14:30:25 +0000 (15:30 +0100)
src/jalview/renderer/AnnotationRenderer.java

index 4dd91da..8480a34 100644 (file)
@@ -25,6 +25,7 @@ import jalview.analysis.CodingUtils;
 import jalview.analysis.Rna;
 import jalview.analysis.StructureFrequency;
 import jalview.api.AlignViewportI;
+import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.ColumnSelection;
@@ -669,9 +670,17 @@ public class AnnotationRenderer
                   // scale only if the current font isn't already small enough
                   fmScaling = charWidth;
                   fmScaling /= fmWidth;
-                  gg.setFont(ofont);
-                  gg.transform(
-                          AffineTransform.getScaleInstance(fmScaling, 1.0));
+                  if (Jalview.isJS())
+                  {
+                    gg.setFont(ofont);
+                    gg.transform(AffineTransform.getScaleInstance(fmScaling,
+                            1.0));
+                  }
+                  else
+                  {
+                    g.setFont(ofont.deriveFont(AffineTransform
+                            .getScaleInstance(fmScaling, 1.0)));
+                  }
                   // and update the label's width to reflect the scaling.
                   fmWidth = charWidth;
                 }