diff options
Diffstat (limited to 'vcl/win/source/gdi/winlayout.cxx')
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 103 |
1 files changed, 45 insertions, 58 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 1114de6f098b..bb680146020a 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -249,13 +249,11 @@ HFONT WinLayout::DisableFontScaling() const if( mfFontScale == 1.0 ) return 0; - HFONT hHugeFont = 0; LOGFONTW aLogFont; ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectW( &aLogFont); - + HFONT hHugeFont = ::CreateFontIndirectW( &aLogFont); if( !hHugeFont ) return 0; @@ -665,57 +663,31 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) ); - // #108267#, limit the number of glyphs to avoid paint errors - UINT limitedGlyphCount = Min( 8192, mnGlyphCount ); - if( mnDrawOptions ) - { - // #108267#, break up into glyph portions of a limited size required by Win32 API - const unsigned int maxGlyphCount = 8192; - UINT numGlyphPortions = mnGlyphCount / maxGlyphCount; - UINT remainingGlyphs = mnGlyphCount % maxGlyphCount; - - if( numGlyphPortions ) - { - // #108267#,#109387# break up string into smaller chunks - // the output positions will be updated by windows (SetTextAlign) - unsigned int i,n; - POINT oldPos; - UINT oldTa = ::GetTextAlign( aHDC ); - ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP ); - ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos ); - for( i=n=0; n<numGlyphPortions; n++, i+=maxGlyphCount ) - ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, - mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i ); + // #108267#, break up into glyph portions of a limited size required by Win32 API + const unsigned int maxGlyphCount = 8192; + UINT numGlyphPortions = mnGlyphCount / maxGlyphCount; + UINT remainingGlyphs = mnGlyphCount % maxGlyphCount; + + if( numGlyphPortions ) + { + // #108267#,#109387# break up string into smaller chunks + // the output positions will be updated by windows (SetTextAlign) + POINT oldPos; + UINT oldTa = ::GetTextAlign( aHDC ); + ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP ); + ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos ); + unsigned int i = 0; + for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount ) ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, - mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i ); - ::MoveToEx( aHDC, oldPos.x, oldPos.y, (LPPOINT) NULL); - ::SetTextAlign( aHDC, oldTa ); - } - else - ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, - mpOutGlyphs, mnGlyphCount, mpGlyphAdvances ); + mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i ); + ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, + mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i ); + ::MoveToEx( aHDC, oldPos.x, oldPos.y, (LPPOINT) NULL); + ::SetTextAlign( aHDC, oldTa ); } else - { - // #108267#, On Win9x, we get paint errors when drawing huge strings, even when - // split into pieces (see above), seems to be a problem in the internal text clipping - // so we just cut off the string - if( !mpGlyphOrigAdvs ) - ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), 0, NULL, - mpOutGlyphs, limitedGlyphCount, NULL ); - else - { - // workaround for problem in #106259# - long nXPos = mnBaseAdv; - for( unsigned int i = 0; i < limitedGlyphCount; ++i ) - { - ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), 0, NULL, - mpOutGlyphs+i, 1, NULL ); - nXPos += mpGlyphAdvances[ i ]; - aPos = GetDrawPosition( Point( nXPos, 0 ) ); - } - } - } + ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, + mpOutGlyphs, mnGlyphCount, mpGlyphAdvances ); if( hOrigFont ) DeleteFont( SelectFont( aHDC, hOrigFont ) ); @@ -1244,7 +1216,7 @@ static bool InitUSP() DWORD nHandle; DWORD nBufSize = ::GetFileVersionInfoSizeW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), &nHandle ); char* pBuffer = (char*)alloca( nBufSize ); - WIN_BOOL bRC = ::GetFileVersionInfoW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), nHandle, nBufSize, pBuffer ); + BOOL bRC = ::GetFileVersionInfoW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), nHandle, nBufSize, pBuffer ); VS_FIXEDFILEINFO* pFixedFileInfo = NULL; UINT nFixedFileSize = 0; if( bRC ) @@ -2065,6 +2037,13 @@ void UniscribeLayout::MoveGlyph( int nStartx8, long nNewXPos ) // move the visual item by having an offset pVI->mnXOffset += nDelta; } + // move subsequent items - this often isn't necessary because subsequent + // moves will correct subsequent items. However, if there is a contiguous + // range not involving fallback which spans items, this will be needed + while (++pVI - mpVisualItems < mnItemCount) + { + pVI->mnXOffset += nDelta; + } } // ----------------------------------------------------------------------- @@ -2345,6 +2324,10 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const if( rVisualItem.IsEmpty() ) continue; + if (mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK) + { + nXPos = rVisualItem.mnXOffset; + } // get glyph positions // TODO: handle when rVisualItem's glyph range is only partially used for( i = rVisualItem.mnMinGlyphPos; i < rVisualItem.mnEndGlyphPos; ++i ) @@ -2378,13 +2361,17 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const } } - // fixup unknown character positions to neighbor - for( i = 0; i < nMaxIdx; ++i ) + if (!(mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK)) { - if( pCaretXArray[ i ] >= 0 ) - nXPos = pCaretXArray[ i ]; - else - pCaretXArray[ i ] = nXPos; + nXPos = 0; + // fixup unknown character positions to neighbor + for( i = 0; i < nMaxIdx; ++i ) + { + if( pCaretXArray[ i ] >= 0 ) + nXPos = pCaretXArray[ i ]; + else + pCaretXArray[ i ] = nXPos; + } } } |