diff options
author | Sergey Farbotka <z8sergey8z@gmail.com> | 2012-09-21 14:12:09 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2012-09-21 14:13:08 +0200 |
commit | f1651ee579bf38a49b839dbcb28ac38c0163a3d2 (patch) | |
tree | 0d1d0f261e5c24dec0d1cf05a8a3b0ea7f326872 | |
parent | 16f1e6eddf457d03ece9f5e5967ad553730a44c0 (diff) |
Fix fdo#55142 - wrong character pos calculation on mac.
Change-Id: If8a0f527102b70bf1dcf292f8df31aaff9fba5c8
-rw-r--r-- | vcl/aqua/source/gdi/atsui/salgdi.cxx | 29 | ||||
-rw-r--r-- | vcl/inc/aqua/atsui/salgdi.h | 1 |
2 files changed, 28 insertions, 2 deletions
diff --git a/vcl/aqua/source/gdi/atsui/salgdi.cxx b/vcl/aqua/source/gdi/atsui/salgdi.cxx index 5c0bff7a6243..a57068db0efc 100644 --- a/vcl/aqua/source/gdi/atsui/salgdi.cxx +++ b/vcl/aqua/source/gdi/atsui/salgdi.cxx @@ -354,6 +354,8 @@ AquaSalGraphics::AquaSalGraphics() { // create the style object for font attributes ATSUCreateStyle( &maATSUStyle ); + + ResetFontStyle(); } // ----------------------------------------------------------------------- @@ -579,6 +581,29 @@ bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*, // ----------------------------------------------------------------------- +void AquaSalGraphics::ResetFontStyle() +{ + ATSUClearStyle(maATSUStyle); + + // Set justification attributes + ATSJustPriorityWidthDeltaOverrides nPriorityJustOverrides; + memset(nPriorityJustOverrides, 0, sizeof(nPriorityJustOverrides)); + + nPriorityJustOverrides[kJUSTLetterPriority].growFlags = kJUSTOverrideLimits; + nPriorityJustOverrides[kJUSTLetterPriority].shrinkFlags = kJUSTOverrideLimits; + + ATSUAttributeTag theTag = kATSUPriorityJustOverrideTag; + ByteCount theSize = sizeof(ATSJustPriorityWidthDeltaOverrides); + ATSUAttributeValuePtr thePtr = &nPriorityJustOverrides; + OSStatus eStatus = ATSUSetAttributes(maATSUStyle, 1, &theTag, &theSize, &thePtr); + if (eStatus != noErr) + { + DBG_WARNING("AquaSalGraphics::ResetFontStyle() : Could not override justification attributes!\n"); + } +} + +// ----------------------------------------------------------------------- + // callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline() struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; }; @@ -698,7 +723,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac { if( !pReqFont ) { - ATSUClearStyle( maATSUStyle ); + ResetFontStyle(); mpMacFontData = NULL; return 0; } @@ -784,7 +809,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac if( eStatus != noErr ) { DBG_WARNING( "AquaSalGraphics::SetFont() : Could not set font attributes!\n"); - ATSUClearStyle( maATSUStyle ); + ResetFontStyle(); mpMacFontData = NULL; return 0; } diff --git a/vcl/inc/aqua/atsui/salgdi.h b/vcl/inc/aqua/atsui/salgdi.h index 19fe1f48b9f7..eeb7aa43f2b3 100644 --- a/vcl/inc/aqua/atsui/salgdi.h +++ b/vcl/inc/aqua/atsui/salgdi.h @@ -353,6 +353,7 @@ private: bool GetRawFontData( const PhysicalFontFace* pFontData, std::vector<unsigned char>& rBuffer, bool* pJustCFF ); + void ResetFontStyle(); }; // --- some trivial inlines |