[Libreoffice-commits] core.git: 4 commits - sw/source vcl/source
Khaled Hosny
khaledhosny at eglug.org
Tue Jan 21 14:10:26 PST 2014
sw/source/core/text/guess.cxx | 2 -
sw/source/core/text/porlay.cxx | 2 -
vcl/source/gdi/outdev3.cxx | 79 ++++++++++++++++++++---------------------
3 files changed, 41 insertions(+), 42 deletions(-)
New commits:
commit 5f89d247e3dac99c297066d404c24dea3312fa51
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Tue Jan 21 18:57:30 2014 +0200
Typo in comment
Change-Id: I97252a66da63e25166acf3a7bc5a00ad1f8e94f0
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 04ff05c..2866886 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -365,7 +365,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
// which can corrupt the locale pointer inside pBreakIt.
const lang::Locale aLocale = g_pBreakIt->GetLocale( aLang );
- // determines first possible line break from nRightPos to
+ // determines first possible line break from nCutPos to
// start index of current line
LineBreakResults aResult = g_pBreakIt->GetBreakIter()->getLineBreak(
rInf.GetTxt(), nCutPos, aLocale,
commit 82943c758c0cd6a8eb23fc222b4e6a1b55c5571b
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Tue Jan 21 17:18:42 2014 +0200
Writer, please stop harassing me
This debug code was behind > 1 before
9ace8bebd88ff41d65eeaa87a6d1f1dfd8875b6d, so it probably was broken for
ages (or even forever), and all it does now is obscure my terminal with
hundreds of useless messages whenever I open an RTL document since
basically any weak LTR run next to RTL one will have the same script
type, but this code warns about it without explaining what one should
fix here.
I got fed up, whoever knows what to fix here, please do, but for now Iâm
just hiding it.
Change-Id: Ifa50e47a080f335ef6fe06bc0f0b5ed5ddbc7338
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 3c73393..a3edbf7 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1245,7 +1245,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
aScriptChanges.insert(aScriptChanges.begin() + nScriptIdx,
ScriptChangeInfo(nEnd, i18n::ScriptType::COMPLEX) );
-#if OSL_DEBUG_LEVEL > 0
+#if OSL_DEBUG_LEVEL > 1
// Check that ScriptChangeInfos are in increasing order of
// position and that we don't have "empty" changes.
sal_uInt8 nLastTyp = i18n::ScriptType::WEAK;
commit b7c30884e17027cdb71b05dea5971869b8dbea6c
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Tue Jan 21 13:59:56 2014 +0200
It is just an innocent hyphen not a hyphenator
Change-Id: I7454d90adfd507aae4c7efd1d4075454f03cddd8
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index e2a4f38..dd93f55 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -6016,11 +6016,11 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
}
sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
- sal_Unicode nHyphenatorChar, sal_Int32& rHyphenatorPos,
+ sal_Unicode nHyphenChar, sal_Int32& rHyphenPos,
sal_Int32 nIndex, sal_Int32 nLen,
long nCharExtra ) const
{
- rHyphenatorPos = -1;
+ rHyphenPos = -1;
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
sal_Int32 nRetVal = -1;
@@ -6046,24 +6046,24 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor );
// calculate hyphenated break position
- OUString aHyphenatorStr(nHyphenatorChar);
+ OUString aHyphenStr(nHyphenChar);
sal_Int32 nTempLen = 1;
- SalLayout* pHyphenatorLayout = ImplLayout( aHyphenatorStr, 0, nTempLen );
- if( pHyphenatorLayout )
+ SalLayout* pHyphenLayout = ImplLayout( aHyphenStr, 0, nTempLen );
+ if( pHyphenLayout )
{
// calculate subpixel width of hyphenation character
- long nHyphenatorPixelWidth = pHyphenatorLayout->GetTextWidth() * nSubPixelFactor;
- pHyphenatorLayout->Release();
+ long nHyphenPixelWidth = pHyphenLayout->GetTextWidth() * nSubPixelFactor;
+ pHyphenLayout->Release();
// calculate hyphenated break position
- nTextPixelWidth -= nHyphenatorPixelWidth;
+ nTextPixelWidth -= nHyphenPixelWidth;
if( nExtraPixelWidth > 0 )
nTextPixelWidth -= nExtraPixelWidth;
- rHyphenatorPos = pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor);
+ rHyphenPos = pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor);
- if( rHyphenatorPos > nRetVal )
- rHyphenatorPos = nRetVal;
+ if( rHyphenPos > nRetVal )
+ rHyphenPos = nRetVal;
}
pSalLayout->Release();
commit 775da61892fa852c35ca6e2afe9a37620eaf14f7
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Tue Jan 21 13:56:21 2014 +0200
Make both GetTextBreak() use the same coding style
For easy visual comparison.
Change-Id: Ib143f4bb7789b54dfbdd8fcf47516008403b47fd
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index f1d4b49..e2a4f38 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5989,7 +5989,6 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Int32 nIndex, sal_Int32 nLen,
long nCharExtra ) const
{
-
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
sal_Int32 nRetVal = -1;
if( pSalLayout )
@@ -6021,55 +6020,55 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Int32 nIndex, sal_Int32 nLen,
long nCharExtra ) const
{
-
rHyphenatorPos = -1;
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
- if( !pSalLayout )
- return -1;
-
- // convert logical widths into layout units
- // NOTE: be very careful to avoid rounding errors for nCharExtra case
- // problem with rounding errors especially for small nCharExtras
- // TODO: remove when layout units have subpixel granularity
- long nWidthFactor = pSalLayout->GetUnitsPerPixel();
- long nSubPixelFactor = (nWidthFactor < 64 ) ? 64 : 1;
-
- nTextWidth *= nWidthFactor * nSubPixelFactor;
- long nTextPixelWidth = ImplLogicWidthToDevicePixel( nTextWidth );
- long nExtraPixelWidth = 0;
- if( nCharExtra != 0 )
+ sal_Int32 nRetVal = -1;
+ if( pSalLayout )
{
- nCharExtra *= nWidthFactor * nSubPixelFactor;
- nExtraPixelWidth = ImplLogicWidthToDevicePixel( nCharExtra );
- }
+ // convert logical widths into layout units
+ // NOTE: be very careful to avoid rounding errors for nCharExtra case
+ // problem with rounding errors especially for small nCharExtras
+ // TODO: remove when layout units have subpixel granularity
+ long nWidthFactor = pSalLayout->GetUnitsPerPixel();
+ long nSubPixelFactor = (nWidthFactor < 64 ) ? 64 : 1;
- // calculate un-hyphenated break position
- sal_Int32 nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor );
+ nTextWidth *= nWidthFactor * nSubPixelFactor;
+ long nTextPixelWidth = ImplLogicWidthToDevicePixel( nTextWidth );
+ long nExtraPixelWidth = 0;
+ if( nCharExtra != 0 )
+ {
+ nCharExtra *= nWidthFactor * nSubPixelFactor;
+ nExtraPixelWidth = ImplLogicWidthToDevicePixel( nCharExtra );
+ }
- // calculate hyphenated break position
- OUString aHyphenatorStr(nHyphenatorChar);
- sal_Int32 nTempLen = 1;
- SalLayout* pHyphenatorLayout = ImplLayout( aHyphenatorStr, 0, nTempLen );
- if( pHyphenatorLayout )
- {
- // calculate subpixel width of hyphenation character
- long nHyphenatorPixelWidth = pHyphenatorLayout->GetTextWidth() * nSubPixelFactor;
- pHyphenatorLayout->Release();
+ // calculate un-hyphenated break position
+ nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor );
// calculate hyphenated break position
- nTextPixelWidth -= nHyphenatorPixelWidth;
- if( nExtraPixelWidth > 0 )
- nTextPixelWidth -= nExtraPixelWidth;
+ OUString aHyphenatorStr(nHyphenatorChar);
+ sal_Int32 nTempLen = 1;
+ SalLayout* pHyphenatorLayout = ImplLayout( aHyphenatorStr, 0, nTempLen );
+ if( pHyphenatorLayout )
+ {
+ // calculate subpixel width of hyphenation character
+ long nHyphenatorPixelWidth = pHyphenatorLayout->GetTextWidth() * nSubPixelFactor;
+ pHyphenatorLayout->Release();
- rHyphenatorPos =
- pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor);
+ // calculate hyphenated break position
+ nTextPixelWidth -= nHyphenatorPixelWidth;
+ if( nExtraPixelWidth > 0 )
+ nTextPixelWidth -= nExtraPixelWidth;
- if( rHyphenatorPos > nRetVal )
- rHyphenatorPos = nRetVal;
+ rHyphenatorPos = pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor);
+
+ if( rHyphenatorPos > nRetVal )
+ rHyphenatorPos = nRetVal;
+ }
+
+ pSalLayout->Release();
}
- pSalLayout->Release();
return nRetVal;
}
More information about the Libreoffice-commits
mailing list