[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 3 commits - solenv/inc vcl/aqua vcl/source
Herbert Dürr
hdu at apache.org
Thu Apr 10 03:07:34 PDT 2014
solenv/inc/minor.mk | 2 +-
vcl/aqua/source/gdi/ctlayout.cxx | 29 ++++++++++++++++-------------
vcl/source/gdi/dibtools.cxx | 11 +++++++----
3 files changed, 24 insertions(+), 18 deletions(-)
New commits:
commit 472884c5fd8f6008ca98f88d8a7b14eec5518117
Author: Herbert Dürr <hdu at apache.org>
Date: Thu Apr 10 09:33:57 2014 +0000
#i124617# make CoreText tolerate PDF-export's unexpected font switches
For some documents it was observed that the PDF-export switches the font after
text layout and before text drawing/measuring. This use case is quite atrocious
and unexpected and crashed our CoreText glue code. The other platforms survive
it though; to minimize the risk to them only the CoreText glue gets adapted to
survive this scenario.
diff --git a/vcl/aqua/source/gdi/ctlayout.cxx b/vcl/aqua/source/gdi/ctlayout.cxx
index 4aa5112..6005b15 100644
--- a/vcl/aqua/source/gdi/ctlayout.cxx
+++ b/vcl/aqua/source/gdi/ctlayout.cxx
@@ -52,9 +52,8 @@ public:
virtual void Simplify( bool bIsBase );
private:
- const CTTextStyle* const mpTextStyle;
-
// CoreText specific objects
+ CFMutableDictionaryRef mpStyleDict;
CFAttributedStringRef mpAttrString;
CTLineRef mpCTLine;
@@ -67,6 +66,9 @@ private:
// in these cases the font scale becomes something bigger than 1.0
float mfFontScale; // TODO: does CoreText have a font size limit?
+ CGFloat mfFontRotation; // text direction angle (in radians)
+ CGFloat mfFontStretch; <1.0: font is squeezed, >1.0 font is stretched
+
// cached details about the resulting layout
// mutable members since these details are all lazy initialized
mutable double mfCachedWidth; // cached value of resulting typographical width
@@ -79,17 +81,19 @@ private:
// =======================================================================
CTLayout::CTLayout( const CTTextStyle* pTextStyle )
-: mpTextStyle( pTextStyle )
+: mpStyleDict( pTextStyle->GetStyleDict() )
, mpAttrString( NULL )
, mpCTLine( NULL )
, mnCharCount( 0 )
, mnTrailingSpaceCount( 0 )
, mfTrailingSpaceWidth( 0.0 )
, mfFontScale( pTextStyle->mfFontScale )
+, mfFontRotation( pTextStyle->mfFontRotation )
+, mfFontStretch( pTextStyle->mfFontStretch )
, mfCachedWidth( -1 )
, mnBaseAdv( 0 )
{
- CFRetain( mpTextStyle->GetStyleDict() );
+ CFRetain( mpStyleDict );
}
// -----------------------------------------------------------------------
@@ -100,7 +104,7 @@ CTLayout::~CTLayout()
CFRelease( mpCTLine );
if( mpAttrString )
CFRelease( mpAttrString );
- CFRelease( mpTextStyle->GetStyleDict() );
+ CFRelease( mpStyleDict );
}
// -----------------------------------------------------------------------
@@ -131,7 +135,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
}
// create the CoreText line layout using the requested text style
- mpAttrString = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() );
+ mpAttrString = CFAttributedStringCreate( NULL, aCFText, mpStyleDict );
mpCTLine = CTLineCreateWithAttributedString( mpAttrString );
CFRelease( aCFText);
@@ -201,7 +205,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
CFRelease( mpCTLine );
CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, rArgs.mpStr + mnMinCharPos,
mnCharCount - mnTrailingSpaceCount, kCFAllocatorNull );
- CFAttributedStringRef pAttrStr = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() );
+ CFAttributedStringRef pAttrStr = CFAttributedStringCreate( NULL, aCFText, mpStyleDict );
mpCTLine = CTLineCreateWithAttributedString( pAttrStr );
CFRelease( aCFText);
CFRelease( pAttrStr );
@@ -249,12 +253,11 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const
const Point aVclPos = GetDrawPosition( Point(mnBaseAdv,0) );
CGPoint aTextPos = { +aVclPos.X()/mfFontScale, -aVclPos.Y()/mfFontScale };
- if( mpTextStyle->mfFontRotation != 0.0 )
+ if( mfFontRotation != 0.0 )
{
- const CGFloat fRadians = mpTextStyle->mfFontRotation;
- CGContextRotateCTM( rAquaGraphics.mrContext, +fRadians );
+ CGContextRotateCTM( rAquaGraphics.mrContext, +mfFontRotation );
- const CGAffineTransform aInvMatrix = CGAffineTransformMakeRotation( -fRadians );
+ const CGAffineTransform aInvMatrix = CGAffineTransformMakeRotation( -mfFontRotation );
aTextPos = CGPointApplyAffineTransform( aTextPos, aInvMatrix );
}
@@ -353,12 +356,12 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
// convert glyph details for VCL
*(pOutGlyphIds++) = pCGGlyphIdx[ nSubIndex ];
if( pGlyphAdvances )
- *(pGlyphAdvances++) = pCGGlyphAdvs[ nSubIndex ].width;
+ *(pGlyphAdvances++) = mfFontStretch * pCGGlyphAdvs[ nSubIndex ].width;
if( pCharIndexes )
*(pCharIndexes++) = pCGGlyphStrIdx[ nSubIndex] + mnMinCharPos;
if( !nCount++ ) {
const CGPoint& rCurPos = pCGGlyphPos[ nSubIndex ];
- rPos = GetDrawPosition( Point( mfFontScale * rCurPos.x, mfFontScale * rCurPos.y) );
+ rPos = GetDrawPosition( Point( mfFontScale * mfFontStretch * rCurPos.x, mfFontScale * rCurPos.y) );
}
}
nSubIndex = 0; // prepare for the next glyph run
commit 4d57671f3bdd9628cd21d0991e50a96b10abf63a
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Apr 10 08:47:58 2014 +0000
124639: correct consideration of not provided header offset when checking certain read header data
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index d4ea127..503ccf9 100755
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -615,12 +615,15 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon
{
DIBV5Header aHeader;
const sal_uLong nStmPos = rIStm.Tell();
- bool bRet(false);
- bool bTopDown(false);
+ bool bRet( false );
+ bool bTopDown( false );
- if(ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount)
+ if ( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown )
+ && aHeader.nWidth != 0
+ && aHeader.nHeight != 0
+ && aHeader.nBitCount != 0 )
{
- if (aHeader.nSize > nOffset)
+ if ( nOffset > 0 && aHeader.nSize > nOffset )
{
// Header size claims to extend into the image data.
// Looks like an error.
commit b85ed2610713a082bf2f17171177695557e86575
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Apr 10 08:05:53 2014 +0000
really completing 'adapt build meta data for better differentiation to 4.1'
diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk
index 397a1e1..cdc095a 100644
--- a/solenv/inc/minor.mk
+++ b/solenv/inc/minor.mk
@@ -22,4 +22,4 @@ RSCVERSION=420
RSCREVISION=420m1(Build:9800)
BUILD=9800
LAST_MINOR=m1
-SOURCEVERSION=AOO410
+SOURCEVERSION=AOO420
More information about the Libreoffice-commits
mailing list