[Libreoffice-commits] core.git: Branch 'feature/fixes7' - 5 commits - vcl/inc vcl/win

Tor Lillqvist tml at collabora.com
Mon Aug 17 06:20:37 PDT 2015


 vcl/inc/win/salgdi.h             |    2 
 vcl/win/source/gdi/salgdi3.cxx   |   11 
 vcl/win/source/gdi/winlayout.cxx |  817 ++-------------------------------------
 vcl/win/source/gdi/winlayout.hxx |   80 ---
 4 files changed, 60 insertions(+), 850 deletions(-)

New commits:
commit 3e114bb967b61cb96ee37cfbd948f884d77a4307
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Aug 12 10:47:20 2015 +0300

    WaE: 'rArgs' : unreferenced formal parameter
    
    Change-Id: Ia41882a4d33e7b148044801902517b2b034d3ee4

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index ff7f853..89503f3 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1995,7 +1995,7 @@ void GraphiteWinLayout::Simplify( bool is_base )
 }
 #endif // ENABLE_GRAPHITE
 
-SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel )
+SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& /*rArgs*/, int nFallbackLevel )
 {
     if (!mpWinFontEntry[nFallbackLevel]) return nullptr;
 
commit d64b647f2c96dbc0336925a9a8eadfb213978cb2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Aug 12 08:18:50 2015 +0300

    Drop SimpleWinLayout
    
    Use Uniscribe also for non-complex text. It is complicated enough to
    have separate Graphite and Uniscribe layout engines. Will make further
    changes to the code easier to manage, especially as with the
    UniscribeLayout code we have access to the actual
    glyphs. (Cf. 3e47219e06b9a279ba22a9bbef668731f2d3e07d)
    
    Change-Id: I9c67c172fe3e3d26d1c6cb1c0b7f1516b0b87f12

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 9edf88c..ff7f853 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -228,694 +228,6 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
     }
 }
 
-SimpleWinLayout::SimpleWinLayout(HDC hDC, BYTE nCharSet, const ImplWinFontData& rWinFontData,
-        ImplWinFontEntry& rWinFontEntry, bool bUseOpenGL)
-:   WinLayout(hDC, rWinFontData, rWinFontEntry, bUseOpenGL),
-    mnGlyphCount( 0 ),
-    mnCharCount( 0 ),
-    mpOutGlyphs( NULL ),
-    mpGlyphAdvances( NULL ),
-    mpGlyphOrigAdvs( NULL ),
-    mpCharWidths( NULL ),
-    mpChars2Glyphs( NULL ),
-    mpGlyphs2Chars( NULL ),
-    mpGlyphRTLFlags( NULL ),
-    mnWidth( 0 ),
-    mnNotdefWidth( -1 ),
-    mnCharSet( nCharSet )
-{
-}
-
-SimpleWinLayout::~SimpleWinLayout()
-{
-    delete[] mpGlyphRTLFlags;
-    delete[] mpGlyphs2Chars;
-    delete[] mpChars2Glyphs;
-    if( mpCharWidths != mpGlyphAdvances )
-        delete[] mpCharWidths;
-    delete[] mpGlyphOrigAdvs;
-    delete[] mpGlyphAdvances;
-    delete[] mpOutGlyphs;
-}
-
-bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
-{
-    // prepare layout
-    // TODO: fix case when recyclying old SimpleWinLayout object
-    mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
-
-    // TODO: use a cached value for bDisableAsianKern from upper layers
-    if( rArgs.mnFlags & SalLayoutFlags::KerningAsian )
-    {
-        TEXTMETRICA aTextMetricA;
-        if( GetTextMetricsA( mhDC, &aTextMetricA )
-        && !(aTextMetricA.tmPitchAndFamily & TMPF_FIXED_PITCH) && !(aTextMetricA.tmCharSet == 0x86) )
-            rArgs.mnFlags &= ~SalLayoutFlags::KerningAsian;
-    }
-
-    // layout text
-    int i, j;
-
-    mnGlyphCount = 0;
-    bool bVertical(rArgs.mnFlags & SalLayoutFlags::Vertical);
-
-    // count the number of chars to process if no RTL run
-    rArgs.ResetPos();
-    bool bHasRTL = false;
-    while( rArgs.GetNextRun( &i, &j, &bHasRTL ) && !bHasRTL )
-        mnGlyphCount += j - i;
-
-    // if there are RTL runs we need room to remember individual BiDi flags
-    if( bHasRTL )
-    {
-        mpGlyphRTLFlags = new bool[ mnCharCount ];
-        for( i = 0; i < mnCharCount; ++i )
-            mpGlyphRTLFlags[i] = false;
-    }
-
-    // rewrite the logical string if needed to prepare for the API calls
-    const sal_Unicode* pBidiStr = rArgs.mpStr + rArgs.mnMinCharPos;
-    if( (mnGlyphCount != mnCharCount) || bVertical )
-    {
-        // we need to rewrite the pBidiStr when any of
-        // - BiDirectional layout
-        // - vertical layout
-        // - partial runs (e.g. with control chars or for glyph fallback)
-        // are involved
-        sal_Unicode* pRewrittenStr = (sal_Unicode*)alloca( mnCharCount * sizeof(sal_Unicode) );
-        pBidiStr = pRewrittenStr;
-
-        // note: glyph to char mapping is relative to first character
-        mpChars2Glyphs = new int[ mnCharCount ];
-        mpGlyphs2Chars = new int[ mnCharCount ];
-        for( i = 0; i < mnCharCount; ++i )
-            mpChars2Glyphs[i] = mpGlyphs2Chars[i] = -1;
-
-        mnGlyphCount = 0;
-        rArgs.ResetPos();
-        bool bIsRTL = false;
-        while( rArgs.GetNextRun( &i, &j, &bIsRTL ) )
-        {
-            do
-            {
-                // get the next leftmost character in this run
-                int nCharPos = bIsRTL ? --j : i++;
-                sal_UCS4 cChar = rArgs.mpStr[ nCharPos ];
-
-                // in the RTL case mirror the character and remember its RTL status
-                if( bIsRTL )
-                {
-                    cChar = GetMirroredChar( cChar );
-                    mpGlyphRTLFlags[ mnGlyphCount ] = true;
-                }
-
-                // rewrite the original string
-                // update the mappings between original and rewritten string
-               // TODO: support surrogates in rewritten strings
-                pRewrittenStr[ mnGlyphCount ] = static_cast<sal_Unicode>(cChar);
-                mpGlyphs2Chars[ mnGlyphCount ] = nCharPos;
-                mpChars2Glyphs[ nCharPos - rArgs.mnMinCharPos ] = mnGlyphCount;
-                ++mnGlyphCount;
-            } while( i < j );
-        }
-    }
-
-    mpOutGlyphs     = new WCHAR[ mnGlyphCount ];
-    mpGlyphAdvances = new int[ mnGlyphCount ];
-
-    if( rArgs.mnFlags & (SalLayoutFlags::KerningPairs | SalLayoutFlags::KerningAsian) )
-        mpGlyphOrigAdvs = new int[ mnGlyphCount ];
-
-    for( i = 0; i < mnGlyphCount; ++i )
-        mpOutGlyphs[i] = pBidiStr[ i ];
-    mnWidth = 0;
-    for( i = 0; i < mnGlyphCount; ++i )
-    {
-        // get the current UCS-4 code point, check for surrogate pairs
-        const WCHAR* pCodes = reinterpret_cast<LPCWSTR>(&pBidiStr[i]);
-        unsigned nCharCode = pCodes[0];
-        bool bSurrogate = ((nCharCode >= 0xD800) && (nCharCode <= 0xDFFF));
-        if( bSurrogate )
-        {
-            // ignore high surrogates, they were already processed with their low surrogates
-            if( nCharCode >= 0xDC00 )
-                continue;
-            // check the second half of the surrogate pair
-            bSurrogate &= (0xDC00 <= pCodes[1]) && (pCodes[1] <= 0xDFFF);
-            // calculate the UTF-32 code of valid surrogate pairs
-            if( bSurrogate )
-                nCharCode = 0x10000 + ((pCodes[0] - 0xD800) << 10) + (pCodes[1] - 0xDC00);
-            else // or fall back to a replacement character
-                nCharCode = '?';
-        }
-
-        // get the advance width for the current UTF-32 code point
-        int nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode );
-        if( nGlyphWidth == -1 )
-        {
-            ABC aABC;
-            SIZE aExtent;
-            if( GetTextExtentPoint32W( mhDC, &pCodes[0], bSurrogate ? 2 : 1, &aExtent) )
-                nGlyphWidth = aExtent.cx;
-            else if( GetCharABCWidthsW( mhDC, nCharCode, nCharCode, &aABC ) )
-                nGlyphWidth = aABC.abcA + aABC.abcB + aABC.abcC;
-            else if( !GetCharWidth32W( mhDC, nCharCode, nCharCode, &nGlyphWidth )
-                 &&  !GetCharWidthW( mhDC, nCharCode, nCharCode, &nGlyphWidth ) )
-                    nGlyphWidth = 0;
-            mrWinFontEntry.CacheGlyphWidth( nCharCode, nGlyphWidth );
-        }
-        mpGlyphAdvances[ i ] = nGlyphWidth;
-        mnWidth += nGlyphWidth;
-
-        // the second half of surrogate pair gets a zero width
-        if( bSurrogate && ((i+1) < mnGlyphCount) )
-            mpGlyphAdvances[ i+1 ] = 0;
-
-        // check with the font face if glyph fallback is needed
-        if( mrWinFontData.HasChar( nCharCode ) )
-            continue;
-
-        // request glyph fallback at this position in the string
-        bool bRTL = mpGlyphRTLFlags ? mpGlyphRTLFlags[i] : false;
-        int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[i]: i + rArgs.mnMinCharPos;
-        rArgs.NeedFallback( nCharPos, bRTL );
-        if( bSurrogate && ((nCharPos+1) < rArgs.mnLength) )
-            rArgs.NeedFallback( nCharPos+1, bRTL );
-
-        // replace the current glyph shape with the NotDef glyph shape
-        if( rArgs.mnFlags & SalLayoutFlags::ForFallback )
-        {
-            // when we already are layouting for glyph fallback
-            // then a new unresolved glyph is not interesting
-            mnNotdefWidth = 0;
-            mpOutGlyphs[i] = DROPPED_OUTGLYPH;
-        }
-        else
-        {
-            if( mnNotdefWidth < 0 )
-            {
-                // get the width of the NotDef glyph
-                SIZE aExtent;
-                WCHAR cNotDef = rArgs.mpStr[ nCharPos ];
-                mnNotdefWidth = 0;
-                if( GetTextExtentPoint32W( mhDC, &cNotDef, 1, &aExtent) )
-                    mnNotdefWidth = aExtent.cx;
-            }
-        }
-        if( bSurrogate && ((i+1) < mnGlyphCount) )
-            mpOutGlyphs[i+1] = DROPPED_OUTGLYPH;
-
-        // adjust the current glyph width to the NotDef glyph width
-        mnWidth += mnNotdefWidth - mpGlyphAdvances[i];
-        mpGlyphAdvances[i] = mnNotdefWidth;
-        if( mpGlyphOrigAdvs )
-            mpGlyphOrigAdvs[i] = mnNotdefWidth;
-    }
-
-    // apply kerning if the layout engine has not yet done it
-    if( rArgs.mnFlags & (SalLayoutFlags::KerningAsian|SalLayoutFlags::KerningPairs) )
-    {
-        for( i = 0; i < mnGlyphCount; ++i )
-            mpGlyphOrigAdvs[i] = mpGlyphAdvances[i];
-
-        // #99658# also apply asian kerning on the substring border
-        int nLen = mnGlyphCount;
-        if( rArgs.mnMinCharPos + nLen < rArgs.mnLength )
-            ++nLen;
-        for( i = 1; i < nLen; ++i )
-        {
-            if( rArgs.mnFlags & SalLayoutFlags::KerningPairs )
-            {
-                int nKernAmount = mrWinFontEntry.GetKerning( pBidiStr[i-1], pBidiStr[i] );
-                mpGlyphAdvances[ i-1 ] += nKernAmount;
-                mnWidth += nKernAmount;
-            }
-            else if( rArgs.mnFlags & SalLayoutFlags::KerningAsian )
-
-            if( ( (0x3000 == (0xFF00 & pBidiStr[i-1])) || (0x2010 == (0xFFF0 & pBidiStr[i-1])) || (0xFF00 == (0xFF00 & pBidiStr[i-1])))
-            &&  ( (0x3000 == (0xFF00 & pBidiStr[i])) || (0x2010 == (0xFFF0 & pBidiStr[i])) || (0xFF00 == (0xFF00 & pBidiStr[i])) ) )
-            {
-                long nKernFirst = +CalcAsianKerning( pBidiStr[i-1], true, bVertical );
-                long nKernNext  = -CalcAsianKerning( pBidiStr[i], false, bVertical );
-
-                long nDelta = (nKernFirst < nKernNext) ? nKernFirst : nKernNext;
-                if( nDelta<0 && nKernFirst!=0 && nKernNext!=0 )
-                {
-                    nDelta = (nDelta * mpGlyphAdvances[i-1] + 2) / 4;
-                    mpGlyphAdvances[i-1] += nDelta;
-                    mnWidth += nDelta;
-                }
-            }
-        }
-    }
-
-    // calculate virtual char widths
-    if( !mpGlyphs2Chars )
-        mpCharWidths = mpGlyphAdvances;
-    else
-    {
-        mpCharWidths = new int[ mnCharCount ];
-        for( i = 0; i < mnCharCount; ++i )
-            mpCharWidths[ i ] = 0;
-        for( i = 0; i < mnGlyphCount; ++i )
-        {
-            int k = mpGlyphs2Chars[ i ] - rArgs.mnMinCharPos;
-            if( k >= 0 )
-                mpCharWidths[ k ] += mpGlyphAdvances[ i ];
-        }
-    }
-
-    // scale layout metrics if needed
-    // TODO: does it make the code more simple if the metric scaling
-    // is moved to the methods that need metric scaling (e.g. FillDXArray())?
-    if( mfFontScale != 1.0 )
-    {
-        mnWidth   = (long)(mnWidth * mfFontScale);
-        mnBaseAdv = (int)(mnBaseAdv * mfFontScale);
-        for( i = 0; i < mnCharCount; ++i )
-            mpCharWidths[i] = (int)(mpCharWidths[i] * mfFontScale);
-        if( mpGlyphAdvances != mpCharWidths )
-            for( i = 0; i < mnGlyphCount; ++i )
-                mpGlyphAdvances[i] = (int)(mpGlyphAdvances[i] * mfFontScale);
-        if( mpGlyphOrigAdvs && (mpGlyphOrigAdvs != mpGlyphAdvances) )
-            for( i = 0; i < mnGlyphCount; ++i )
-                mpGlyphOrigAdvs[i] = (int)(mpGlyphOrigAdvs[i] * mfFontScale);
-    }
-
-    return true;
-}
-
-int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPos, int& nStart,
-                                    DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
-                                    const PhysicalFontFace** /*pFallbackFonts*/ ) const
-{
-    // return zero if no more glyph found
-    if( nStart >= mnGlyphCount )
-        return 0;
-
-    // calculate glyph position relative to layout base
-    // TODO: avoid for nStart!=0 case by reusing rPos
-    long nXOffset = mnBaseAdv;
-    for( int i = 0; i < nStart; ++i )
-        nXOffset += mpGlyphAdvances[ i ];
-
-    // calculate absolute position in pixel units
-    Point aRelativePos( nXOffset, 0 );
-    rPos = GetDrawPosition( aRelativePos );
-
-    int nCount = 0;
-    while( nCount < nLen )
-    {
-        // update return values {aGlyphId,nCharPos,nGlyphAdvance}
-        sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ];
-        if( mnLayoutFlags & SalLayoutFlags::Vertical )
-        {
-            const sal_UCS4 cChar = static_cast<sal_UCS4>(aGlyphId & GF_IDXMASK);
-            if( mrWinFontData.HasGSUBstitutions( mhDC )
-            &&  mrWinFontData.IsGSUBstituted( cChar ) )
-                aGlyphId |= GF_GSUB | GF_ROTL;
-            else
-            {
-                aGlyphId |= GetVerticalFlags( cChar );
-                if( (aGlyphId & GF_ROTMASK) == 0 )
-                    aGlyphId |= GF_VERT;
-            }
-        }
-        aGlyphId |= GF_ISCHAR;
-
-        ++nCount;
-        *(pGlyphIds++) = aGlyphId;
-        if( pGlyphAdvances )
-            *(pGlyphAdvances++) = mpGlyphAdvances[ nStart ];
-        if( pCharIndexes )
-        {
-            int nCharPos;
-            if( !mpGlyphs2Chars )
-                nCharPos = nStart + mnMinCharPos;
-            else
-                nCharPos = mpGlyphs2Chars[nStart];
-            *(pCharIndexes++) = nCharPos;
-        }
-
-        // stop at last glyph
-        if( ++nStart >= mnGlyphCount )
-            break;
-
-        // stop when next x-position is unexpected
-        if( !pGlyphAdvances && mpGlyphOrigAdvs )
-            if( mpGlyphAdvances[nStart-1] != mpGlyphOrigAdvs[nStart-1] )
-                break;
-    }
-
-    return nCount;
-}
-
-void SimpleWinLayout::DrawTextImpl(HDC hDC) const
-{
-    if( mnGlyphCount <= 0 )
-        return;
-
-    HFONT hOrigFont = DisableFontScaling();
-    Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) );
-
-    // #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(hDC);
-        SetTextAlign(hDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP);
-        MoveToEx(hDC, aPos.X(), aPos.Y(), &oldPos);
-        unsigned int i = 0;
-        for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount )
-        {
-            ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
-        }
-        ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
-        MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
-        SetTextAlign(hDC, oldTa);
-    }
-    else
-        ExtTextOutW(hDC, aPos.X(), aPos.Y(), 0, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
-
-    if( hOrigFont )
-        DeleteFont(SelectFont(hDC, hOrigFont));
-}
-
-DeviceCoordinate SimpleWinLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
-{
-    if( !mnWidth )
-    {
-        mnWidth = mnBaseAdv;
-        for( int i = 0; i < mnGlyphCount; ++i )
-            mnWidth += mpGlyphAdvances[ i ];
-    }
-
-    if( pDXArray != NULL )
-    {
-        for( int i = 0; i < mnCharCount; ++i )
-             pDXArray[ i ] = mpCharWidths[ i ];
-    }
-
-    return mnWidth;
-}
-
-sal_Int32 SimpleWinLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor ) const
-// NOTE: the nFactor is used to prevent rounding errors for small nCharExtra values
-{
-    if( mnWidth )
-        if( (mnWidth * nFactor + mnCharCount * nCharExtra) <= nMaxWidth )
-            return -1;
-
-    long nExtraWidth = mnBaseAdv * nFactor;
-    for( int n = 0; n < mnCharCount; ++n )
-    {
-        // skip unused characters
-        if( mpChars2Glyphs && (mpChars2Glyphs[n] < 0) )
-            continue;
-        // add char widths until max
-        nExtraWidth += mpCharWidths[ n ] * nFactor;
-        if( nExtraWidth > nMaxWidth )
-            return (mnMinCharPos + n);
-        nExtraWidth += nCharExtra;
-    }
-
-    return -1;
-}
-
-void SimpleWinLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const
-{
-    long nXPos = mnBaseAdv;
-
-    if( !mpGlyphs2Chars )
-    {
-        for( int i = 0; i < nMaxIdx; i += 2 )
-        {
-            pCaretXArray[ i ] = nXPos;
-            nXPos += mpGlyphAdvances[ i>>1 ];
-            pCaretXArray[ i+1 ] = nXPos;
-        }
-    }
-    else
-    {
-        int  i;
-        for( i = 0; i < nMaxIdx; ++i )
-            pCaretXArray[ i ] = -1;
-
-        // assign glyph positions to character positions
-        for( i = 0; i < mnGlyphCount; ++i )
-        {
-            int nCurrIdx = mpGlyphs2Chars[ i ] - mnMinCharPos;
-            long nXRight = nXPos + mpCharWidths[ nCurrIdx ];
-            nCurrIdx *= 2;
-            if( !(mpGlyphRTLFlags && mpGlyphRTLFlags[i]) )
-            {
-                // normal positions for LTR case
-                pCaretXArray[ nCurrIdx ]   = nXPos;
-                pCaretXArray[ nCurrIdx+1 ] = nXRight;
-            }
-            else
-            {
-                // reverse positions for RTL case
-                pCaretXArray[ nCurrIdx ]   = nXRight;
-                pCaretXArray[ nCurrIdx+1 ] = nXPos;
-            }
-            nXPos += mpGlyphAdvances[ i ];
-        }
-    }
-}
-
-void SimpleWinLayout::Justify( DeviceCoordinate nNewWidth )
-{
-    DeviceCoordinate nOldWidth = mnWidth;
-    mnWidth = nNewWidth;
-
-    if( mnGlyphCount <= 0 )
-        return;
-
-    if( nNewWidth == nOldWidth )
-        return;
-
-    // the rightmost glyph cannot be stretched
-    const int nRight = mnGlyphCount - 1;
-    nOldWidth -= mpGlyphAdvances[ nRight ];
-    nNewWidth -= mpGlyphAdvances[ nRight ];
-
-    // count stretchable glyphs
-    int nStretchable = 0, i;
-    for( i = 0; i < nRight; ++i )
-        if( mpGlyphAdvances[i] >= 0 )
-            ++nStretchable;
-
-    // stretch these glyphs
-    DeviceCoordinate nDiffWidth = nNewWidth - nOldWidth;
-    for( i = 0; (i < nRight) && (nStretchable > 0); ++i )
-    {
-        if( mpGlyphAdvances[i] <= 0 )
-            continue;
-        DeviceCoordinate nDeltaWidth = nDiffWidth / nStretchable;
-        mpGlyphAdvances[i] += nDeltaWidth;
-        --nStretchable;
-        nDiffWidth -= nDeltaWidth;
-    }
-}
-
-void SimpleWinLayout::AdjustLayout( ImplLayoutArgs& rArgs )
-{
-    SalLayout::AdjustLayout( rArgs );
-
-    // adjust positions if requested
-    if( rArgs.mpDXArray )
-        ApplyDXArray( rArgs );
-    else if( rArgs.mnLayoutWidth )
-        Justify( rArgs.mnLayoutWidth );
-    else
-        return;
-
-    // recalculate virtual char widths if they were changed
-    if( mpCharWidths != mpGlyphAdvances )
-    {
-        int i;
-        if( !mpGlyphs2Chars )
-        {
-            // standard LTR case
-            for( i = 0; i < mnGlyphCount; ++i )
-                 mpCharWidths[ i ] = mpGlyphAdvances[ i ];
-        }
-        else
-        {
-            // BiDi or complex case
-            for( i = 0; i < mnCharCount; ++i )
-                mpCharWidths[ i ] = 0;
-            for( i = 0; i < mnGlyphCount; ++i )
-            {
-                int j = mpGlyphs2Chars[ i ] - rArgs.mnMinCharPos;
-                if( j >= 0 )
-                    mpCharWidths[ j ] += mpGlyphAdvances[ i ];
-            }
-        }
-    }
-}
-
-void SimpleWinLayout::ApplyDXArray( const ImplLayoutArgs& rArgs )
-{
-    // try to avoid disturbance of text flow for LSB rounding case;
-    const long* pDXArray = rArgs.mpDXArray;
-
-    int i = 0;
-    long nOldWidth = mnBaseAdv;
-    for(; i < mnCharCount; ++i )
-    {
-        int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i];
-        if( j >= 0 )
-        {
-            nOldWidth += mpGlyphAdvances[ j ];
-            long nDiff = nOldWidth - pDXArray[ i ];
-
-            // disabled because of #104768#
-            // works great for static text, but problems when typing
-            // if( nDiff>+1 || nDiff<-1 )
-            // only bother with changing anything when something moved
-            if( nDiff != 0 )
-                break;
-        }
-    }
-    if( i >= mnCharCount )
-        return;
-
-    if( !mpGlyphOrigAdvs )
-    {
-        mpGlyphOrigAdvs = new int[ mnGlyphCount ];
-        for( i = 0; i < mnGlyphCount; ++i )
-            mpGlyphOrigAdvs[ i ] = mpGlyphAdvances[ i ];
-    }
-
-    mnWidth = mnBaseAdv;
-    for( i = 0; i < mnCharCount; ++i )
-    {
-        int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i];
-        if( j >= 0 )
-            mpGlyphAdvances[j] = pDXArray[i] - mnWidth;
-        mnWidth = pDXArray[i];
-    }
-}
-
-void SimpleWinLayout::MoveGlyph( int nStart, long nNewXPos )
-{
-   if( nStart > mnGlyphCount )
-        return;
-
-    // calculate the current x-position of the requested glyph
-    // TODO: cache absolute positions
-    int nXPos = mnBaseAdv;
-    for( int i = 0; i < nStart; ++i )
-        nXPos += mpGlyphAdvances[i];
-
-    // calculate the difference to the current glyph position
-    int nDelta = nNewXPos - nXPos;
-
-    // adjust the width of the layout if it was already cached
-    if( mnWidth )
-        mnWidth += nDelta;
-
-    // depending on whether the requested glyph is leftmost in the layout
-    // adjust either the layout's or the requested glyph's relative position
-    if( nStart > 0 )
-        mpGlyphAdvances[ nStart-1 ] += nDelta;
-    else
-        mnBaseAdv += nDelta;
-}
-
-void SimpleWinLayout::DropGlyph( int nStart )
-{
-    mpOutGlyphs[ nStart ] = DROPPED_OUTGLYPH;
-}
-
-void SimpleWinLayout::Simplify( bool /*bIsBase*/ )
-{
-    // return early if no glyph has been dropped
-    int i = mnGlyphCount;
-    while( (--i >= 0) && (mpOutGlyphs[ i ] != DROPPED_OUTGLYPH) );
-    if( i < 0 )
-        return;
-
-    // convert the layout to a sparse layout if it is not already
-    if( !mpGlyphs2Chars )
-    {
-        mpGlyphs2Chars = new int[ mnGlyphCount ];
-        mpCharWidths = new int[ mnCharCount ];
-        // assertion: mnGlyphCount == mnCharCount
-        for( int k = 0; k < mnGlyphCount; ++k )
-        {
-            mpGlyphs2Chars[ k ] = mnMinCharPos + k;
-            mpCharWidths[ k ] = mpGlyphAdvances[ k ];
-        }
-    }
-
-    // remove dropped glyphs that are rightmost in the layout
-    for( i = mnGlyphCount; --i >= 0; )
-    {
-        if( mpOutGlyphs[ i ] != DROPPED_OUTGLYPH )
-            break;
-        if( mnWidth )
-            mnWidth -= mpGlyphAdvances[ i ];
-        int nRelCharPos = mpGlyphs2Chars[ i ] - mnMinCharPos;
-        if( nRelCharPos >= 0 )
-            mpCharWidths[ nRelCharPos ] = 0;
-    }
-    mnGlyphCount = i + 1;
-
-    // keep original glyph widths around
-    if( !mpGlyphOrigAdvs )
-    {
-        mpGlyphOrigAdvs = new int[ mnGlyphCount ];
-        for( int k = 0; k < mnGlyphCount; ++k )
-            mpGlyphOrigAdvs[ k ] = mpGlyphAdvances[ k ];
-    }
-
-    // remove dropped glyphs inside the layout
-    int nNewGC = 0;
-    for( i = 0; i < mnGlyphCount; ++i )
-    {
-        if( mpOutGlyphs[ i ] == DROPPED_OUTGLYPH )
-        {
-            // adjust relative position to last valid glyph
-            int nDroppedWidth = mpGlyphAdvances[ i ];
-            mpGlyphAdvances[ i ] = 0;
-            if( nNewGC > 0 )
-                mpGlyphAdvances[ nNewGC-1 ] += nDroppedWidth;
-            else
-                mnBaseAdv += nDroppedWidth;
-
-            // zero the virtual char width for the char that has a fallback
-            int nRelCharPos = mpGlyphs2Chars[ i ] - mnMinCharPos;
-            if( nRelCharPos >= 0 )
-                mpCharWidths[ nRelCharPos ] = 0;
-        }
-        else
-        {
-            if( nNewGC != i )
-            {
-                // rearrange the glyph array to get rid of the dropped glyph
-                mpOutGlyphs[ nNewGC ]     = mpOutGlyphs[ i ];
-                mpGlyphAdvances[ nNewGC ] = mpGlyphAdvances[ i ];
-                mpGlyphOrigAdvs[ nNewGC ] = mpGlyphOrigAdvs[ i ];
-                mpGlyphs2Chars[ nNewGC ]  = mpGlyphs2Chars[ i ];
-            }
-            ++nNewGC;
-        }
-    }
-
-    mnGlyphCount = nNewGC;
-    if( mnGlyphCount <= 0 )
-        mnWidth = mnBaseAdv = 0;
-}
-
 struct VisualItem
 {
 public:
@@ -939,7 +251,7 @@ static bool bUspInited = false;
 
 static bool bManualCellAlign = true;
 
-static bool InitUSP()
+static void InitUSP()
 {
     // get the usp10.dll version info
     HMODULE usp10 = GetModuleHandle("usp10.dll");
@@ -973,8 +285,6 @@ static bool InitUSP()
         bManualCellAlign = false;
 
     bUspInited = true;
-
-    return true;
 }
 
 UniscribeLayout::UniscribeLayout(HDC hDC, const ImplWinFontData& rWinFontData,
@@ -2698,40 +2008,21 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
 
     bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled();
 
-    if( !(rArgs.mnFlags & SalLayoutFlags::ComplexDisabled)
-    &&   (bUspInited || InitUSP()) )   // CTL layout engine
-    {
+    if (!bUspInited)
+        InitUSP();
 #if ENABLE_GRAPHITE
-        if (rFontFace.SupportsGraphite())
-        {
-            pWinLayout = new GraphiteWinLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
-        }
-        else
+    if (rFontFace.SupportsGraphite())
+    {
+        pWinLayout = new GraphiteWinLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
+    }
+    else
 #endif // ENABLE_GRAPHITE
-        // script complexity is determined in upper layers
+    {
         pWinLayout = new UniscribeLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
         // NOTE: it must be guaranteed that the WinSalGraphics lives longer than
         // the created UniscribeLayout, otherwise the data passed into the
         // constructor might become invalid too early
     }
-    else
-    {
-        if( (rArgs.mnFlags & SalLayoutFlags::KerningPairs) && !rFontInstance.HasKernData() )
-        {
-            // TODO: directly cache kerning info in the rFontInstance
-            // TODO: get rid of kerning methods+data in WinSalGraphics object
-            GetKernPairs();
-            rFontInstance.SetKernData( mnFontKernPairCount, mpFontKernPairs );
-        }
-
-        BYTE eCharSet = ANSI_CHARSET;
-#if ENABLE_GRAPHITE
-        if (rFontFace.SupportsGraphite())
-            pWinLayout = new GraphiteWinLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
-        else
-#endif // ENABLE_GRAPHITE
-            pWinLayout = new SimpleWinLayout(getHDC(), eCharSet, rFontFace, rFontInstance, bUseOpenGL);
-    }
 
     if( mfFontScale[nFallbackLevel] != 1.0 )
         pWinLayout->SetFontScale( mfFontScale[nFallbackLevel] );
@@ -2805,17 +2096,17 @@ bool ImplWinFontEntry::InitKashidaHandling( HDC hDC )
     // initialize the kashida width
     mnMinKashidaWidth = 0;
     mnMinKashidaGlyph = 0;
-    if (bUspInited || InitUSP())
-    {
-        SCRIPT_FONTPROPERTIES aFontProperties;
-        aFontProperties.cBytes = sizeof (aFontProperties);
-        SCRIPT_CACHE& rScriptCache = GetScriptCache();
-        HRESULT nRC = ScriptGetFontProperties( hDC, &rScriptCache, &aFontProperties );
-        if( nRC != 0 )
-            return false;
-        mnMinKashidaWidth = aFontProperties.iKashidaWidth;
-        mnMinKashidaGlyph = aFontProperties.wgKashida;
-    }
+    if (!bUspInited)
+        InitUSP();
+
+    SCRIPT_FONTPROPERTIES aFontProperties;
+    aFontProperties.cBytes = sizeof (aFontProperties);
+    SCRIPT_CACHE& rScriptCache = GetScriptCache();
+    HRESULT nRC = ScriptGetFontProperties( hDC, &rScriptCache, &aFontProperties );
+    if( nRC != 0 )
+        return false;
+    mnMinKashidaWidth = aFontProperties.iKashidaWidth;
+    mnMinKashidaGlyph = aFontProperties.wgKashida;
 
     return true;
 }
diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
index 7e135ae..7819eae 100644
--- a/vcl/win/source/gdi/winlayout.hxx
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -65,49 +65,6 @@ protected:
     ImplWinFontEntry&   mrWinFontEntry;
 };
 
-class SimpleWinLayout : public WinLayout
-{
-public:
-                    SimpleWinLayout(HDC, BYTE nCharSet, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
-    virtual         ~SimpleWinLayout();
-
-    virtual bool    LayoutText( ImplLayoutArgs& ) SAL_OVERRIDE;
-    virtual void    AdjustLayout( ImplLayoutArgs& ) SAL_OVERRIDE;
-    virtual void    DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
-
-    virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
-                                   DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
-                                   const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE;
-
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
-    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE;
-
-    // for glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE;
-    virtual void    DropGlyph( int nStart ) SAL_OVERRIDE;
-    virtual void    Simplify( bool bIsBase ) SAL_OVERRIDE;
-
-protected:
-    void            Justify( DeviceCoordinate nNewWidth );
-    void            ApplyDXArray( const ImplLayoutArgs& );
-
-private:
-    int             mnGlyphCount;
-    int             mnCharCount;
-    WCHAR*          mpOutGlyphs;
-    int*            mpGlyphAdvances;    // if possible this is shared with mpGlyphAdvances[]
-    int*            mpGlyphOrigAdvs;
-    int*            mpCharWidths;       // map rel char pos to char width
-    int*            mpChars2Glyphs;     // map rel char pos to abs glyph pos
-    int*            mpGlyphs2Chars;     // map abs glyph pos to abs char pos
-    bool*           mpGlyphRTLFlags;    // BiDi status for glyphs: true=>RTL
-    mutable long    mnWidth;
-
-    int             mnNotdefWidth;
-    BYTE            mnCharSet;
-};
-
 class UniscribeLayout : public WinLayout
 {
 public:
commit 844e3c55d1c66c8eaee7c9b47bbe72574e2d15e1
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Aug 10 13:58:37 2015 +0300

    Add missing SAL_OVERRIDEs
    
    It is really ugly to use SAL_OVERRIDE inconsistently.
    
    Change-Id: I8b556a9cc65e6f71198d126d07ce1559216543e9

diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
index d219b20..7e135ae 100644
--- a/vcl/win/source/gdi/winlayout.hxx
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -41,7 +41,7 @@ class WinLayout : public SalLayout
 {
 public:
                         WinLayout(HDC, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
-    virtual void        InitFont() const;
+    virtual void        InitFont() const SAL_OVERRIDE;
     void                SetFontScale( float f ) { mfFontScale = f; }
     HFONT               DisableFontScaling() const;
 
@@ -71,22 +71,22 @@ public:
                     SimpleWinLayout(HDC, BYTE nCharSet, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
     virtual         ~SimpleWinLayout();
 
-    virtual bool    LayoutText( ImplLayoutArgs& );
-    virtual void    AdjustLayout( ImplLayoutArgs& );
+    virtual bool    LayoutText( ImplLayoutArgs& ) SAL_OVERRIDE;
+    virtual void    AdjustLayout( ImplLayoutArgs& ) SAL_OVERRIDE;
     virtual void    DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
 
     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
                                    DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
-                                   const PhysicalFontFace** pFallbackFonts = NULL ) const;
+                                   const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE;
 
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
     virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
+    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE;
 
     // for glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
+    virtual void    MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE;
+    virtual void    DropGlyph( int nStart ) SAL_OVERRIDE;
+    virtual void    Simplify( bool bIsBase ) SAL_OVERRIDE;
 
 protected:
     void            Justify( DeviceCoordinate nNewWidth );
@@ -113,22 +113,22 @@ class UniscribeLayout : public WinLayout
 public:
                     UniscribeLayout(HDC, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
 
-    virtual bool    LayoutText( ImplLayoutArgs& );
-    virtual void    AdjustLayout( ImplLayoutArgs& );
+    virtual bool    LayoutText( ImplLayoutArgs& ) SAL_OVERRIDE;
+    virtual void    AdjustLayout( ImplLayoutArgs& ) SAL_OVERRIDE;
     virtual void    DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
                                    DeviceCoordinate* pGlyphAdvances, int* pCharPosAry,
-                                   const PhysicalFontFace** pFallbackFonts = NULL ) const;
+                                   const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE;
 
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
     virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
+    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE;
     virtual bool    IsKashidaPosValid ( int nCharPos ) const SAL_OVERRIDE;
 
     // for glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
+    virtual void    MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE;
+    virtual void    DropGlyph( int nStart ) SAL_OVERRIDE;
+    virtual void    Simplify( bool bIsBase ) SAL_OVERRIDE;
     virtual void    DisableGlyphInjection( bool bDisable ) SAL_OVERRIDE { mbDisableGlyphInjection = bDisable; }
 
 protected:
@@ -183,7 +183,7 @@ public:
         throw()
     : GraphiteLayout(pFace), mrFont(rFont) {};
     virtual ~GraphiteLayoutWinImpl() throw() {};
-    virtual sal_GlyphId getKashidaGlyph(int & rWidth);
+    virtual sal_GlyphId getKashidaGlyph(int & rWidth) SAL_OVERRIDE;
 private:
     ImplWinFontEntry & mrFont;
 };
@@ -200,25 +200,25 @@ public:
     virtual ~GraphiteWinLayout();
 
     // used by upper layers
-    virtual bool  LayoutText( ImplLayoutArgs& );    // first step of layout
-    virtual void  AdjustLayout( ImplLayoutArgs& );  // adjusting after fallback etc.
+    virtual bool  LayoutText( ImplLayoutArgs& ) SAL_OVERRIDE;    // first step of layout
+    virtual void  AdjustLayout( ImplLayoutArgs& ) SAL_OVERRIDE;  // adjusting after fallback etc.
     virtual void  DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
 
     // methods using string indexing
     virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra=0, int nFactor=1) const SAL_OVERRIDE;
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE;
 
-    virtual void  GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
+    virtual void  GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE;
 
     // methods using glyph indexing
     virtual int   GetNextGlyphs(int nLen, sal_GlyphId* pGlyphIdxAry, ::Point & rPos, int&,
                                 DeviceCoordinate* pGlyphAdvAry = NULL, int* pCharPosAry = NULL,
-                                const PhysicalFontFace** pFallbackFonts = NULL ) const;
+                                const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE;
 
     // used by glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
+    virtual void    MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE;
+    virtual void    DropGlyph( int nStart ) SAL_OVERRIDE;
+    virtual void    Simplify( bool bIsBase ) SAL_OVERRIDE;
 };
 
 #endif // ENABLE_GRAPHITE
commit 54f8afd2aafee704208d585e4688fa91e12708aa
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Aug 10 19:26:57 2015 +0300

    SimpleWinLayout::mbDisableGlyphs was always true
    
    Remove dead code. Should have no effect on behaviour.
    
    Possibly originally the intent was that mbDisableGlyphs would have
    been false in most cases on NT-based Windows (all versions that we
    support now). However, since dadfc60873d4dce4e0c46e1d3405f8d45535cdcf,
    in 2005, mbDisableGlyphs was set to always true in the SimpleWinLayout
    ctor.
    
    Change-Id: Id929224d5656706762c2f44ee26c76f8b20ee8b8

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index fdd931c..236371c 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -87,7 +87,6 @@ public:
 
     BYTE                    GetCharSet() const          { return meWinCharSet; }
     BYTE                    GetPitchAndFamily() const   { return mnPitchAndFamily; }
-    bool                    IsGlyphApiDisabled() const  { return mbDisableGlyphApi; }
     bool                    SupportsKorean() const      { return mbHasKoreanRange; }
     bool                    SupportsCJK() const         { return mbHasCJKSupport; }
     bool                    SupportsArabic() const      { return mbHasArabicSupport; }
@@ -111,7 +110,6 @@ private:
     sal_IntPtr              mnId;
 
     // some members that are initalized lazily when the font gets selected into a HDC
-    mutable bool                    mbDisableGlyphApi;
     mutable bool                    mbHasKoreanRange;
     mutable bool                    mbHasCJKSupport;
 #if ENABLE_GRAPHITE
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 89b8d96..c70d868 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1086,7 +1086,6 @@ ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS,
     int nHeight, BYTE eWinCharSet, BYTE nPitchAndFamily )
 :   PhysicalFontFace( rDFS, 0 ),
     mnId( 0 ),
-    mbDisableGlyphApi( false ),
     mbHasKoreanRange( false ),
     mbHasCJKSupport( false ),
 #if ENABLE_GRAPHITE
@@ -1186,15 +1185,6 @@ void ImplWinFontData::UpdateFromHDC( HDC hDC ) const
         }
     }
 #endif
-
-    // even if the font works some fonts have problems with the glyph API
-    // => the heuristic below tries to figure out which fonts have the problem
-    TEXTMETRICA aTextMetric;
-    if( ::GetTextMetricsA( hDC, &aTextMetric ) )
-        if( !(aTextMetric.tmPitchAndFamily & TMPF_TRUETYPE)
-        ||   (aTextMetric.tmPitchAndFamily & TMPF_DEVICE) )
-            mbDisableGlyphApi = true;
-
 }
 
 #if ENABLE_GRAPHITE
@@ -1291,7 +1281,6 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const
     if( aRawFontData.get() ) {
         CmapResult aResult;
         ParseCMAP( aRawFontData.get(), aRawFontData.size(), aResult );
-        mbDisableGlyphApi |= aResult.mbRecoded;
         aResult.mbSymbolic = bIsSymbolFont;
         if( aResult.mnRangeCount > 0 )
         {
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 47c47d5..9edf88c 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -241,11 +241,9 @@ SimpleWinLayout::SimpleWinLayout(HDC hDC, BYTE nCharSet, const ImplWinFontData&
     mpGlyphs2Chars( NULL ),
     mpGlyphRTLFlags( NULL ),
     mnWidth( 0 ),
-    mbDisableGlyphs( false ),
     mnNotdefWidth( -1 ),
     mnCharSet( nCharSet )
 {
-    mbDisableGlyphs = true;
 }
 
 SimpleWinLayout::~SimpleWinLayout()
@@ -264,20 +262,8 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
 {
     // prepare layout
     // TODO: fix case when recyclying old SimpleWinLayout object
-    mbDisableGlyphs |= bool(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing);
     mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
 
-    if( !mbDisableGlyphs )
-    {
-        // Win32 glyph APIs have serious problems with vertical layout
-        // => workaround is to use the unicode methods then
-        if( rArgs.mnFlags & SalLayoutFlags::Vertical )
-            mbDisableGlyphs = true;
-        else
-            // use cached value from font face
-            mbDisableGlyphs = mrWinFontData.IsGlyphApiDisabled();
-    }
-
     // TODO: use a cached value for bDisableAsianKern from upper layers
     if( rArgs.mnFlags & SalLayoutFlags::KerningAsian )
     {
@@ -435,9 +421,6 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
                 if( GetTextExtentPoint32W( mhDC, &cNotDef, 1, &aExtent) )
                     mnNotdefWidth = aExtent.cx;
             }
-            // use a better NotDef glyph
-            if( !mbDisableGlyphs && !bSurrogate )
-                mpOutGlyphs[i] = 0;
         }
         if( bSurrogate && ((i+1) < mnGlyphCount) )
             mpOutGlyphs[i+1] = DROPPED_OUTGLYPH;
@@ -545,23 +528,21 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPo
     {
         // update return values {aGlyphId,nCharPos,nGlyphAdvance}
         sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ];
-        if( mbDisableGlyphs )
+        if( mnLayoutFlags & SalLayoutFlags::Vertical )
         {
-            if( mnLayoutFlags & SalLayoutFlags::Vertical )
+            const sal_UCS4 cChar = static_cast<sal_UCS4>(aGlyphId & GF_IDXMASK);
+            if( mrWinFontData.HasGSUBstitutions( mhDC )
+            &&  mrWinFontData.IsGSUBstituted( cChar ) )
+                aGlyphId |= GF_GSUB | GF_ROTL;
+            else
             {
-                const sal_UCS4 cChar = static_cast<sal_UCS4>(aGlyphId & GF_IDXMASK);
-                if( mrWinFontData.HasGSUBstitutions( mhDC )
-                &&  mrWinFontData.IsGSUBstituted( cChar ) )
-                    aGlyphId |= GF_GSUB | GF_ROTL;
-                else
-                {
-                    aGlyphId |= GetVerticalFlags( cChar );
-                    if( (aGlyphId & GF_ROTMASK) == 0 )
-                        aGlyphId |= GF_VERT;
-                }
+                aGlyphId |= GetVerticalFlags( cChar );
+                if( (aGlyphId & GF_ROTMASK) == 0 )
+                    aGlyphId |= GF_VERT;
             }
-            aGlyphId |= GF_ISCHAR;
         }
+        aGlyphId |= GF_ISCHAR;
+
         ++nCount;
         *(pGlyphIds++) = aGlyphId;
         if( pGlyphAdvances )
@@ -595,11 +576,6 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const
         return;
 
     HFONT hOrigFont = DisableFontScaling();
-
-    UINT mnDrawOptions = ETO_GLYPH_INDEX;
-    if( mbDisableGlyphs )
-        mnDrawOptions = 0;
-
     Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) );
 
     // #108267#, break up into glyph portions of a limited size required by Win32 API
@@ -618,14 +594,14 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const
         unsigned int i = 0;
         for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount )
         {
-            ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
+            ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
         }
-        ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
+        ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
         MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
         SetTextAlign(hDC, oldTa);
     }
     else
-        ExtTextOutW(hDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
+        ExtTextOutW(hDC, aPos.X(), aPos.Y(), 0, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
 
     if( hOrigFont )
         DeleteFont(SelectFont(hDC, hOrigFont));
diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
index 196b8e9..d219b20 100644
--- a/vcl/win/source/gdi/winlayout.hxx
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -103,7 +103,6 @@ private:
     int*            mpGlyphs2Chars;     // map abs glyph pos to abs char pos
     bool*           mpGlyphRTLFlags;    // BiDi status for glyphs: true=>RTL
     mutable long    mnWidth;
-    bool            mbDisableGlyphs;
 
     int             mnNotdefWidth;
     BYTE            mnCharSet;
commit e3c4db8f6fc9bed189734a69e5856b2e41aee05f
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Aug 10 10:26:02 2015 +0300

    Avoid some ugly and pointless initial double colons
    
    Change-Id: I0d0cb1ef1e7b7f4747204b84c7c910f174e9c7b5

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d67fa1e..47c47d5 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -107,7 +107,7 @@ inline int ImplWinFontEntry::GetCachedGlyphWidth( int nCharCode ) const
 
 WinLayout::WinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE, bool bUseOpenGL)
 :   mhDC( hDC ),
-    mhFont( (HFONT)::GetCurrentObject(hDC,OBJ_FONT) ),
+    mhFont( (HFONT)GetCurrentObject(hDC,OBJ_FONT) ),
     mnBaseAdv( 0 ),
     mfFontScale( 1.0 ),
     mrWinFontData( rWFD ),
@@ -117,7 +117,7 @@ WinLayout::WinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWF
 
 void WinLayout::InitFont() const
 {
-    ::SelectObject( mhDC, mhFont );
+    SelectObject( mhDC, mhFont );
 }
 
 // Using reasonably sized fonts to emulate huge fonts works around
@@ -132,10 +132,10 @@ HFONT WinLayout::DisableFontScaling() const
         return 0;
 
     LOGFONTW aLogFont;
-    ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
+    GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
     aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight);
     aLogFont.lfWidth  = (LONG)(mfFontScale * aLogFont.lfWidth);
-    HFONT hHugeFont = ::CreateFontIndirectW( &aLogFont);
+    HFONT hHugeFont = CreateFontIndirectW( &aLogFont);
     if( !hHugeFont )
         return 0;
 
@@ -282,7 +282,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
     if( rArgs.mnFlags & SalLayoutFlags::KerningAsian )
     {
         TEXTMETRICA aTextMetricA;
-        if( ::GetTextMetricsA( mhDC, &aTextMetricA )
+        if( GetTextMetricsA( mhDC, &aTextMetricA )
         && !(aTextMetricA.tmPitchAndFamily & TMPF_FIXED_PITCH) && !(aTextMetricA.tmCharSet == 0x86) )
             rArgs.mnFlags &= ~SalLayoutFlags::KerningAsian;
     }
@@ -339,7 +339,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
                 // in the RTL case mirror the character and remember its RTL status
                 if( bIsRTL )
                 {
-                    cChar = ::GetMirroredChar( cChar );
+                    cChar = GetMirroredChar( cChar );
                     mpGlyphRTLFlags[ mnGlyphCount ] = true;
                 }
 
@@ -389,12 +389,12 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
         {
             ABC aABC;
             SIZE aExtent;
-            if( ::GetTextExtentPoint32W( mhDC, &pCodes[0], bSurrogate ? 2 : 1, &aExtent) )
+            if( GetTextExtentPoint32W( mhDC, &pCodes[0], bSurrogate ? 2 : 1, &aExtent) )
                 nGlyphWidth = aExtent.cx;
-            else if( ::GetCharABCWidthsW( mhDC, nCharCode, nCharCode, &aABC ) )
+            else if( GetCharABCWidthsW( mhDC, nCharCode, nCharCode, &aABC ) )
                 nGlyphWidth = aABC.abcA + aABC.abcB + aABC.abcC;
-            else if( !::GetCharWidth32W( mhDC, nCharCode, nCharCode, &nGlyphWidth )
-                 &&  !::GetCharWidthW( mhDC, nCharCode, nCharCode, &nGlyphWidth ) )
+            else if( !GetCharWidth32W( mhDC, nCharCode, nCharCode, &nGlyphWidth )
+                 &&  !GetCharWidthW( mhDC, nCharCode, nCharCode, &nGlyphWidth ) )
                     nGlyphWidth = 0;
             mrWinFontEntry.CacheGlyphWidth( nCharCode, nGlyphWidth );
         }
@@ -432,7 +432,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
                 SIZE aExtent;
                 WCHAR cNotDef = rArgs.mpStr[ nCharPos ];
                 mnNotdefWidth = 0;
-                if( ::GetTextExtentPoint32W( mhDC, &cNotDef, 1, &aExtent) )
+                if( GetTextExtentPoint32W( mhDC, &cNotDef, 1, &aExtent) )
                     mnNotdefWidth = aExtent.cx;
             }
             // use a better NotDef glyph
@@ -612,20 +612,20 @@ void SimpleWinLayout::DrawTextImpl(HDC hDC) const
         // #108267#,#109387# break up string into smaller chunks
         // the output positions will be updated by windows (SetTextAlign)
         POINT oldPos;
-        UINT oldTa = ::GetTextAlign(hDC);
-        ::SetTextAlign(hDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP);
-        ::MoveToEx(hDC, aPos.X(), aPos.Y(), &oldPos);
+        UINT oldTa = GetTextAlign(hDC);
+        SetTextAlign(hDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP);
+        MoveToEx(hDC, aPos.X(), aPos.Y(), &oldPos);
         unsigned int i = 0;
         for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount )
         {
-            ::ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
+            ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
         }
-        ::ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
-        ::MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
-        ::SetTextAlign(hDC, oldTa);
+        ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
+        MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
+        SetTextAlign(hDC, oldTa);
     }
     else
-        ::ExtTextOutW(hDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
+        ExtTextOutW(hDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
 
     if( hOrigFont )
         DeleteFont(SelectFont(hDC, hOrigFont));
@@ -966,8 +966,8 @@ static bool bManualCellAlign = true;
 static bool InitUSP()
 {
     // get the usp10.dll version info
-    HMODULE usp10 = ::GetModuleHandle("usp10.dll");
-    void *pScriptIsComplex = reinterpret_cast< void* >( ::GetProcAddress(usp10, "ScriptIsComplex"));
+    HMODULE usp10 = GetModuleHandle("usp10.dll");
+    void *pScriptIsComplex = reinterpret_cast< void* >( GetProcAddress(usp10, "ScriptIsComplex"));
     int nUspVersion = 0;
     rtl_uString* pModuleURL = NULL;
     osl_getModuleURLFromAddress( pScriptIsComplex, &pModuleURL );
@@ -980,13 +980,13 @@ static bool InitUSP()
     if( pModuleFileCStr )
     {
         DWORD nHandle;
-        DWORD nBufSize = ::GetFileVersionInfoSizeW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), &nHandle );
+        DWORD nBufSize = GetFileVersionInfoSizeW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), &nHandle );
         char* pBuffer = (char*)alloca( nBufSize );
-        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 )
-            ::VerQueryValueW( pBuffer, const_cast<LPWSTR>(L"\\"), (void**)&pFixedFileInfo, &nFixedFileSize );
+            VerQueryValueW( pBuffer, const_cast<LPWSTR>(L"\\"), (void**)&pFixedFileInfo, &nFixedFileSize );
         if( pFixedFileInfo && pFixedFileInfo->dwSignature == 0xFEEF04BD )
             nUspVersion = HIWORD(pFixedFileInfo->dwProductVersionMS) * 10000
                         + LOWORD(pFixedFileInfo->dwProductVersionMS);
@@ -2554,7 +2554,7 @@ float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId)
     HDC hDC = reinterpret_cast<HDC>(const_cast<void*>(appFontHandle));
     GLYPHMETRICS gm;
     const MAT2 mat2 = {{0,1}, {0,0}, {0,0}, {0,1}};
-    if (GDI_ERROR == ::GetGlyphOutlineW(hDC, glyphId, GGO_GLYPH_INDEX | GGO_METRICS,
+    if (GDI_ERROR == GetGlyphOutlineW(hDC, glyphId, GGO_GLYPH_INDEX | GGO_METRICS,
         &gm, 0, NULL, &mat2))
     {
         return .0f;
@@ -2568,7 +2568,7 @@ GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplW
 {
     // the log font size may differ from the font entry size if scaling is used for large fonts
     LOGFONTW aLogFont;
-    ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
+    GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
     mpFont = gr_make_font_with_advance_fn(static_cast<float>(-aLogFont.lfHeight),
         hDC, gr_fontAdvance, rWFD.GraphiteFace());
     maImpl.SetFont(mpFont);
@@ -2607,11 +2607,11 @@ bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args)
     {
         // Graphite gets very confused if the font is rotated
         LOGFONTW aLogFont;
-        ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
+        GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
         aLogFont.lfEscapement = 0;
         aLogFont.lfOrientation = 0;
-        hUnRotatedFont = ::CreateFontIndirectW( &aLogFont);
-        ::SelectFont(mhDC, hUnRotatedFont);
+        hUnRotatedFont = CreateFontIndirectW( &aLogFont);
+        SelectFont(mhDC, hUnRotatedFont);
     }
     WinLayout::AdjustLayout(args);
     maImpl.SetFontScale(WinLayout::mfFontScale);
@@ -2627,8 +2627,8 @@ bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args)
     if (args.mnOrientation)
     {
         // restore the rotated font
-        ::SelectFont(mhDC, mhFont);
-        ::DeleteObject(hUnRotatedFont);
+        SelectFont(mhDC, mhFont);
+        DeleteObject(hUnRotatedFont);
     }
     return bSucceeded;
 }
@@ -2660,12 +2660,12 @@ void GraphiteWinLayout::DrawTextImpl(HDC hDC) const
     {
         nGlyphs = maImpl.GetNextGlyphs(1, glyphIntStr, aPos, glyphIndex);
         if (nGlyphs < 1)
-          break;
+            break;
         std::copy(glyphIntStr, glyphIntStr + nGlyphs, glyphWStr);
-        ::ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, NULL, (LPCWSTR)&(glyphWStr), nGlyphs, NULL);
+        ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, NULL, (LPCWSTR)&(glyphWStr), nGlyphs, NULL);
     } while (nGlyphs);
     if( hOrigFont )
-          DeleteFont(SelectFont(hDC, hOrigFont));
+        DeleteFont(SelectFont(hDC, hOrigFont));
 }
 
 sal_Int32 GraphiteWinLayout::GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const
@@ -2685,7 +2685,7 @@ void GraphiteWinLayout::GetCaretPositions( int nArraySize, long* pCaretXArray )
 }
 
 int GraphiteWinLayout::GetNextGlyphs( int length, sal_GlyphId* glyph_out,
-                                      ::Point& pos_out, int& glyph_slot, DeviceCoordinate* glyph_adv, int* char_index,
+                                      Point& pos_out, int& glyph_slot, DeviceCoordinate* glyph_adv, int* char_index,
                                       const PhysicalFontFace** pFallbackFonts ) const
 {
     maImpl.DrawBase() = WinLayout::maDrawBase;
@@ -2799,7 +2799,7 @@ void ImplWinFontEntry::SetKernData( int nPairCount, const KERNINGPAIR* pPairData
 {
     mnKerningPairs = nPairCount;
     mpKerningPairs = new KERNINGPAIR[ mnKerningPairs ];
-    ::memcpy( mpKerningPairs, (const void*)pPairData, nPairCount*sizeof(KERNINGPAIR) );
+    memcpy( mpKerningPairs, (const void*)pPairData, nPairCount*sizeof(KERNINGPAIR) );
 }
 
 int ImplWinFontEntry::GetKerning( sal_Unicode cLeft, sal_Unicode cRight ) const


More information about the Libreoffice-commits mailing list