[Libreoffice-commits] core.git: vcl/inc vcl/win

Tor Lillqvist tml at collabora.com
Mon Aug 10 09:35:20 PDT 2015


 vcl/inc/win/salgdi.h             |    2 -
 vcl/win/source/gdi/salgdi3.cxx   |   11 --------
 vcl/win/source/gdi/winlayout.cxx |   52 ++++++++++-----------------------------
 vcl/win/source/gdi/winlayout.hxx |    1 
 4 files changed, 14 insertions(+), 52 deletions(-)

New commits:
commit 3e47219e06b9a279ba22a9bbef668731f2d3e07d
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 2e89269..7d05d23 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 2e3c44a..78f1055 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 528215f..7e135ae 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;


More information about the Libreoffice-commits mailing list