[Libreoffice-commits] core.git: Branch 'distro/suse/suse-3.6' - sw/source

Luboš Luňák l.lunak at suse.cz
Thu Jun 13 03:01:41 PDT 2013


 sw/source/core/txtnode/fntcache.cxx |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit d16f1df93976e13f136ab35f32765232d73e5e08
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Jun 7 11:31:05 2013 +0200

    ugly workaround for external leading with symbol fonts (bnc#823626)
    
    I'd much rather find the code using external leading in Writer's layout,
    but this font rendering and layout stuff is so complicated.
    
    Change-Id: Iaf58af387a6727eb18f5a9d1613de3ae30d7c35e

diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index bf15370..536bfba 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -372,6 +372,14 @@ sal_uInt16 SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rO
     return nRet;
 }
 
+static bool IsStarSymbol(const rtl::OUString &rFontName)
+{
+    sal_uInt16 nIndex = 0;
+    rtl::OUString sFamilyNm(GetNextFontToken(rFontName, nIndex));
+    return (sFamilyNm.equalsIgnoreAsciiCase("starsymbol") ||
+        sFamilyNm.equalsIgnoreAsciiCase("opensymbol"));
+}
+
 sal_uInt16 SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut )
 {
     sal_uInt16 nRet = 0;
@@ -389,6 +397,23 @@ sal_uInt16 SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& r
             bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
             GuessLeading( *pSh, aMet );
             nExtLeading = static_cast<sal_uInt16>(aMet.GetExtLeading());
+            /* HACK: There is something wrong with Writer's bullet rendering, causing lines
+               with bullets to be higher than they should be. I think this is because
+               Writer uses font's external leading incorrect, as the vertical distance
+               added to every line instead of only a distance between multiple lines,
+               which means a single bullet has external leading added even though it
+               shouldn't, but frankly this is just an educated guess rather than understanding
+               Writer's layout (heh).
+               Symbol font in some documents is 'StarSymbol; Arial Unicode MS', and Windows
+               machines often do not have StarSymbol, falling back to Arial Unicode MS, which
+               has unusually high external leading. So just reset external leading for fonts
+               which are used to bullets, as those should not be used on multiple lines anyway,
+               so in correct rendering external leading should be irrelevant anyway.
+               Interestingly enough, bSymbol is false for 'StarSymbol; Arial Unicode MS', so
+               also check explicitly.
+            */
+            if( bSymbol || IsStarSymbol( pPrtFont->GetName()))
+                nExtLeading = 0;
         }
 
         const IDocumentSettingAccess& rIDSA = *pSh->getIDocumentSettingAccess();


More information about the Libreoffice-commits mailing list