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

Khaled Hosny khaledhosny at eglug.org
Wed Feb 1 08:42:17 UTC 2017


 vcl/README.vars                            |    2 ++
 vcl/source/font/PhysicalFontCollection.cxx |   11 +++++++++++
 2 files changed, 13 insertions(+)

New commits:
commit 55916dfc59f05537c4e6fece77aef3cc1dbef34c
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Feb 1 10:32:32 2017 +0200

    An env var to disable font lookup
    
    To be used in layout tests.
    
    Change-Id: I551b87786a4ad4ab34a22c458561109270fb4a31

diff --git a/vcl/README.vars b/vcl/README.vars
index e97d85d..e97cf0d 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -7,6 +7,8 @@ SAL_NO_NWF - disable native widgets
 SAL_FORCEDPI - force a specific DPI (gtk & gtk3 plugins only)
 SAL_FORCE_HC - force high-contrast mode
 
+SAL_NO_FONT_LOOKUP - disable font search and fallback and always use a hard-coded font name (for some unit tests)
+
 VCL_DOUBLEBUFFERING_AVOID_PAINT - don't paint the buffer, useful to see where we do direct painting
 VCL_DOUBLEBUFFERING_FORCE_ENABLE - enable double buffered painting
 VCL_DOUBLEBUFFERING_ENABLE - enable a safe subset of double buffered painting (currently in Writer, not in any other applications)
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 49082a1..7682bc5 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -1003,6 +1003,17 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelectPattern& r
     if( !Count() )
         return nullptr;
 
+    if (getenv("SAL_NO_FONT_LOOKUP") != nullptr)
+    {
+        // Hard code the use of Liberation Sans and skip font search.
+        sal_Int32 nIndex = 0;
+        rFSD.maTargetName = GetNextFontToken(rFSD.GetFamilyName(), nIndex);
+        rFSD.maSearchName = "liberationsans";
+        PhysicalFontFamily* pFont = ImplFindFontFamilyBySearchName(rFSD.maSearchName);
+        assert(pFont);
+        return pFont;
+    }
+
     bool bMultiToken = false;
     sal_Int32 nTokenPos = 0;
     OUString& aSearchName = rFSD.maSearchName; // TODO: get rid of reference


More information about the Libreoffice-commits mailing list