Blame SOURCES/0049-fdo-72488-Broken-text-when-showing-visible-space.patch

f0633d
From b79b4b88c5eb6b0fe4092b5eb98f3088f316f7b2 Mon Sep 17 00:00:00 2001
f0633d
From: Khaled Hosny <khaledhosny@eglug.org>
f0633d
Date: Sun, 8 Dec 2013 22:30:28 +0200
f0633d
Subject: [PATCH 049/109] fdo#72488: Broken text when showing visible space
f0633d
MIME-Version: 1.0
f0633d
Content-Type: text/plain; charset=UTF-8
f0633d
Content-Transfer-Encoding: 8bit
f0633d
f0633d
Turning on showing nonprinting characters replaces the space with bullet
f0633d
character, but still draws the text with the original kern array, this
f0633d
works fine until there are ligatures involving the space character as
f0633d
the number of glyphs after replacing the space with the bullet will be
f0633d
different and the kern array will be completely off.
f0633d
f0633d
This is a hack that gives up on replacing the space with a bullet when
f0633d
its width is zero, not sure if it would interfere with other legitimate
f0633d
uses.
f0633d
f0633d
Change-Id: I3803a2097b7c9dab1fb53b24404e8550c5bf537e
f0633d
Reviewed-on: https://gerrit.libreoffice.org/7005
f0633d
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
f0633d
Tested-by: Caolán McNamara <caolanm@redhat.com>
f0633d
---
f0633d
 sw/source/core/txtnode/fntcache.cxx | 8 +++++++-
f0633d
 1 file changed, 7 insertions(+), 1 deletion(-)
f0633d
f0633d
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
f0633d
index 80b2ea8..0857604 100644
f0633d
--- a/sw/source/core/txtnode/fntcache.cxx
f0633d
+++ b/sw/source/core/txtnode/fntcache.cxx
f0633d
@@ -1531,7 +1531,13 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
f0633d
 
f0633d
             for( sal_Int32 i = 0; i < aStr.getLength(); ++i )
f0633d
                 if( CH_BLANK == aStr[ i ] )
f0633d
-                    aStr = aStr.replaceAt(i, 1, OUString(CH_BULLET));
f0633d
+                {
f0633d
+                    /* fdo#72488 Hack: try to see if the space is zero width
f0633d
+                     * and don't bother with inserting a bullet in this case.
f0633d
+                     */
f0633d
+                    if (pKernArray[i + nCopyStart] != pKernArray[ i + nCopyStart + 1])
f0633d
+                        aStr = aStr.replaceAt(i, 1, OUString(CH_BULLET));
f0633d
+                }
f0633d
         }
f0633d
 
f0633d
         xub_StrLen nCnt = rInf.GetText().getLength();
f0633d
-- 
f0633d
1.8.4.2
f0633d