From 34a327ac0d35adb36a988339044e2aed9423ec74 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 6 Apr 2016 00:20:28 +0200 Subject: 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/23850 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- vcl/source/font/PhysicalFontFamily.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx index 8cfc0e895836..c685575ee87a 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() ); -- cgit