summaryrefslogtreecommitdiff
path: root/vcl/aqua/source/gdi
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/aqua/source/gdi')
-rwxr-xr-xvcl/aqua/source/gdi/aquaprintview.mm5
-rwxr-xr-xvcl/aqua/source/gdi/salatslayout.cxx9
-rw-r--r--vcl/aqua/source/gdi/salatsuifontutils.cxx15
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx127
-rwxr-xr-xvcl/aqua/source/gdi/salgdiutils.cxx9
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx8
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx23
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx4
8 files changed, 132 insertions, 68 deletions
diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm
index 6099fbaed741..ba139da5f5a4 100755
--- a/vcl/aqua/source/gdi/aquaprintview.mm
+++ b/vcl/aqua/source/gdi/aquaprintview.mm
@@ -58,6 +58,9 @@
{
NSSize aPaperSize = [mpInfoPrinter->getPrintInfo() paperSize];
int nWidth = (int)aPaperSize.width;
+ // #i101108# sanity check
+ if( nWidth < 1 )
+ nWidth = 1;
NSRect aRect = { { page % nWidth, page / nWidth }, aPaperSize };
return aRect;
}
@@ -71,7 +74,7 @@
-(void)drawRect: (NSRect)rect
{
NSPoint aPoint = [self locationOfPrintRect: rect];
- mpInfoPrinter->setStartPageOffset( rect.origin.x, rect.origin.y );
+ mpInfoPrinter->setStartPageOffset( static_cast<int>(rect.origin.x), static_cast<int>(rect.origin.y) );
NSSize aPaperSize = [mpInfoPrinter->getPrintInfo() paperSize];
int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x);
diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx
index 98700feba39d..7ecef01cf0d5 100755
--- a/vcl/aqua/source/gdi/salatslayout.cxx
+++ b/vcl/aqua/source/gdi/salatslayout.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: salatslayout.cxx,v $
- * $Revision: 1.12 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -431,8 +428,8 @@ void ATSLayout::DrawText( SalGraphics& rGraphics ) const
if( rAquaGraphics.mnATSUIRotation != 0 )
{
const double fRadians = rAquaGraphics.mnATSUIRotation * (M_PI/0xB40000);
- nXOfsFixed = +rSubPortion.mnXOffset * cos( fRadians );
- nYOfsFixed = +rSubPortion.mnXOffset * sin( fRadians );
+ nXOfsFixed = static_cast<Fixed>(static_cast<double>(+rSubPortion.mnXOffset) * cos( fRadians ));
+ nYOfsFixed = static_cast<Fixed>(static_cast<double>(+rSubPortion.mnXOffset) * sin( fRadians ));
}
// draw sub-portions
@@ -745,6 +742,8 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons
// get a quick overview on what could fit
const long nPixelWidth = (nMaxWidth - (nCharExtra * mnCharCount)) / nFactor;
+ if( nPixelWidth <= 0 )
+ return mnMinCharPos;
// check assumptions
DBG_ASSERT( !mnTrailingSpaceWidth, "ATSLayout::GetTextBreak() with nTSW!=0" );
diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx
index 595b7d276a2a..8e38981a3c7c 100644
--- a/vcl/aqua/source/gdi/salatsuifontutils.cxx
+++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: salatsuifontutils.cxx,v $
- * $Revision: 1.13.138.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -210,12 +207,8 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
rDFA.meItalic = ITALIC_NONE;
rDFA.mbSymbolFlag = false;
- // get the embeddable + subsettable status
- // TODO: remove test after PS-OpenType subsetting is implemented
- ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID );
- ByteCount nGlyfLen = 0;
- OSStatus rc = ATSFontGetTable( rATSFontRef, 0x676c7966/*glyf*/, 0, 0, NULL, &nGlyfLen);
- rDFA.mbSubsettable = ((rc == noErr) && (nGlyfLen > 0));
+ // all scalable fonts on this platform are subsettable
+ rDFA.mbSubsettable = true;
rDFA.mbEmbeddable = false;
// TODO: these members are needed only for our X11 platform targets
rDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
@@ -223,7 +216,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
// prepare iterating over all name strings of the font
ItemCount nFontNameCount = 0;
- rc = ATSUCountFontNames( nFontID, &nFontNameCount );
+ OSStatus rc = ATSUCountFontNames( nFontID, &nFontNameCount );
if( rc != noErr )
return false;
int nBestNameValue = 0;
@@ -269,7 +262,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
case 0x30A: nNameValue += 0; // Win-UCS-4
eEncoding = RTL_TEXTENCODING_UCS4;
break;
- case 0x100: nNameValue += 21; // Mac Roman
+ case 0x100: nNameValue += 21; // Mac Roman
eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
break;
case 0x300: nNameValue = 0; // Win Symbol encoded name!
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 3ee54afe2fba..e0905fe1d377 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: salgdi.cxx,v $
- * $Revision: 1.81.14.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -40,6 +37,7 @@
#include "salatsuifontutils.hxx"
#include "vcl/impfont.hxx"
+#include "vcl/fontsubset.hxx"
#include "vcl/sysdata.hxx"
#include "vcl/sallayout.hxx"
#include "vcl/svapp.hxx"
@@ -153,7 +151,7 @@ ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
if( !ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
return mpCharMap;
- mpCharMap = new ImplFontCharMap( aCmapResult.mnPairCount, aCmapResult.mpPairCodes, aCmapResult.mpStartGlyphs );
+ mpCharMap = new ImplFontCharMap( aCmapResult );
return mpCharMap;
}
@@ -175,8 +173,7 @@ void ImplMacFontData::ReadOs2Table( void ) const
return;
// allocate a buffer for the OS/2 raw data
- ByteVector aBuffer;
- aBuffer.resize( nBufSize );
+ ByteVector aBuffer( nBufSize );
// get the OS/2 raw data
ByteCount nRawLength = 0;
@@ -215,8 +212,7 @@ void ImplMacFontData::ReadMacCmapEncoding( void ) const
if( eStatus != noErr )
return;
- ByteVector aBuffer;
- aBuffer.resize( nBufSize );
+ ByteVector aBuffer( nBufSize );
ByteCount nRawLength = 0;
eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
@@ -974,6 +970,11 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine,
if( rLineWidths.getX() != rLineWidths.getY() )
return false;
+ // #i101491# Aqua does not support B2DLINEJOIN_NONE; return false to use
+ // the fallback (own geometry preparation)
+ if(basegfx::B2DLINEJOIN_NONE == eLineJoin)
+ return false;
+
// setup line attributes
CGLineJoin aCGLineJoin = kCGLineJoinMiter;
switch( eLineJoin ) {
@@ -1985,15 +1986,30 @@ static void FakeDirEntry( FourCharCode eFCC, ByteCount nOfs, ByteCount nLen,
}
static bool GetRawFontData( const ImplFontData* pFontData,
- ByteVector& rBuffer )
+ ByteVector& rBuffer, bool* pJustCFF )
{
const ImplMacFontData* pMacFont = static_cast<const ImplMacFontData*>(pFontData);
const ATSUFontID nFontId = static_cast<ATSUFontID>(pMacFont->GetFontId());
ATSFontRef rFont = FMGetATSFontRefFromFont( nFontId );
+ ByteCount nCffLen = 0;
+ OSStatus eStatus = ATSFontGetTable( rFont, GetTag("CFF "), 0, 0, NULL, &nCffLen);
+ if( pJustCFF != NULL )
+ {
+ *pJustCFF = (eStatus == noErr) && (nCffLen > 0);
+ if( *pJustCFF )
+ {
+ rBuffer.resize( nCffLen );
+ eStatus = ATSFontGetTable( rFont, GetTag("CFF "), 0, nCffLen, (void*)&rBuffer[0], &nCffLen);
+ if( (eStatus != noErr) || (nCffLen <= 0) )
+ return false;
+ return true;
+ }
+ }
+
// get font table availability and size in bytes
ByteCount nHeadLen = 0;
- OSStatus eStatus = ATSFontGetTable( rFont, GetTag("head"), 0, 0, NULL, &nHeadLen);
+ eStatus = ATSFontGetTable( rFont, GetTag("head"), 0, 0, NULL, &nHeadLen);
if( (eStatus != noErr) || (nHeadLen <= 0) )
return false;
ByteCount nMaxpLen = 0;
@@ -2004,14 +2020,6 @@ static bool GetRawFontData( const ImplFontData* pFontData,
eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, 0, NULL, &nCmapLen);
if( (eStatus != noErr) || (nCmapLen <= 0) )
return false;
- ByteCount nLocaLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("loca"), 0, 0, NULL, &nLocaLen);
- if( (eStatus != noErr) || (nLocaLen <= 0) )
- return false;
- ByteCount nGlyfLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("glyf"), 0, 0, NULL, &nGlyfLen);
- if( (eStatus != noErr) || (nGlyfLen <= 0) )
- return false;
ByteCount nNameLen = 0;
eStatus = ATSFontGetTable( rFont, GetTag("name"), 0, 0, NULL, &nNameLen);
if( (eStatus != noErr) || (nNameLen <= 0) )
@@ -2025,8 +2033,21 @@ static bool GetRawFontData( const ImplFontData* pFontData,
if( (eStatus != noErr) || (nHmtxLen <= 0) )
return false;
+ // get the glyph outline tables
+ ByteCount nLocaLen = 0;
+ ByteCount nGlyfLen = 0;
+ if( (eStatus != noErr) || (nCffLen <= 0) )
+ {
+ eStatus = ATSFontGetTable( rFont, GetTag("loca"), 0, 0, NULL, &nLocaLen);
+ if( (eStatus != noErr) || (nLocaLen <= 0) )
+ return false;
+ eStatus = ATSFontGetTable( rFont, GetTag("glyf"), 0, 0, NULL, &nGlyfLen);
+ if( (eStatus != noErr) || (nGlyfLen <= 0) )
+ return false;
+ }
+
ByteCount nPrepLen=0, nCvtLen=0, nFpgmLen=0;
- if( 1 ) // TODO: reduce PDF size by making hint subsetting optional
+ if( nGlyfLen ) // TODO: reduce PDF size by making hint subsetting optional
{
eStatus = ATSFontGetTable( rFont, GetTag("prep"), 0, 0, NULL, &nPrepLen);
eStatus = ATSFontGetTable( rFont, GetTag("cvt "), 0, 0, NULL, &nCvtLen);
@@ -2034,11 +2055,15 @@ static bool GetRawFontData( const ImplFontData* pFontData,
}
// prepare a byte buffer for a fake font
- int nTableCount = 8;
- nTableCount += (nPrepLen>0) + (nCvtLen>0) + (nFpgmLen>0);
+ int nTableCount = 7;
+ nTableCount += (nPrepLen>0) + (nCvtLen>0) + (nFpgmLen>0) + (nGlyfLen>0);
const ByteCount nFdirLen = 12 + 16*nTableCount;
ByteCount nTotalLen = nFdirLen;
- nTotalLen += nHeadLen + nMaxpLen + nNameLen + nCmapLen + nLocaLen + nGlyfLen;
+ nTotalLen += nHeadLen + nMaxpLen + nNameLen + nCmapLen;
+ if( nGlyfLen )
+ nTotalLen += nLocaLen + nGlyfLen;
+ else
+ nTotalLen += nCffLen;
nTotalLen += nHheaLen + nHmtxLen;
nTotalLen += nPrepLen + nCvtLen + nFpgmLen;
rBuffer.resize( nTotalLen );
@@ -2071,9 +2096,18 @@ static bool GetRawFontData( const ImplFontData* pFontData,
FakeDirEntry( GetTag("fpgm"), nOfs, nFpgmLen, &rBuffer[0], pFakeEntry );
nOfs += nFpgmLen;
}
- eStatus = ATSFontGetTable( rFont, GetTag("glyf"), 0, nGlyfLen, (void*)&rBuffer[nOfs], &nGlyfLen);
- FakeDirEntry( GetTag("glyf"), nOfs, nGlyfLen, &rBuffer[0], pFakeEntry );
- nOfs += nGlyfLen;
+ if( nCffLen ) {
+ eStatus = ATSFontGetTable( rFont, GetTag("CFF "), 0, nCffLen, (void*)&rBuffer[nOfs], &nCffLen);
+ FakeDirEntry( GetTag("CFF "), nOfs, nCffLen, &rBuffer[0], pFakeEntry );
+ nOfs += nGlyfLen;
+ } else {
+ eStatus = ATSFontGetTable( rFont, GetTag("glyf"), 0, nGlyfLen, (void*)&rBuffer[nOfs], &nGlyfLen);
+ FakeDirEntry( GetTag("glyf"), nOfs, nGlyfLen, &rBuffer[0], pFakeEntry );
+ nOfs += nGlyfLen;
+ eStatus = ATSFontGetTable( rFont, GetTag("loca"), 0, nLocaLen, (void*)&rBuffer[nOfs], &nLocaLen);
+ FakeDirEntry( GetTag("loca"), nOfs, nLocaLen, &rBuffer[0], pFakeEntry );
+ nOfs += nLocaLen;
+ }
eStatus = ATSFontGetTable( rFont, GetTag("head"), 0, nHeadLen, (void*)&rBuffer[nOfs], &nHeadLen);
FakeDirEntry( GetTag("head"), nOfs, nHeadLen, &rBuffer[0], pFakeEntry );
nOfs += nHeadLen;
@@ -2083,9 +2117,6 @@ static bool GetRawFontData( const ImplFontData* pFontData,
eStatus = ATSFontGetTable( rFont, GetTag("hmtx"), 0, nHmtxLen, (void*)&rBuffer[nOfs], &nHmtxLen);
FakeDirEntry( GetTag("hmtx"), nOfs, nHmtxLen, &rBuffer[0], pFakeEntry );
nOfs += nHmtxLen;
- eStatus = ATSFontGetTable( rFont, GetTag("loca"), 0, nLocaLen, (void*)&rBuffer[nOfs], &nLocaLen);
- FakeDirEntry( GetTag("loca"), nOfs, nLocaLen, &rBuffer[0], pFakeEntry );
- nOfs += nLocaLen;
eStatus = ATSFontGetTable( rFont, GetTag("maxp"), 0, nMaxpLen, (void*)&rBuffer[nOfs], &nMaxpLen);
FakeDirEntry( GetTag("maxp"), nOfs, nMaxpLen, &rBuffer[0], pFakeEntry );
nOfs += nMaxpLen;
@@ -2107,10 +2138,38 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
const ImplFontData* pFontData, long* pGlyphIDs, sal_uInt8* pEncoding,
sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo )
{
+ // TODO: move more of the functionality here into the generic subsetter code
+
+ // prepare the requested file name for writing the font-subset file
+ rtl::OUString aSysPath;
+ if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) )
+ return FALSE;
+ const rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding();
+ const ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) );
+
+ // get the raw-bytes from the font to be subset
ByteVector aBuffer;
- if( !GetRawFontData( pFontData, aBuffer ) )
+ bool bCffOnly = false;
+ if( !GetRawFontData( pFontData, aBuffer, &bCffOnly ) )
return sal_False;
+ // handle CFF-subsetting
+ if( bCffOnly )
+ {
+ // provide the raw-CFF data to the subsetter
+ ByteCount nCffLen = aBuffer.size();
+ rInfo.LoadFont( FontSubsetInfo::CFF_FONT, &aBuffer[0], nCffLen );
+
+ // NOTE: assuming that all glyphids requested on Aqua are fully translated
+
+ // make the subsetter provide the requested subset
+ FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" );
+ bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL,
+ pGlyphIDs, pEncoding, nGlyphCount, pGlyphWidths );
+ fclose( pOutFile );
+ return bRC;
+ }
+
// TODO: modernize psprint's horrible fontsubset C-API
// this probably only makes sense after the switch to another SCM
// that can preserve change history after file renames
@@ -2124,7 +2183,7 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
// get details about the subsetted font
TTGlobalFontInfo aTTInfo;
::GetTTGlobalFontInfo( pSftFont, &aTTInfo );
- rInfo.m_nFontType = SAL_FONTSUBSETINFO_TYPE_TRUETYPE;
+ rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
rInfo.m_aPSName = String( aTTInfo.psname, RTL_TEXTENCODING_UTF8 );
rInfo.m_aFontBBox = Rectangle( Point( aTTInfo.xMin, aTTInfo.yMin ),
Point( aTTInfo.xMax, aTTInfo.yMax ) );
@@ -2202,11 +2261,6 @@ BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
free( pGlyphMetrics );
// write subset into destination file
- rtl::OUString aSysPath;
- if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) )
- return FALSE;
- rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding();
- ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) );
nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.GetBuffer(), aShortIDs,
aTempEncs, nGlyphCount, 0, NULL, 0 );
::CloseTTFont(pSftFont);
@@ -2224,7 +2278,7 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti
if( pFontData->IsSubsettable() )
{
ByteVector aBuffer;
- if( !GetRawFontData( pFontData, aBuffer ) )
+ if( !GetRawFontData( pFontData, aBuffer, NULL ) )
return;
// TODO: modernize psprint's horrible fontsubset C-API
@@ -2309,7 +2363,6 @@ const void* AquaSalGraphics::GetEmbedFontData( const ImplFontData* pFontData,
FontSubsetInfo& rInfo,
long* pDataLen )
{
- // TODO: are the non-subsettable fonts on OSX that are embeddable?
return NULL;
}
diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx
index 066268791b11..99a1629006d2 100755
--- a/vcl/aqua/source/gdi/salgdiutils.cxx
+++ b/vcl/aqua/source/gdi/salgdiutils.cxx
@@ -102,8 +102,8 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
else
{
const CGSize aSize = CGLayerGetSize( mxLayer );
- mnWidth = aSize.width;
- mnHeight = aSize.height;
+ mnWidth = static_cast<int>(aSize.width);
+ mnHeight = static_cast<int>(aSize.height);
}
// prepare graphics for drawing
@@ -219,7 +219,10 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh
{
// update a little more around the designated rectangle
// this helps with antialiased rendering
- const Rectangle aVclRect( Point( lX-1, lY-1 ), Size( lWidth+2, lHeight+2) );
+ const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
+ static_cast<long int>(lY-1) ),
+ Size( static_cast<long int>(lWidth+2),
+ static_cast<long int>(lHeight+2) ) );
mpFrame->maInvalidRect.Union( aVclRect );
}
}
diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx
index 9f2c7c4fa3a7..6cd4e78a2d1a 100644
--- a/vcl/aqua/source/gdi/salnativewidgets.cxx
+++ b/vcl/aqua/source/gdi/salnativewidgets.cxx
@@ -612,7 +612,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
aPushInfo.animation.time.start = 0;
aPushInfo.animation.time.current = 0;
PushButtonValue* pPBVal = (PushButtonValue*)aValue.getOptionalVal();
- int nPaintHeight = rc.size.height;
+ int nPaintHeight = static_cast<int>(rc.size.height);
if( pPBVal && pPBVal->mbBevelButton )
{
@@ -1162,8 +1162,10 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
if( mxClipPath )
aRect = CGPathGetBoundingBox( mxClipPath );
if( aRect.size.width != 0 && aRect.size.height != 0 )
- buttonRect.Intersection( Rectangle( Point( aRect.origin.x, aRect.origin.y ),
- Size( aRect.size.width, aRect.size.height ) ) );
+ buttonRect.Intersection( Rectangle( Point( static_cast<long int>(aRect.origin.x),
+ static_cast<long int>(aRect.origin.y) ),
+ Size( static_cast<long int>(aRect.size.width),
+ static_cast<long int>(aRect.size.height) ) ) );
}
RefreshRect( buttonRect.Left(), buttonRect.Top(), buttonRect.GetWidth(), buttonRect.GetHeight() );
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index a0062834e269..b9a1f4ef7748 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -127,20 +127,27 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
NSRect aImageRect = [mpPrintInfo imageablePageBounds];
if( mePageOrientation == ORIENTATION_PORTRAIT )
{
+ // move mirrored CTM back into paper
double dX = 0, dY = aPaperSize.height;
+ // move CTM to reflect imageable area
dX += aImageRect.origin.x;
dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY );
+ // scale to be top/down and reflect our "virtual" DPI
CGContextScaleCTM( i_rContext, 0.1, -0.1 );
}
else
{
+ // move CTM to reflect imageable area
+ double dX = aImageRect.origin.x, dY = aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
+ CGContextTranslateCTM( i_rContext, -dX, -dY );
+ // turn by 90 degree
CGContextRotateCTM( i_rContext, M_PI/2 );
- double dX = aPaperSize.height, dY = -aPaperSize.width;
- dY += aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
- dX -= aImageRect.origin.x;
-
+ // move turned CTM back into paper
+ dX = aPaperSize.height;
+ dY = -aPaperSize.width;
CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX );
+ // scale to be top/down and reflect our "virtual" DPI
CGContextScaleCTM( i_rContext, -0.1, 0.1 );
}
mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY, 1.0 );
@@ -303,8 +310,12 @@ BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData )
double width = 0, height = 0;
if( io_pSetupData->mePaperFormat == PAPER_USER )
{
- width = TenMuToPt( io_pSetupData->mnPaperWidth );
- height = TenMuToPt( io_pSetupData->mnPaperHeight );
+ // #i101108# sanity check
+ if( io_pSetupData->mnPaperWidth && io_pSetupData->mnPaperHeight )
+ {
+ width = TenMuToPt( io_pSetupData->mnPaperWidth );
+ height = TenMuToPt( io_pSetupData->mnPaperHeight );
+ }
}
else
getPaperSize( width, height, io_pSetupData->mePaperFormat );
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx
index d7690e4e38bd..4d25d5d8b63b 100644
--- a/vcl/aqua/source/gdi/salvd.cxx
+++ b/vcl/aqua/source/gdi/salvd.cxx
@@ -228,8 +228,8 @@ void AquaSalVirtualDevice::GetSize( long& rWidth, long& rHeight )
if( mxLayer )
{
const CGSize aSize = CGLayerGetSize( mxLayer );
- rWidth = aSize.width;
- rHeight = aSize.height;
+ rWidth = static_cast<long>(aSize.width);
+ rHeight = static_cast<long>(aSize.height);
}
else
{