Fix bad exponent position in log scale (bug introduced after commit 1cb43c6d15a3c5b2a... 75/13275/1
Calixte DENIZET [Fri, 29 Nov 2013 12:36:05 +0000 (13:36 +0100)]
To test: plot2d(100:1000);a=gca();a.log_flags="lln";

Change-Id: I89b5140917b3d35ddb88eafb9637e6a645842a77

scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/ruler/AxesRulerSpriteFactory.java

index a8a36fd..0c2fcc6 100644 (file)
@@ -156,6 +156,7 @@ public class AxesRulerSpriteFactory implements RulerSpriteFactory {
         exponentTextEntity.setTextUseFractionalMetrics(axisProperty.getFontFractional());
         exponentTextEntity.setTextColor(ColorFactory.createColor(colorMap, axisProperty.getFontColor()));
         exponentTextEntity.setFont(exponentFont);
+        final int exponentHeight = (int) exponentTextEntity.getLayout().getBounds().getHeight();
         final Dimension exponentSize = exponentTextEntity.getSize();
 
         Texture texture = textureManager.createTexture();
@@ -164,7 +165,7 @@ public class AxesRulerSpriteFactory implements RulerSpriteFactory {
 
             @Override
             public void draw(TextureDrawingTools drawingTools) {
-                drawingTools.draw(mantissaTextEntity, 0, exponentSize.height);
+                drawingTools.draw(mantissaTextEntity, 0, exponentHeight);
                 drawingTools.draw(exponentTextEntity, mantissaSize.width, 0);
             }
 
@@ -172,7 +173,7 @@ public class AxesRulerSpriteFactory implements RulerSpriteFactory {
             public Dimension getTextureSize() {
                 return new Dimension(
                            exponentSize.width + mantissaSize.width,
-                           exponentSize.height + mantissaSize.height
+                           exponentHeight + mantissaSize.height
                        );
             }