summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-06-01 22:16:37 +0200
committerJan Holesovsky <kendy@suse.cz>2012-06-01 22:26:50 +0200
commitac25f124858b79e302adcc533d6a658d5c529394 (patch)
treea6c1a1bff7b4999dfa7b61a7b9276198f67387ea
parentba1951f3d0ab18f38d71896480bf62312895327d (diff)
Return correct bounding box of glyphs on Linux, we forgot to rotate it.
This makes the behavior consistent with what happens on Windows. Change-Id: Ifb04d4a8e485182c5ef2771025b06832bfd75ae0
-rw-r--r--vcl/inc/generic/glyphcache.hxx1
-rw-r--r--vcl/unx/generic/gdi/salgdi3.cxx16
2 files changed, 16 insertions, 1 deletions
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 1ab2a74eda45..4b3286f4b530 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -234,6 +234,7 @@ public:
private:
friend class GlyphCache;
friend class ServerFontLayout;
+ friend class X11SalGraphics;
void AddRef() const { ++mnRefCount; }
long GetRefCount() const { return mnRefCount; }
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index 7761445a89b6..04d21427872c 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -701,7 +701,21 @@ sal_Bool X11SalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphIndex, Rectangle&
nGlyphIndex &= GF_IDXMASK;
const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex );
- rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() );
+ Rectangle aRect( rGM.GetOffset(), rGM.GetSize() );
+
+ if ( pSF->mnCos != 0x10000 && pSF->mnSin != 0 )
+ {
+ double nCos = pSF->mnCos / 65536.0;
+ double nSin = pSF->mnSin / 65536.0;
+ 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();
+ }
+ else
+ rRect = aRect;
+
return sal_True;
}