[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/source

Michael Stahl mstahl at redhat.com
Wed Apr 6 13:17:53 UTC 2016


 vcl/source/font/PhysicalFontFamily.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 69e5f9528b453da1cdb08109ca5359ac518e1c4e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Apr 6 00:20:28 2016 +0200

    tdf#98989: vcl: fix handling of non-scalable fonts like "Courier"
    
    For a VirtualDevice only scalable fonts are cloned, but for non-scalable
    bitmap fonts still an empty PhysicalFontFamily with no PhysicalFontFace
    is created, which causes text to disappear (height 0).
    
    Suppress creation of such families like it was done in LO 4.3, so that
    the fall-back can handle it and map "Courier" to "Courier New".
    
    (regression from 8d6697587776136f3121733e1c29d4200720dbd9)
    
    (cherry picked from commit 2f89245fb7e1c94bed49dde10b08ab1cf41b597b)
    
    Change-Id: I6542a3f7a01bdf46ae2bcf328fa04064f7f86332
    Reviewed-on: https://gerrit.libreoffice.org/23851
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index b3c650c..3077f79 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -270,7 +270,7 @@ void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontColle
 {
     // This is rather expensive to do per face.
     OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
-    PhysicalFontFamily* pFamily = rFontCollection.FindOrCreateFamily( aFamilyName );
+    PhysicalFontFamily* pFamily(nullptr);
 
     for( PhysicalFontFace* pFace = mpFirst; pFace; pFace = pFace->GetNextFace() )
     {
@@ -279,6 +279,11 @@ void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontColle
         if( bEmbeddable && !pFace->IsEmbeddable() && !pFace->IsSubsettable() )
             continue;
 
+        if (!pFamily)
+        {   // tdf#98989 lazy create as family without faces won't work
+            pFamily = rFontCollection.FindOrCreateFamily( aFamilyName );
+        }
+        assert(pFamily);
         PhysicalFontFace* pClonedFace = pFace->Clone();
 
         assert( pClonedFace->GetFamilyName().replaceAll("-", "").trim() == GetFamilyName().replaceAll("-", "").trim() );


More information about the Libreoffice-commits mailing list