[chronojump] Encoder CairoBars use preferences.encoderCaptureBarplotFontSize for font above bars



commit e3716f6d91f6d89ce4b9b49ccf7d991f80ba9e74
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Apr 1 10:37:10 2022 +0200

    Encoder CairoBars use preferences.encoderCaptureBarplotFontSize for font above bars

 src/gui/cairo/bars.cs   | 12 ++++++------
 src/gui/eventExecute.cs |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index b2712c952..5f4f191ba 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -715,15 +715,15 @@ public abstract class CairoBars : CairoGeneric
                if(fontHeightAboveBar >= 0)
                        optimalFontHeight = fontHeightAboveBar;
 
-               for(int i = textHeight; te.Width >= maxWidth && i > 0; i --)
+               int i = optimalFontHeight;
+               for(i = optimalFontHeight; te.Width >= maxWidth && i > 0; i --)
                {
                        g.SetFontSize(i);
                        te = g.TextExtents(Util.TrimDecimals(maxLengthNumber, decs));
-                       optimalFontHeight = i;
                }
 
                g.SetFontSize(textHeight); //return font to its default value
-               return optimalFontHeight;
+               return i;
        }
 
        protected void plotResultsOnBar ()
@@ -794,7 +794,7 @@ public abstract class CairoBars : CairoGeneric
 
                //write text
                g.SetSourceColor(black);
-               printText(x, yStart+te.Height/2, 0, Convert.ToInt32(te.Height),
+               printText(x, yStart+te.Height/2, 0, resultFontHeight,
                        Util.TrimDecimals(result, decs), g, alignTypes.CENTER);
 
                //put font size to default value again
@@ -1070,7 +1070,7 @@ public class CairoBars1Series : CairoBars
                        barMain_l.Count * barWidthRatio + 2*sideWidthRatio + (barMain_l.Count-1) * 
spaceBetweenBarsRatio);
                double distanceBetweenCols = barWidth * spaceBetweenBarsRatio;
 
-               resultFontHeight = getBarsResultFontHeight (barWidth*1.5); //*1.5 because there is space at 
left and right
+               resultFontHeight = getBarsResultFontHeight (barWidth*1.20); //*1.2 because there is space at 
left and right
                LogB.Information("resultFontHeight: " + resultFontHeight.ToString());
 
                for(int i = 0; i < barMain_l.Count; i ++)
@@ -1398,7 +1398,7 @@ public class CairoBarsNHSeries : CairoBars
                        2*sideWidthRatio + (barMain_l.Count-1) * spaceBetweenBarsRatio);
                double distanceBetweenCols = barWidth * spaceBetweenBarsRatio;
 
-               resultFontHeight = getBarsResultFontHeight (barWidth*1.1);
+               resultFontHeight = getBarsResultFontHeight (barWidth);
 
                /* mouseLimits
                   if there are 6 bars, 6+6 bars should be 0..11,
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index b14e4f1d2..bb130f9dc 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -3931,7 +3931,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
                if(pegbe.eccon == "c")
                        cb.PassData1Serie (barA_l,
                                        colorMain_l, names_l,
-                                       20, 14, 8, "");
+                                       preferences.encoderCaptureBarplotFontSize, 14, 8, "");
                else {
                        List<List<PointF>> barsSecondary_ll = new List<List<PointF>>();
                        barsSecondary_ll.Add(barA_l);
@@ -3939,7 +3939,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
                        cb.PassData2Series (barB_l, barsSecondary_ll, false,
                                        colorMain_l, colorSecondary_l, names_l,
                                        "Ecc", "Con", false,
-                                       20, 14, 8, "");
+                                       preferences.encoderCaptureBarplotFontSize, 14, 8, "");
                }
 
                cb.GraphDo();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]