[Libreoffice-commits] core.git: Branch 'feature/cib_contract935' - 4 commits - desktop/Executable_soffice_bin.mk officecfg/registry vcl/inc vcl/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed May 9 10:50:53 UTC 2018


 desktop/Executable_soffice_bin.mk                          |   12 ----
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    8 +++
 vcl/inc/impfontmetricdata.hxx                              |    2 
 vcl/source/font/fontmetric.cxx                             |   34 ++++++++++---
 4 files changed, 39 insertions(+), 17 deletions(-)

New commits:
commit 7dedcfd5189e2f827d4c0a16e6e1ec6a98677c36
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed May 9 09:44:30 2018 +0200

    Revert "soffice.bin: increase stack-size tenfold"
    
    This reverts commit eacb222cac1883c98da4a76b235916f5eda1a82f.

diff --git a/desktop/Executable_soffice_bin.mk b/desktop/Executable_soffice_bin.mk
index a314aed72f0f..f18e9dcd1fd8 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -43,7 +43,7 @@ $(eval $(call gb_Executable_add_nativeres,soffice_bin,sofficebin/officeloader))
 ifeq ($(COM),MSC)
 
 $(eval $(call gb_Executable_add_ldflags,soffice_bin,\
-    /STACK:100000000 \
+    /STACK:10000000 \
 ))
 
 endif
commit 784548d1543d09d8b69aa44ac9e9c041402f2800
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed May 9 09:44:25 2018 +0200

    Revert "soffice.bin: slightly decrease stack-size, especially for 32bit"
    
    This reverts commit 1638a4a740e84af7e441dbb3d6c04fb9b3439ce7.

diff --git a/desktop/Executable_soffice_bin.mk b/desktop/Executable_soffice_bin.mk
index e20f63caa1ff..a314aed72f0f 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -42,20 +42,10 @@ $(eval $(call gb_Executable_add_nativeres,soffice_bin,sofficebin/officeloader))
 
 ifeq ($(COM),MSC)
 
-ifeq ($(CPUNAME),X86_64)
-
 $(eval $(call gb_Executable_add_ldflags,soffice_bin,\
-    /STACK:30000000 \
+    /STACK:100000000 \
 ))
 
-else
-
-$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
-    /STACK:15000000 \
-))
-
-endif
-
 endif
 
 endif
commit 1aa62195c0536f4168858aa1d24d007171899bc5
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Fri Mar 23 14:41:01 2018 +0100

    tdf#116498 Use win metrics for 'DIN Light' font
    
    This adds a special treatment for fonts which rely on the win metrics
    for correct line spacing calculation.
    
    At the moment, only 'DIN Light' is known to need that treatment.
    
    Change-Id: Idd9fd6f63083ab7a706e0cbcd33a947d4949d4e9

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index c0d4f00eff45..fdebb1181ac3 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5588,6 +5588,14 @@
         </info>
         <value>EmojiOne Color</value>
       </prop>
+      <prop oor:name="FontsUseWinMetrics" oor:type="oor:string-list" oor:nillable="false">
+        <info>
+          <desc>Fonts where the win metrics need to be considered in order to display the font correctly</desc>
+        </info>
+        <value>
+          <it>DIN Light</it>
+        </value>
+      </prop>
       <prop oor:name="PluginsEnabled" oor:type="xs:boolean" oor:nillable="false">
         <!-- OldPath: ? -->
         <!-- OldLocation: soffice.ini -->
diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 8122bbd30ca8..b2f719e21fde 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -103,6 +103,8 @@ public:
                                         int nUPEM);
 
 private:
+    bool            ShouldUseWinMetrics();
+
     // font instance attributes from the font request
     long            mnHeight;                   // Font size
     long            mnWidth;                    // Reference Width
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 769d688b96f2..024bdd6060ac 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -18,14 +18,18 @@
  */
 
 #include <i18nlangtag/mslangid.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <vcl/fontcharmap.hxx>
 #include <vcl/metric.hxx>
 
+
 #include "impfontmetric.hxx"
 #include "impfontmetricdata.hxx"
 #include "PhysicalFontFace.hxx"
 #include "sft.hxx"
 
+#include <com/sun/star/uno/Sequence.hxx>
+
 #include <vector>
 #include <set>
 #include <cstdio>
@@ -426,6 +430,20 @@ void ImplFontMetricData::ImplInitAboveTextLineSize()
     mnAboveWUnderlineOffset = nCeiling + (nIntLeading + 1) / 2;
 }
 
+bool ImplFontMetricData::ShouldUseWinMetrics()
+{
+    css::uno::Sequence<OUString> rWinMetricFontList(
+        officecfg::Office::Common::Misc::FontsUseWinMetrics::get());
+    for (int i = 0; i < rWinMetricFontList.getLength(); ++i)
+    {
+        if (GetFamilyName() == rWinMetricFontList[i])
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
 /*
  * Calculate line spacing:
  *
@@ -468,7 +486,7 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa
     if (rInfo.winAscent || rInfo.winDescent ||
         rInfo.typoAscender || rInfo.typoDescender)
     {
-        if (fAscent == 0 && fDescent == 0)
+        if (ShouldUseWinMetrics() || (fAscent == 0.0 && fDescent == 0.0))
         {
             fAscent     = rInfo.winAscent  * fScale;
             fDescent    = rInfo.winDescent * fScale;
commit f9ccd6f3051a665ca6d64c04743089b216daacba
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Tue Oct 3 19:59:58 2017 +0200

    tdf#107605: Fix line height cslculation for broken fonts
    
    Change-Id: I06368dd15d7898dda61bc07b0f96bf82b00733b9
    Reviewed-on: https://gerrit.libreoffice.org/43095
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    (cherry picked from commit 9bc39be417a4c436cbe18391fc87e5e835551b07)

diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index b48b0aaca348..769d688b96f2 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -455,15 +455,18 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa
     GetTTFontMterics(rHheaData, rOS2Data, &rInfo);
 
     // Try hhea table first.
-    if (rInfo.ascender || rInfo.descender)
+    // tdf#107605: Some fonts have weird values here, so check that ascender is
+    // +ve and descender is -ve as they normally should.
+    if (rInfo.ascender >= 0 && rInfo.descender <= 0)
     {
-        fAscent     = rInfo.ascender  * fScale;
+        fAscent     =  rInfo.ascender  * fScale;
         fDescent    = -rInfo.descender * fScale;
-        fExtLeading = rInfo.linegap   * fScale;
+        fExtLeading =  rInfo.linegap   * fScale;
     }
 
     // But if OS/2 is present, prefer it.
-    if (rInfo.winAscent || rInfo.winDescent || rInfo.typoAscender || rInfo.typoDescender)
+    if (rInfo.winAscent || rInfo.winDescent ||
+        rInfo.typoAscender || rInfo.typoDescender)
     {
         if (fAscent == 0 && fDescent == 0)
         {
@@ -473,7 +476,8 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa
         }
 
         const uint16_t kUseTypoMetricsMask = 1 << 7;
-        if (rInfo.fsSelection & kUseTypoMetricsMask)
+        if (rInfo.fsSelection & kUseTypoMetricsMask &&
+            rInfo.typoAscender >= 0 && rInfo.typoDescender <= 0)
         {
             fAscent     =  rInfo.typoAscender  * fScale;
             fDescent    = -rInfo.typoDescender * fScale;


More information about the Libreoffice-commits mailing list