starmath/inc/utility.hxx              |    8 ++++----
 starmath/qa/extras/mmlimport-test.cxx |    4 ++--
 starmath/source/visitors.cxx          |   17 -----------------
 3 files changed, 6 insertions(+), 23 deletions(-)

New commits:
commit 9e92a17cb6e03beedeeca40bfc8524c2623d31eb
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Tue Sep 19 10:56:35 2023 +0300
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Tue Sep 19 14:22:32 2023 +0200

    starmath: Improve glyph positioning
    
    Using twips everywhere and not rounding to pixels seems to improve
    positioning (at least on hipdi displays). Hopefully the issue that
    required rounding is no longer relevant.
    
    Change-Id: I0ee4a4453b2a3d8e06be56d586761f7960a2d4d0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157044
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index 83f3cc124dc1..feaae1fedb40 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -22,7 +22,6 @@
 #include <sal/config.h>
 #include "smdllapi.hxx"
 
-#include <comphelper/lok.hxx>
 #include <o3tl/unit_conversion.hxx>
 #include <sal/log.hxx>
 #include <vcl/font.hxx>
@@ -117,14 +116,15 @@ public:
     virtual void    Insert(const vcl::Font &rFont) override;
 };
 
-// Math uses 100ths of MM by default, but lok needs twips everywhere
+// Math used to use 100ths of MM by default, but now uses twips
+// which seems to improve (subpixel) positioning.
 inline MapUnit SmMapUnit()
 {
-    return comphelper::LibreOfficeKit::isActive() ? MapUnit::MapTwip : 
MapUnit::Map100thMM;
+    return MapUnit::MapTwip;
 }
 inline o3tl::Length SmO3tlLengthUnit()
 {
-    return comphelper::LibreOfficeKit::isActive() ? o3tl::Length::twip : 
o3tl::Length::mm100;
+    return o3tl::Length::twip;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/qa/extras/mmlimport-test.cxx 
b/starmath/qa/extras/mmlimport-test.cxx
index 2fcb1de13744..c6edd0b6481e 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -168,9 +168,9 @@ void Test::testTdf151842()
     SmFormat aFormat = pDocShell->GetFormat();
 
     // Without the fix in place, this test would have failed with
-    // - Expected: 4233
+    // - Expected: 2400
     // - Actual  : 423
-    CPPUNIT_ASSERT_EQUAL(tools::Long(4233), aFormat.GetBaseSize().Height());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(2400), aFormat.GetBaseSize().Height());
 }
 
 void Test::testMathmlEntities()
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index c2c4717df299..3e11201ebef2 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -441,13 +441,6 @@ void SmDrawingVisitor::Visit( SmRootSymbolNode* pNode )
     if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW)
         mrDev.ReMirror(aBar);
 
-    //! avoid GROWING AND SHRINKING of drawn rectangle when constantly
-    //! increasing zoomfactor.
-    //  This is done by shifting its output-position to a point that
-    //  corresponds exactly to a pixel on the output device.
-    Point  aDrawPos( mrDev.PixelToLogic( mrDev.LogicToPixel( aBar.TopLeft( ) ) 
) );
-    aBar.SetPos( aDrawPos );
-
     mrDev.DrawRect( aBar );
 }
 
@@ -500,13 +493,6 @@ void SmDrawingVisitor::Visit( SmRectangleNode* pNode )
     if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW)
         mrDev.ReMirror(aTmp);
 
-    //! avoid GROWING AND SHRINKING of drawn rectangle when constantly
-    //! increasing zoomfactor.
-    //  This is done by shifting its output-position to a point that
-    //  corresponds exactly to a pixel on the output device.
-    Point  aPos ( mrDev.PixelToLogic( mrDev.LogicToPixel( aTmp.TopLeft( ) ) ) 
);
-    aTmp.SetPos( aPos );
-
     mrDev.DrawRect( aTmp );
 }
 
@@ -524,9 +510,6 @@ void SmDrawingVisitor::DrawTextNode( SmTextNode* pNode )
     if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW)
         mrDev.ReMirror(aPos);
 
-    // round to pixel coordinate
-    aPos = mrDev.PixelToLogic( mrDev.LogicToPixel( aPos ) );
-
     mrDev.DrawStretchText( aPos, pNode->GetWidth( ), pNode->GetText( ) );
 }
 

Reply via email to