summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-07-02 09:16:16 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-07-02 09:16:16 +0000
commit60ec6e4aeb828903bc13003e056bcbe32ac0e561 (patch)
treeb18cbff6dd7014e4643b97fda8354dca0ba49273 /vcl/win
parent5745d49a634a9f11c7c6cf4c739e24591ddb8dce (diff)
INTEGRATION: CWS vcl90 (1.95.54); FILE MERGED
2008/06/19 06:56:50 hdu 1.95.54.2: #i56745# fix calculation of stripe size for GetFontData() 2008/06/06 10:58:58 hdu 1.95.54.1: #i56745# limit GetFontData() requests
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx29
1 files changed, 21 insertions, 8 deletions
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 60cf68c99523..b7b09834b797 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salgdi3.cxx,v $
- * $Revision: 1.95 $
+ * $Revision: 1.96 $
*
* This file is part of OpenOffice.org.
*
@@ -2524,13 +2524,26 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
#endif
// get raw font file data
- DWORD nFontSize1 = ::GetFontData( mhDC, 0, 0, NULL, 0 );
- if( nFontSize1 == GDI_ERROR )
- return FALSE;
- ScopedCharArray xRawFontData(new char[ nFontSize1 ]);
- DWORD nFontSize2 = ::GetFontData( mhDC, 0, 0, (void*)xRawFontData.get(), nFontSize1 );
- if( nFontSize1 != nFontSize2 )
+ DWORD nFontSize = ::GetFontData( mhDC, 0, 0, NULL, 0 );
+ if( nFontSize == GDI_ERROR )
return FALSE;
+ ScopedCharArray xRawFontData(new char[ nFontSize ]);
+ for( DWORD nRawDataOfs = 0;;)
+ {
+ // calculate remaining raw data to get
+ DWORD nFDGet = nFontSize - nRawDataOfs;
+ if( nFDGet <= 0 )
+ break;
+ // #i56745# limit GetFontData requests
+ static const DWORD FDLIMIT = 0x100000;
+ if( nFDGet > FDLIMIT )
+ nFDGet = FDLIMIT;
+ const DWORD nFDGot = ::GetFontData( mhDC, 0, nRawDataOfs,
+ (void*)(xRawFontData.get() + nRawDataOfs), nFDGet );
+ if( (nFDGot == GDI_ERROR) || !nFDGot )
+ return FALSE;
+ nRawDataOfs += nFDGot;
+ }
// open font file
sal_uInt32 nFaceNum = 0;
@@ -2538,7 +2551,7 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
nFaceNum = ~0U; // indicate "TTC font extracts only"
ScopedTrueTypeFont aSftTTF;
- int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum );
+ int nRC = aSftTTF.open( xRawFontData.get(), nFontSize, nFaceNum );
if( nRC != SF_OK )
return FALSE;