diff options
Diffstat (limited to 'vcl/win/source/gdi/winlayout.cxx')
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 90 |
1 files changed, 25 insertions, 65 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 82fa9bb4b5e1..6a4bbe885bd3 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -244,24 +244,11 @@ HFONT WinLayout::DisableFontScaling() const if( mfFontScale == 1.0 ) return 0; - HFONT hHugeFont = 0; - if( aSalShlData.mbWNT ) - { - LOGFONTW aLogFont; - ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); - aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); - aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectW( &aLogFont); - } - else - { - LOGFONTA aLogFont; - ::GetObjectA( mhFont, sizeof(LOGFONTA), &aLogFont); - aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); - aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectA( &aLogFont); - } - + LOGFONTW aLogFont; + ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); + aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); + aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); + HFONT hHugeFont = ::CreateFontIndirectW( &aLogFont); if( !hHugeFont ) return 0; @@ -671,57 +658,30 @@ 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 || aSalShlData.mbWNT ) - { - // #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; + // #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 ); + 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 ); + for( int i = 0, 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 ) ); |