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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 21 09:30:53 UTC 2018


 vcl/inc/impfontmetricdata.hxx  |    4 ++--
 vcl/source/font/fontmetric.cxx |   17 ++++-------------
 2 files changed, 6 insertions(+), 15 deletions(-)

New commits:
commit e0ad66c833265e16ef515283e998ed17f7c9e7f4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 20 16:54:41 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 21 11:30:32 2018 +0200

    drop unnecessary mpFontInstance use path
    
    the only call to the ImplFontMetricData ctor is from the ctor of
    LogicalFontInstance. LogicalFontInstance is only created via
    PhysicalFontFace::CreateFontInstance which is only
    from ImplFontCache::GetFontInstance.
    
    The typical call to ImplFontCache::GetFontInstance(..., FontSelectPattern&)
    is from the other GetFontInstance which create a new FontSelectPatternAttributes
    so rFontSelData.mpFontInstance won't get set in that case
    
    The other case is from the edge-case GetGlyphFallbackFont where mpFontInstance
    will be set. I'm reasonably confident that we don't need actually have this
    mpFontInstance use, but if it turns out we do then it could be restored to
    GetGlyphFallbackFont after it ctors the its LogicalFontInstance return
    
    Change-Id: I77404876b55bceced951d78cb52bc9cb829fc904
    Reviewed-on: https://gerrit.libreoffice.org/59371
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 28e0ab3798a2..f11b763be126 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -31,12 +31,12 @@ class ImplFontMetricData;
 typedef tools::SvRef<ImplFontMetricData> ImplFontMetricDataRef;
 
 class OutputDevice;
-class FontSelectPattern;
+class FontSelectPatternAttributes;
 
 class VCL_DLLPUBLIC ImplFontMetricData : public FontAttributes, public SvRefBase
 {
 public:
-    explicit        ImplFontMetricData( const FontSelectPattern& );
+    explicit        ImplFontMetricData( const FontSelectPatternAttributes& );
 
     // font instance attributes from the font request
     long            GetWidth() const                                                { return mnWidth; }
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index e6b507b161a6..d2d6e3a5d210 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -191,7 +191,7 @@ bool ImplFontMetric::operator==( const ImplFontMetric& r ) const
     return true;
 }
 
-ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
+ImplFontMetricData::ImplFontMetricData( const FontSelectPatternAttributes& rFontSelData )
     : FontAttributes( rFontSelData )
     , mnHeight ( rFontSelData.mnHeight )
     , mnWidth ( rFontSelData.mnWidth )
@@ -231,20 +231,11 @@ ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
     , mnDStrikeoutOffset2( 0 )
 {
     // initialize the used font name
-    if (rFontSelData.mpFontInstance)
-    {
-        SetFamilyName(rFontSelData.mpFontInstance->GetFontFace()->GetFamilyName());
-        SetStyleName(rFontSelData.mpFontInstance->GetFontFace()->GetStyleName());
-    }
-    else
-    {
-        sal_Int32 nTokenPos = 0;
-        SetFamilyName( GetNextFontToken( rFontSelData.GetFamilyName(), nTokenPos ) );
-        SetStyleName( rFontSelData.GetStyleName() );
-    }
+    sal_Int32 nTokenPos = 0;
+    SetFamilyName( GetNextFontToken( rFontSelData.GetFamilyName(), nTokenPos ) );
+    SetStyleName( rFontSelData.GetStyleName() );
 }
 
-
 void ImplFontMetricData::ImplInitTextLineSize( const OutputDevice* pDev )
 {
     long nDescent = mnDescent;


More information about the Libreoffice-commits mailing list