Hi Norbert, Thorsten, or anybody with MacOSX experience :-),

On 2012-06-01 at 22:42 +0200, Jan Holesovsky wrote:

> http://cgit.freedesktop.org/libreoffice/core/commit/?id=ac25f124858b79e302adcc533d6a658d5c529394
> 
> I think it does the right thing, but because I know ~nothing about
> fonts, better to have your attention there :-) - can you please have a
> look?

And the same problem appeared on MacOSX:

https://bugs.freedesktop.org/show_bug.cgi?id=50631

I believe the attached patch fixes that, but I have no way to test that
it even compiles, not to say if it really works ;-)  Can you please try
it?  When you compile with it, the shifted text on the vertical ruler
should appear centered inside the ruler again.

Thank you,
Kendy
>From dbc5e7daa97da8a6623d44b73cbfdb212f15a65c Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <[email protected]>
Date: Mon, 4 Jun 2012 13:04:27 +0200
Subject: [PATCH] fdo#50631: Fix the bounding box of rotated glyphs on MacOSX.

Similarly to Ifb04d4a8e485182c5ef2771025b06832bfd75ae0 (commit
ac25f124858b79e302adcc533d6a658d5c529394), we need to rotate the bounding
box of glyphs on MacOSX too.

Additionally, round the position up, and convert the size more
straight-forward way.

Change-Id: Idf7a077836e65072795c6d98d61925ce62ee35b7
---
 vcl/aqua/source/gdi/salgdi.cxx |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 0fccd6d..dbfb3e9 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -1860,11 +1860,27 @@ sal_Bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphId, Rectangle& rR
     if( eStatus != noErr )
         return false;
 
-    const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale - 0.5);
-    const long nMaxX = (long)(aGlyphMetrics.width * mfFontScale + 0.5) + nMinX;
-    const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale - 0.5);
-    const long nMaxY = (long)(aGlyphMetrics.height * mfFontScale + 0.5) + nMinY;
-    rRect = Rectangle( nMinX, nMinY, nMaxX, nMaxY );
+    const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale + 0.5);
+    const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale + 0.5);
+    const long nWidth  = (long)(aGlyphMetrics.width * mfFontScale + 0.5)
+    const long nHeight = (long)(aGlyphMetrics.height * mfFontScale + 0.5);
+    Rectangle aRect(Point(nMinX, nMinY), Size(nWidth, nHeight));
+
+    if ( mnATSUIRotation == 0 )
+        rRect = aRect;
+    else
+    {
+        const double fRadians = mnATSUIRotation * (M_PI/0xB40000);
+        const double nSin = sin( fRadians );
+        const double nCos = cos( fRadians );
+
+        rRect.Left() =  nCos*aRect.Left() + nSin*aRect.Top();
+        rRect.Top()  = -nSin*aRect.Left() - nCos*aRect.Top();
+
+        rRect.Right()  =  nCos*aRect.Right() + nSin*aRect.Bottom();
+        rRect.Bottom() = -nSin*aRect.Right() - nCos*aRect.Bottom();
+    }
+
     return true;
 }
 
-- 
1.7.8.3

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to