Bugzilla – Attachment 142706 Details for
Bug 117881
FILEOPEN DOCX: Spacing in Linux is slightly different from Windows for bullet lists with Microsoft fonts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch that fixes the problem
fix.patch (text/plain), 13.33 KB, created by
Marco Diego Aurélio Mesquita
on 2018-06-13 15:05:52 UTC
(
hide
)
Description:
Patch that fixes the problem
Filename:
MIME Type:
Creator:
Marco Diego Aurélio Mesquita
Created:
2018-06-13 15:05:52 UTC
Size:
13.33 KB
patch
obsolete
>diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx >index 75a064f..3e89c99 100644 >--- a/sw/source/core/layout/flowfrm.cxx >+++ b/sw/source/core/layout/flowfrm.cxx >@@ -17,6 +17,8 @@ > * the License at http://www.apache.org/licenses/LICENSE-2.0 . > */ > >+#include <iostream> >+ > #include <memory> > #include <sal/config.h> > >@@ -59,6 +61,9 @@ > #include <pam.hxx> > #include <o3tl/make_unique.hxx> > >+#include <editeng/fhgtitem.hxx> >+ >+ > bool SwFlowFrame::m_bMoveBwdJump = false; > > SwFlowFrame::SwFlowFrame( SwFrame &rFrame ) : >@@ -1526,6 +1531,56 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, > { > nUpper += GetUpperSpaceAmountConsideredForPageGrid_( nUpper ); > } >+ >+ if (pPrevFrame && pPrevFrame->IsTextFrame()) { >+ std::cout << "We' got previous frame!" << std::endl; >+ const SwTextFrame *pTextFrame = static_cast< const SwTextFrame * >( pPrevFrame ); >+ if (pTextFrame) { >+ std::cout << "We' got text frame!!" << std::endl; >+ if (pTextFrame->GetTextNode()) { >+ std::cout << "We' got text node!" << std::endl; >+ if(pTextFrame->GetTextNode()->HasBullet()) { >+ std::cout << "We' got bullet!" << std::endl; >+ /*int rFontHeight; >+ int rDropHeight; >+ int rDropDescent; >+ if(pTextFrame->GetTextNode()->GetDropSize (rFontHeight, rDropHeight, rDropDescent)) { >+ std::cout << "We' got rFontHeight: " << rFontHeight << std::endl; >+ std::cout << "We' got rDropHeight: " << rDropHeight << std::endl; >+ std::cout << "We' got rDropDescent: " << rDropDescent << std::endl; >+ } >+ >+ SwTextFormatColl *formatcoll = pTextFrame->GetTextNode()->GetTextColl(); >+ if (formatcoll) { >+ std::cout << "We' got formatcoll!" << std::endl; >+ const SvxFontHeightItem size = formatcoll->GetSize(); >+ std::cout << "Height is: " << size.GetHeight() << std::endl; >+ }*/ >+ >+ SwTwips lineSpacing = 0; >+ const SwFrame* pPrevFrame = GetPrevFrameForUpperSpaceCalc_(); >+ if ( pPrevFrame ) >+ { >+ SwTwips nPrevLowerSpace = 0; >+ SwTwips nPrevLineSpacing = 0; >+ // #i102458# >+ bool bDummy = false; >+ GetSpacingValuesOfFrame( (*pPrevFrame), nPrevLowerSpace, nPrevLineSpacing, bDummy ); >+ std::cout << "We' got spacing: " << nPrevLowerSpace << ", " >+ << nPrevLineSpacing << std::endl; >+ lineSpacing = nPrevLineSpacing; >+ } >+ >+ >+ >+ >+// nUpper += 20; >+ nUpper += 0.20*lineSpacing; >+ } >+ } >+ } >+ } >+ > return nUpper; > } > >diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx >index 4ef24c8..305e15c 100644 >--- a/vcl/source/font/fontmetric.cxx >+++ b/vcl/source/font/fontmetric.cxx >@@ -32,6 +32,7 @@ > > #include <com/sun/star/uno/Sequence.hxx> > >+#include <iostream> > #include <vector> > #include <set> > #include <cstdio> >@@ -41,6 +42,8 @@ using namespace ::com::sun::star::uno; > using namespace ::rtl; > using namespace ::utl; > >+bool ShouldUseMaxLineGap(vcl::TTGlobalFontInfo& rInfo, OUString aFontIdentifier); >+ > FontMetric::FontMetric() > : mxImplMetric( new ImplFontMetric() ) > {} >@@ -82,42 +85,114 @@ bool FontMetric::operator==( const FontMetric& rFontMetric ) const > > long FontMetric::GetAscent() const > { >+ /*OUString aFontIdentifier( >+ GetFamilyName() + "," >+ + OUString::number(rInfo.ascender) + "," + OUString::number(rInfo.descender) + "," >+ + OUString::number(rInfo.typoAscender) + "," + OUString::number(rInfo.typoDescender) + "," >+ + OUString::number(rInfo.winAscent) + "," + OUString::number(rInfo.winDescent)); >+ */ >+ >+ long mnAscent = mxImplMetric->GetAscent(); >+ long mnDescent = mxImplMetric->GetDescent(); >+ long mnExtLeading = GetExternalLeading(); >+ >+ if (mnAscent == 1825 && mnDescent == 443 && mnExtLeading == 87) >+ { >+ std::cout << "GetAscent called for our font!" << std::endl; >+ } > return mxImplMetric->GetAscent(); > } > > void FontMetric::SetAscent( long nAscent ) > { >+ std::cout << "SetAscent called" << std::endl; >+ std::cout << "Before: " << mxImplMetric->GetAscent() << std::endl; > mxImplMetric->SetAscent( nAscent ); >+ std::cout << "After: " << mxImplMetric->GetAscent() << std::endl; > } > > long FontMetric::GetDescent() const > { >+ /*OUString aFontIdentifier( >+ GetFamilyName() + "," >+ + OUString::number(rInfo.ascender) + "," + OUString::number(rInfo.descender) + "," >+ + OUString::number(rInfo.typoAscender) + "," + OUString::number(rInfo.typoDescender) + "," >+ + OUString::number(rInfo.winAscent) + "," + OUString::number(rInfo.winDescent)); >+ */ >+ >+ long mnAscent = mxImplMetric->GetAscent(); >+ long mnDescent = mxImplMetric->GetDescent(); >+ long mnExtLeading = mxImplMetric->GetExternalLeading(); >+ >+ if (mnAscent == 1825 && mnDescent == 443 && mnExtLeading == 87) >+ { >+ std::cout << "GetDescent called for our font!" << std::endl; >+ } > return mxImplMetric->GetDescent(); > } > > void FontMetric::SetDescent( long nDescent ) > { >+ std::cout << "SetDescent called" << std::endl; >+ std::cout << "Before: " << mxImplMetric->GetDescent() << std::endl; > mxImplMetric->SetDescent( nDescent ); >+ std::cout << "After: " << mxImplMetric->GetDescent() << std::endl; > } > > long FontMetric::GetInternalLeading() const > { >+ /*OUString aFontIdentifier( >+ GetFamilyName() + "," >+ + OUString::number(rInfo.ascender) + "," + OUString::number(rInfo.descender) + "," >+ + OUString::number(rInfo.typoAscender) + "," + OUString::number(rInfo.typoDescender) + "," >+ + OUString::number(rInfo.winAscent) + "," + OUString::number(rInfo.winDescent)); >+ */ >+ >+ long mnAscent = mxImplMetric->GetAscent(); >+ long mnDescent = mxImplMetric->GetDescent(); >+ long mnExtLeading = mxImplMetric->GetExternalLeading(); >+ >+ if (mnAscent == 1825 && mnDescent == 443 && mnExtLeading == 87) >+ { >+ std::cout << "GetInternalLeading called for our font!" << std::endl; >+ } > return mxImplMetric->GetInternalLeading(); > } > > void FontMetric::SetInternalLeading( long nLeading ) > { >- mxImplMetric->SetInternalLeading( nLeading ); >+ std::cout << "SetInternalLeading called" << std::endl; >+ std::cout << "Before: " << mxImplMetric->GetInternalLeading() << std::endl; >+ mxImplMetric->SetInternalLeading( /*nLeading > 0 ? -nLeading :*/ nLeading ); >+ std::cout << "After: " << mxImplMetric->GetInternalLeading() << std::endl; > } > > long FontMetric::GetExternalLeading() const >-{ >+{ >+ /*OUString aFontIdentifier( >+ GetFamilyName() + "," >+ + OUString::number(rInfo.ascender) + "," + OUString::number(rInfo.descender) + "," >+ + OUString::number(rInfo.typoAscender) + "," + OUString::number(rInfo.typoDescender) + "," >+ + OUString::number(rInfo.winAscent) + "," + OUString::number(rInfo.winDescent));*/ >+ >+ long mnAscent = mxImplMetric->GetAscent(); >+ long mnDescent = mxImplMetric->GetDescent(); >+ long mnExtLeading = mxImplMetric->GetExternalLeading(); >+ >+ /*if (mnAscent == 1825 && mnDescent == 443 && mnExtLeading == 87) >+ {*/ >+ std::cout << "GetExternalLeading called" << std::endl; >+ std::cout << mnAscent << ", " << mnDescent << ", " << mnExtLeading << std::endl; >+ //} > return mxImplMetric->GetExternalLeading(); > } > > void FontMetric::SetExternalLeading( long nLeading ) > { >- mxImplMetric->SetExternalLeading( nLeading ); >+ std::cout << "SetExternalLeading called" << std::endl; >+ //std::cout << "Before: " << mxImplMetric->GetExternalLeading() << std::endl; >+ mxImplMetric->SetExternalLeading( nLeading); >+ //std::cout << "After: " << mxImplMetric->GetExternalLeading() << std::endl; > } > > long FontMetric::GetLineHeight() const >@@ -413,6 +488,9 @@ bool ImplFontMetricData::ShouldUseWinMetrics(vcl::TTGlobalFontInfo& rInfo) > + OUString::number(rInfo.typoAscender) + "," + OUString::number(rInfo.typoDescender) + "," > + OUString::number(rInfo.winAscent) + "," + OUString::number(rInfo.winDescent)); > >+ std::cout << aFontIdentifier << std::endl; >+ >+ > css::uno::Sequence<OUString> rWinMetricFontList( > officecfg::Office::Common::Misc::FontsUseWinMetrics::get()); > for (int i = 0; i < rWinMetricFontList.getLength(); ++i) >@@ -426,6 +504,33 @@ bool ImplFontMetricData::ShouldUseWinMetrics(vcl::TTGlobalFontInfo& rInfo) > return false; > } > >+bool ShouldUseMaxLineGap(vcl::TTGlobalFontInfo& rInfo, OUString aFontIdentifier) >+{ >+ if (aFontIdentifier == "Times New Roman,1825,-443,1420,-442,1825,443") { >+ std::cout << "We have it!" << std::endl; >+ return true; >+ } >+ return false; >+} >+ >+bool ShouldUseOS_2Metrics(vcl::TTGlobalFontInfo& rInfo, OUString aFontIdentifier) >+{ >+ if (aFontIdentifier == "Times New Roman,1825,-443,1420,-442,1825,443") { >+ std::cout << "We have it!" << std::endl; >+ return true; >+ } >+ return false; >+} >+ >+bool ShouldUseHHEAMetrics(vcl::TTGlobalFontInfo& rInfo, OUString aFontIdentifier) >+{ >+ if (aFontIdentifier == "Times New Roman,1825,-443,1420,-442,1825,443") { >+ std::cout << "We have it!" << std::endl; >+ return true; >+ } >+ return false; >+} >+ > /* > * Calculate line spacing: > * >@@ -468,7 +573,7 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa > if (rInfo.winAscent || rInfo.winDescent || > rInfo.typoAscender || rInfo.typoDescender) > { >- if (ShouldUseWinMetrics(rInfo) || (fAscent == 0.0 && fDescent == 0.0)) >+ if (fAscent == 0.0 && fDescent == 0.0) > { > fAscent = rInfo.winAscent * fScale; > fDescent = rInfo.winDescent * fScale; >@@ -485,10 +590,85 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa > } > } > >+/* OUString aFontIdentifier( >+ GetFamilyName() + "," >+ + OUString::number(rInfo.ascender) + "," >+ + OUString::number(rInfo.descender) + "," >+ + OUString::number(rInfo.linegap) + "," >+ + OUString::number(rInfo.typoAscender)+ "," >+ + OUString::number(rInfo.typoDescender) + "," >+ + OUString::number(rInfo.typoLineGap) + "," >+ + OUString::number(rInfo.winAscent) + "," >+ + OUString::number(rInfo.winDescent)); >+ std::cout << "Font info: " << aFontIdentifier << std::endl;*/ >+ >+ OUString aFontIdentifier( >+ GetFamilyName() + "," >+ + OUString::number(rInfo.ascender) + "," + OUString::number(rInfo.descender) + "," >+ + OUString::number(rInfo.typoAscender) + "," + OUString::number(rInfo.typoDescender) + "," >+ + OUString::number(rInfo.winAscent) + "," + OUString::number(rInfo.winDescent)); >+ >+ >+ /*if (ShouldUseWinMetrics(rInfo)) >+ { >+ fAscent = rInfo.winAscent * fScale; >+ fDescent = rInfo.winDescent * fScale; >+ fExtLeading = 0; >+ }*/ >+ >+ /*if (ShouldUseOS_2Metrics(rInfo, aFontIdentifier)) >+ { >+ //std::cout << "will use OS_2 metrics for " << aFontIdentifier << std::endl; >+ fAscent = rInfo.typoAscender * fScale; >+ fDescent = -rInfo.typoDescender * fScale; >+ fExtLeading = rInfo.typoLineGap * fScale; >+ }*/ >+ >+ /*if (ShouldUseHHEAMetrics(rInfo, aFontIdentifier)) >+ { >+ std::cout << "will use hhea metrics for " << aFontIdentifier << std::endl; >+ fAscent = rInfo.ascender * fScale; >+ fDescent = -rInfo.descender * fScale; >+ fExtLeading = rInfo.linegap * fScale; >+ }*/ >+ >+ if (0/*ShouldUseMaxLineGap(rInfo, aFontIdentifier)*/) >+ { >+ //fAscent = rInfo.ascender * (fScale + 0.012); >+ fAscent = rInfo.ascender * fScale; >+ fDescent = -rInfo.descender * fScale; >+ //fExtLeading = rInfo.linegap * (fScale + 0.000125); >+ fExtLeading = rInfo.linegap * fScale; >+ /*if (rInfo.linegap > rInfo.typoLineGap) >+ fExtLeading = rInfo.linegap * fScale; >+ else >+ fExtLeading = rInfo.typoLineGap * fScale;*/ >+// fAscent = 1856 * fScale; >+ fAscent = 1839 * fScale; >+// fDescent = 475 * fScale; >+ fDescent = 443 * fScale; >+// fExtLeading = 115 * fScale; >+ fExtLeading = 88 * fScale; >+ } >+ >+ >+ // Take a look at Format > Paragraph > Indents & Spacing > Spacing > Above/Below >+ // maybe that is the right place to fix this problem. >+ >+ // Take a look at ba18832ceeda21f047a664b71a4333a54737e6c8 >+ > mnAscent = round(fAscent); > mnDescent = round(fDescent); > mnExtLeading = round(fExtLeading); > >+ if (ShouldUseMaxLineGap(rInfo, aFontIdentifier)) >+ { >+ std::cout << fAscent/fScale << ", " << fDescent/fScale << ", " << fExtLeading/fScale << std::endl; >+ std::cout << fAscent << ", " << fDescent << ", " << fExtLeading << std::endl; >+ std::cout << mnAscent << ", " << mnDescent << ", " << mnExtLeading << std::endl; >+ std::cout << "Units per em is: " << nUPEM << std::endl; >+ } >+ > if (mnAscent || mnDescent) > mnIntLeading = mnAscent + mnDescent - mnHeight; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 117881
:
142382
|
142383
|
142384
|
142605
|
142706
|
142715
|
142716
|
162892