summaryrefslogtreecommitdiff
path: root/vcl/aqua/source/gdi/salgdi.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/aqua/source/gdi/salgdi.cxx')
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx115
1 files changed, 71 insertions, 44 deletions
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 3c228ffcfa40..9e658b24021e 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,7 @@
#include "osl/file.hxx"
#include "osl/process.h"
-#include "vos/mutex.hxx"
+#include "osl/mutex.hxx"
#include "rtl/bootstrap.h"
#include "rtl/strbuf.hxx"
@@ -75,6 +76,7 @@ ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, ATSUFontID
, mbHasOs2Table( false )
, mbCmapEncodingRead( false )
, mbHasCJKSupport( false )
+, mbFontCapabilitiesRead( false )
{}
// -----------------------------------------------------------------------
@@ -150,15 +152,61 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
// parse the CMAP
CmapResult aCmapResult;
- if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
+ if( !ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
+ return mpCharMap;
+
+ mpCharMap = new ImplFontCharMap( aCmapResult );
+ mpCharMap->AddReference();
+ return mpCharMap;
+}
+
+bool ImplMacFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+{
+ // read this only once per font
+ if( mbFontCapabilitiesRead )
{
- // create the matching charmap
- mpCharMap->DeReference();
- mpCharMap = new ImplFontCharMap( aCmapResult );
- mpCharMap->AddReference();
+ rFontCapabilities = maFontCapabilities;
+ return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty();
}
+ mbFontCapabilitiesRead = true;
- return mpCharMap;
+ // prepare to get the GSUB table raw data
+ ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
+ ByteCount nBufSize = 0;
+ OSStatus eStatus;
+ eStatus = ATSFontGetTable( rFont, GetTag("GSUB"), 0, 0, NULL, &nBufSize );
+ if( eStatus == noErr )
+ {
+ // allocate a buffer for the GSUB raw data
+ ByteVector aBuffer( nBufSize );
+ // get the GSUB raw data
+ ByteCount nRawLength = 0;
+ eStatus = ATSFontGetTable( rFont, GetTag("GSUB"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
+ if( eStatus == noErr )
+ {
+ const unsigned char* pGSUBTable = &aBuffer[0];
+ vcl::getTTScripts(maFontCapabilities.maGSUBScriptTags, pGSUBTable, nRawLength);
+ }
+ }
+ eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, 0, NULL, &nBufSize );
+ if( eStatus == noErr )
+ {
+ // allocate a buffer for the GSUB raw data
+ ByteVector aBuffer( nBufSize );
+ // get the OS/2 raw data
+ ByteCount nRawLength = 0;
+ eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
+ if( eStatus == noErr )
+ {
+ const unsigned char* pOS2Table = &aBuffer[0];
+ vcl::getTTCoverage(
+ maFontCapabilities.maUnicodeRange,
+ maFontCapabilities.maCodePageRange,
+ pOS2Table, nRawLength);
+ }
+ }
+ rFontCapabilities = maFontCapabilities;
+ return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty();
}
// -----------------------------------------------------------------------
@@ -397,17 +445,17 @@ void AquaSalGraphics::initResolution( NSWindow* )
}
else
{
- DBG_ERROR( "no resolution found in device description" );
+ OSL_FAIL( "no resolution found in device description" );
}
}
else
{
- DBG_ERROR( "no device description" );
+ OSL_FAIL( "no device description" );
}
}
else
{
- DBG_ERROR( "no screen found" );
+ OSL_FAIL( "no screen found" );
}
// #i107076# maintaining size-WYSIWYG-ness causes many problems for
@@ -456,7 +504,7 @@ void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics )
// -----------------------------------------------------------------------
-sal_uInt16 AquaSalGraphics::GetBitCount()
+sal_uInt16 AquaSalGraphics::GetBitCount() const
{
sal_uInt16 nBits = mnBitmapDepth ? mnBitmapDepth : 32;//24;
return nBits;
@@ -1152,23 +1200,6 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, l
{
ApplyXorContext();
-#if 0 // TODO: make AquaSalBitmap as fast as the alternative implementation below
- SalBitmap* pBitmap = getBitmap( nSrcX, nSrcY, nSrcWidth, nSrcHeight );
- if( pBitmap )
- {
- SalTwoRect aPosAry;
- aPosAry.mnSrcX = 0;
- aPosAry.mnSrcY = 0;
- aPosAry.mnSrcWidth = nSrcWidth;
- aPosAry.mnSrcHeight = nSrcHeight;
- aPosAry.mnDestX = nDstX;
- aPosAry.mnDestY = nDstY;
- aPosAry.mnDestWidth = nSrcWidth;
- aPosAry.mnDestHeight = nSrcHeight;
- drawBitmap( &aPosAry, *pBitmap );
- delete pBitmap;
- }
-#else
DBG_ASSERT( mxLayer!=NULL, "AquaSalGraphics::copyArea() for non-layered graphics" );
// in XOR mode the drawing context is redirected to the XOR mask
@@ -1207,7 +1238,7 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, l
// mark the destination rectangle as updated
RefreshRect( nDstX, nDstY, nSrcWidth, nSrcHeight );
-#endif
+
}
// -----------------------------------------------------------------------
@@ -1232,7 +1263,7 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rS
void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,SalColor )
{
- DBG_ERROR("not implemented for color masking!");
+ OSL_FAIL("not implemented for color masking!");
drawBitmap( pPosAry, rSalBitmap );
}
@@ -1997,6 +2028,14 @@ const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
return mpMacFontData->GetImplFontCharMap();
}
+bool AquaSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+{
+ if( !mpMacFontData )
+ return false;
+
+ return mpMacFontData->GetImplFontCapabilities(rFontCapabilities);
+}
+
// -----------------------------------------------------------------------
// fake a SFNT font directory entry for a font table
@@ -2375,20 +2414,7 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti
else if( pFontData->IsEmbeddable() )
{
// get individual character widths
-#if 0 // FIXME
- rWidths.reserve( 224 );
- for( sal_Unicode i = 32; i < 256; ++i )
- {
- int nCharWidth = 0;
- if( ::GetCharWidth32W( mhDC, i, i, &nCharWidth ) )
- {
- rUnicodeEnc[ i ] = rWidths.size();
- rWidths.push_back( nCharWidth );
- }
- }
-#else
- DBG_ERROR("not implemented for non-subsettable fonts!\n");
-#endif
+ OSL_FAIL("not implemented for non-subsettable fonts!\n");
}
}
@@ -2682,3 +2708,4 @@ bool XorEmulation::UpdateTarget()
// =======================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */