Kaydet (Commit) f1651ee5 authored tarafından Sergey Farbotka's avatar Sergey Farbotka Kaydeden (comit) Thorsten Behrens

Fix fdo#55142 - wrong character pos calculation on mac.

Change-Id: If8a0f527102b70bf1dcf292f8df31aaff9fba5c8
üst 16f1e6ed
...@@ -354,6 +354,8 @@ AquaSalGraphics::AquaSalGraphics() ...@@ -354,6 +354,8 @@ AquaSalGraphics::AquaSalGraphics()
{ {
// create the style object for font attributes // create the style object for font attributes
ATSUCreateStyle( &maATSUStyle ); ATSUCreateStyle( &maATSUStyle );
ResetFontStyle();
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -579,6 +581,29 @@ bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*, ...@@ -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() // callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline()
struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; }; struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; };
...@@ -698,7 +723,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac ...@@ -698,7 +723,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac
{ {
if( !pReqFont ) if( !pReqFont )
{ {
ATSUClearStyle( maATSUStyle ); ResetFontStyle();
mpMacFontData = NULL; mpMacFontData = NULL;
return 0; return 0;
} }
...@@ -784,7 +809,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac ...@@ -784,7 +809,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac
if( eStatus != noErr ) if( eStatus != noErr )
{ {
DBG_WARNING( "AquaSalGraphics::SetFont() : Could not set font attributes!\n"); DBG_WARNING( "AquaSalGraphics::SetFont() : Could not set font attributes!\n");
ATSUClearStyle( maATSUStyle ); ResetFontStyle();
mpMacFontData = NULL; mpMacFontData = NULL;
return 0; return 0;
} }
......
...@@ -353,6 +353,7 @@ private: ...@@ -353,6 +353,7 @@ private:
bool GetRawFontData( const PhysicalFontFace* pFontData, bool GetRawFontData( const PhysicalFontFace* pFontData,
std::vector<unsigned char>& rBuffer, std::vector<unsigned char>& rBuffer,
bool* pJustCFF ); bool* pJustCFF );
void ResetFontStyle();
}; };
// --- some trivial inlines // --- some trivial inlines
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment